~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/storage/StorageArea.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
24
 */
25
25
 
26
26
#ifndef StorageArea_h
27
27
#define StorageArea_h
28
28
 
 
29
#if ENABLE(DOM_STORAGE)
 
30
 
29
31
#include "PlatformString.h"
30
32
 
31
 
#include <wtf/Forward.h>
32
33
#include <wtf/PassRefPtr.h>
33
 
#include <wtf/RefCounted.h>
34
 
#include <wtf/RefPtr.h>
 
34
#include <wtf/Threading.h>
35
35
 
36
36
namespace WebCore {
37
37
 
38
38
    class Frame;
39
39
    class SecurityOrigin;
40
 
    class StorageMap;
 
40
    class StorageSyncManager;
41
41
    typedef int ExceptionCode;
 
42
    enum StorageType { LocalStorage, SessionStorage };
42
43
 
43
 
    class StorageArea : public RefCounted<StorageArea> {
 
44
    // This interface is required for Chromium since these actions need to be proxied between processes.
 
45
    class StorageArea : public ThreadSafeShared<StorageArea> {
44
46
    public:
45
 
        virtual ~StorageArea();
46
 
        
47
 
        virtual unsigned length() const { return internalLength(); }
48
 
        virtual String key(unsigned index, ExceptionCode& ec) const { return internalKey(index, ec); }
49
 
        virtual String getItem(const String& key) const { return internalGetItem(key); }
50
 
        virtual void setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame) { internalSetItem(key, value, ec, sourceFrame); }
51
 
        virtual void removeItem(const String& key, Frame* sourceFrame) { internalRemoveItem(key, sourceFrame); }
52
 
        virtual void clear(Frame* sourceFrame) { internalClear(sourceFrame); }
53
 
        virtual bool contains(const String& key) const { return internalContains(key); }
54
 
        
55
 
        SecurityOrigin* securityOrigin() { return m_securityOrigin.get(); }
56
 
 
57
 
    protected:
58
 
        StorageArea(SecurityOrigin*);
59
 
        StorageArea(SecurityOrigin*, StorageArea*);
60
 
                
61
 
        unsigned internalLength() const;
62
 
        String internalKey(unsigned index, ExceptionCode&) const;
63
 
        String internalGetItem(const String&) const;
64
 
        void internalSetItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame);
65
 
        void internalRemoveItem(const String&, Frame* sourceFrame);
66
 
        void internalClear(Frame* sourceFrame);
67
 
        bool internalContains(const String& key) const;
68
 
        
69
 
        // This is meant to be called from a background thread for LocalStorageArea's background thread import procedure.
70
 
        void importItem(const String& key, const String& value);
71
 
 
72
 
    private:
73
 
        virtual void itemChanged(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) = 0;
74
 
        virtual void itemRemoved(const String& key, const String& oldValue, Frame* sourceFrame) = 0;
75
 
        virtual void areaCleared(Frame* sourceFrame) = 0;
76
 
 
77
 
        RefPtr<SecurityOrigin> m_securityOrigin;
78
 
        RefPtr<StorageMap> m_storageMap;
 
47
        virtual ~StorageArea() { }
 
48
 
 
49
        // The HTML5 DOM Storage API
 
50
        virtual unsigned length() const = 0;
 
51
        virtual String key(unsigned index) const = 0;
 
52
        virtual String getItem(const String& key) const = 0;
 
53
        virtual void setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame) = 0;
 
54
        virtual void removeItem(const String& key, Frame* sourceFrame) = 0;
 
55
        virtual void clear(Frame* sourceFrame) = 0;
 
56
        virtual bool contains(const String& key) const = 0;
79
57
    };
80
58
 
81
59
} // namespace WebCore
82
60
 
 
61
#endif // ENABLE(DOM_STORAGE)
 
62
 
83
63
#endif // StorageArea_h