OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2009 Google Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #ifndef StorageArea_h | 26 #ifndef StorageArea_h |
27 #define StorageArea_h | 27 #define StorageArea_h |
28 | 28 |
29 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
30 #include "wtf/OwnPtr.h" | 30 #include "wtf/OwnPtr.h" |
31 #include "wtf/PassOwnPtr.h" | 31 #include "wtf/PassOwnPtr.h" |
32 #include "wtf/text/WTFString.h" | 32 #include "wtf/text/WTFString.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 class WebStorageArea; | |
36 class WebStorageNamespace; | |
37 } | |
38 | |
39 namespace blink { | |
40 | 35 |
41 class ExceptionState; | 36 class ExceptionState; |
42 class LocalFrame; | 37 class LocalFrame; |
43 class KURL; | 38 class KURL; |
44 class Page; | 39 class Page; |
45 class SecurityOrigin; | 40 class SecurityOrigin; |
46 class Storage; | 41 class Storage; |
| 42 class WebStorageArea; |
| 43 class WebStorageNamespace; |
47 | 44 |
48 enum StorageType { | 45 enum StorageType { |
49 LocalStorage, | 46 LocalStorage, |
50 SessionStorage | 47 SessionStorage |
51 }; | 48 }; |
52 | 49 |
53 class StorageArea : public NoBaseWillBeGarbageCollectedFinalized<StorageArea> { | 50 class StorageArea FINAL : public NoBaseWillBeGarbageCollectedFinalized<StorageAr
ea> { |
54 public: | 51 public: |
55 StorageArea(PassOwnPtr<blink::WebStorageArea>, StorageType); | 52 static PassOwnPtrWillBeRawPtr<StorageArea> create(PassOwnPtr<WebStorageArea>
, StorageType); |
| 53 |
56 virtual ~StorageArea(); | 54 virtual ~StorageArea(); |
57 | 55 |
58 // The HTML5 DOM Storage API | 56 // The HTML5 DOM Storage API |
59 unsigned length(ExceptionState&, LocalFrame* sourceFrame); | 57 unsigned length(ExceptionState&, LocalFrame* sourceFrame); |
60 String key(unsigned index, ExceptionState&, LocalFrame* sourceFrame); | 58 String key(unsigned index, ExceptionState&, LocalFrame* sourceFrame); |
61 String getItem(const String& key, ExceptionState&, LocalFrame* sourceFrame); | 59 String getItem(const String& key, ExceptionState&, LocalFrame* sourceFrame); |
62 void setItem(const String& key, const String& value, ExceptionState&, LocalF
rame* sourceFrame); | 60 void setItem(const String& key, const String& value, ExceptionState&, LocalF
rame* sourceFrame); |
63 void removeItem(const String& key, ExceptionState&, LocalFrame* sourceFrame)
; | 61 void removeItem(const String& key, ExceptionState&, LocalFrame* sourceFrame)
; |
64 void clear(ExceptionState&, LocalFrame* sourceFrame); | 62 void clear(ExceptionState&, LocalFrame* sourceFrame); |
65 bool contains(const String& key, ExceptionState&, LocalFrame* sourceFrame); | 63 bool contains(const String& key, ExceptionState&, LocalFrame* sourceFrame); |
66 | 64 |
67 bool canAccessStorage(LocalFrame*); | 65 bool canAccessStorage(LocalFrame*); |
68 size_t memoryBytesUsedByCache(); | 66 size_t memoryBytesUsedByCache(); |
69 | 67 |
70 static void dispatchLocalStorageEvent(const String& key, const String& oldVa
lue, const String& newValue, | 68 static void dispatchLocalStorageEvent(const String& key, const String& oldVa
lue, const String& newValue, |
71 SecurityOrigin*, const KURL& pageURL, blink::WebStorageArea* sourceAreaI
nstance, bool originatedInProcess); | 69 SecurityOrigin*, const KURL& pageURL, WebStorageArea* sourceAreaInstance
, bool originatedInProcess); |
72 static void dispatchSessionStorageEvent(const String& key, const String& old
Value, const String& newValue, | 70 static void dispatchSessionStorageEvent(const String& key, const String& old
Value, const String& newValue, |
73 SecurityOrigin*, const KURL& pageURL, const blink::WebStorageNamespace&, | 71 SecurityOrigin*, const KURL& pageURL, const WebStorageNamespace&, |
74 blink::WebStorageArea* sourceAreaInstance, bool originatedInProcess); | 72 WebStorageArea* sourceAreaInstance, bool originatedInProcess); |
75 | 73 |
76 void trace(Visitor*) { } | 74 void trace(Visitor*); |
77 | 75 |
78 private: | 76 private: |
79 static bool isEventSource(Storage*, blink::WebStorageArea* sourceAreaInstanc
e); | 77 StorageArea(PassOwnPtr<WebStorageArea>, StorageType); |
80 | 78 |
81 OwnPtr<blink::WebStorageArea> m_storageArea; | 79 static bool isEventSource(Storage*, WebStorageArea* sourceAreaInstance); |
| 80 |
| 81 OwnPtr<WebStorageArea> m_storageArea; |
82 StorageType m_storageType; | 82 StorageType m_storageType; |
| 83 RawPtrWillBeMember<LocalFrame> m_canAccessStorageCachedFrame; |
83 bool m_canAccessStorageCachedResult; | 84 bool m_canAccessStorageCachedResult; |
84 LocalFrame* m_canAccessStorageCachedFrame; | |
85 }; | 85 }; |
86 | 86 |
87 } // namespace blink | 87 } // namespace blink |
88 | 88 |
89 #endif // StorageArea_h | 89 #endif // StorageArea_h |
OLD | NEW |