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 16 matching lines...) Expand all Loading... |
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 "WebStorageEventDispatcherImpl.h" | 32 #include "WebStorageEventDispatcherImpl.h" |
33 | 33 |
34 #include "KURL.h" | 34 #include "KURL.h" |
35 #include "SecurityOrigin.h" | 35 #include "SecurityOrigin.h" |
36 | 36 |
37 #include "WebStorageAreaImpl.h" | |
38 #include "platform/WebURL.h" | 37 #include "platform/WebURL.h" |
39 #include <wtf/PassOwnPtr.h> | 38 #include <wtf/PassOwnPtr.h> |
40 | 39 |
41 namespace WebKit { | 40 namespace WebKit { |
42 | 41 |
43 extern const char* pageGroupName; | 42 extern const char* pageGroupName; |
44 | 43 |
45 WebStorageEventDispatcher* WebStorageEventDispatcher::create() | 44 WebStorageEventDispatcher* WebStorageEventDispatcher::create() |
46 { | 45 { |
47 return new WebStorageEventDispatcherImpl(); | 46 return new WebStorageEventDispatcherImpl(); |
48 } | 47 } |
49 | 48 |
50 WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl() | 49 WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl() |
51 : m_eventDispatcher(adoptPtr(new WebCore::StorageEventDispatcherImpl(pageGro
upName))) | 50 : m_eventDispatcher(adoptPtr(new WebCore::StorageEventDispatcherImpl(pageGro
upName))) |
52 { | 51 { |
53 ASSERT(m_eventDispatcher); | 52 ASSERT(m_eventDispatcher); |
54 } | 53 } |
55 | 54 |
56 void WebStorageEventDispatcherImpl::dispatchStorageEvent(const WebString& key, c
onst WebString& oldValue, | 55 void WebStorageEventDispatcherImpl::dispatchStorageEvent(const WebString& key, c
onst WebString& oldValue, |
57 const WebString& newVal
ue, const WebString& origin, | 56 const WebString& newVal
ue, const WebString& origin, |
58 const WebURL& passedInU
RL, bool isLocalStorage) | 57 const WebURL& pageURL,
bool isLocalStorage) |
59 { | 58 { |
60 // Hack for single-process mode and test shell. | |
61 const WebURL* storageAreaImplURL = WebStorageAreaImpl::currentStorageEventUR
L(); | |
62 const WebURL& url = storageAreaImplURL ? *storageAreaImplURL : passedInURL; | |
63 | |
64 WebCore::StorageType storageType = isLocalStorage ? WebCore::LocalStorage :
WebCore::SessionStorage; | 59 WebCore::StorageType storageType = isLocalStorage ? WebCore::LocalStorage :
WebCore::SessionStorage; |
65 RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::cr
eateFromString(origin); | 60 RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::cr
eateFromString(origin); |
66 m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOri
gin.get(), url, storageType); | 61 m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOri
gin.get(), pageURL, storageType); |
67 } | 62 } |
68 | 63 |
69 } // namespace WebKit | 64 } // namespace WebKit |
OLD | NEW |