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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 11 matching lines...) Expand all Loading... |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "WebStorageEventDispatcher.h" | 32 #include "WebStorageEventDispatcherImpl.h" |
33 | 33 |
34 #include "KURL.h" | 34 #include "KURL.h" |
35 #include "SecurityOrigin.h" | 35 #include "SecurityOrigin.h" |
36 #include "StorageAreaProxy.h" | 36 #include "StorageAreaProxy.h" |
37 #include "WebViewImpl.h" | |
38 | 37 |
39 #include "platform/WebURL.h" | 38 #include "platform/WebURL.h" |
40 #include <wtf/PassOwnPtr.h> | 39 #include <wtf/PassOwnPtr.h> |
41 | 40 |
42 // FIXME: move this file to WebStorageEventDispatcher.cpp | 41 namespace WebKit { |
43 | 42 |
44 namespace WebKit { | 43 extern const char* pageGroupName; |
45 | 44 |
46 void WebStorageEventDispatcher::dispatchLocalStorageEvent( | 45 void WebStorageEventDispatcher::dispatchLocalStorageEvent( |
47 const WebString& key, const WebString& oldValue, | 46 const WebString& key, const WebString& oldValue, |
48 const WebString& newValue, const WebURL& origin, | 47 const WebString& newValue, const WebURL& origin, |
49 const WebURL& pageURL, WebStorageArea* sourceAreaInstance, | 48 const WebURL& pageURL, WebStorageArea* sourceAreaInstance, |
50 bool originatedInProcess) | 49 bool originatedInProcess) |
51 { | 50 { |
52 RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::cr
eate(origin); | 51 RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::cr
eate(origin); |
53 WebCore::StorageAreaProxy::dispatchLocalStorageEvent( | 52 WebCore::StorageAreaProxy::dispatchLocalStorageEvent( |
54 WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOr
igin.get(), pageURL, | 53 pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageUR
L, |
55 sourceAreaInstance, originatedInProcess); | 54 sourceAreaInstance, originatedInProcess); |
56 } | 55 } |
57 | 56 |
58 void WebStorageEventDispatcher::dispatchSessionStorageEvent( | 57 void WebStorageEventDispatcher::dispatchSessionStorageEvent( |
59 const WebString& key, const WebString& oldValue, | 58 const WebString& key, const WebString& oldValue, |
60 const WebString& newValue, const WebURL& origin, | 59 const WebString& newValue, const WebURL& origin, |
61 const WebURL& pageURL, const WebStorageNamespace& sessionNamespace, | 60 const WebURL& pageURL, const WebStorageNamespace& sessionNamespace, |
62 WebStorageArea* sourceAreaInstance, bool originatedInProcess) | 61 WebStorageArea* sourceAreaInstance, bool originatedInProcess) |
63 { | 62 { |
64 RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::cr
eate(origin); | 63 RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::cr
eate(origin); |
65 WebCore::StorageAreaProxy::dispatchSessionStorageEvent( | 64 WebCore::StorageAreaProxy::dispatchSessionStorageEvent( |
66 WebViewImpl::defaultPageGroup(), key, oldValue, newValue, securityOr
igin.get(), pageURL, | 65 pageGroupName, key, oldValue, newValue, securityOrigin.get(), pageUR
L, |
67 sessionNamespace, sourceAreaInstance, originatedInProcess); | 66 sessionNamespace, sourceAreaInstance, originatedInProcess); |
68 } | 67 } |
69 | 68 |
| 69 |
| 70 // FIXME: remove the WebStorageEventDispatcherImpl class soon. |
| 71 |
| 72 WebStorageEventDispatcher* WebStorageEventDispatcher::create() |
| 73 { |
| 74 return new WebStorageEventDispatcherImpl(); |
| 75 } |
| 76 |
| 77 WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl() |
| 78 : m_eventDispatcher(adoptPtr(new WebCore::StorageEventDispatcherImpl(pageGro
upName))) |
| 79 { |
| 80 ASSERT(m_eventDispatcher); |
| 81 } |
| 82 |
| 83 void WebStorageEventDispatcherImpl::dispatchStorageEvent(const WebString& key, c
onst WebString& oldValue, |
| 84 const WebString& newVal
ue, const WebString& origin, |
| 85 const WebURL& pageURL,
bool isLocalStorage) |
| 86 { |
| 87 WebCore::StorageType storageType = isLocalStorage ? WebCore::LocalStorage :
WebCore::SessionStorage; |
| 88 RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::cr
eateFromString(origin); |
| 89 m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOri
gin.get(), pageURL, storageType); |
| 90 } |
| 91 |
70 } // namespace WebKit | 92 } // namespace WebKit |
OLD | NEW |