OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/storage/DOMWindowStorage.h" | 5 #include "modules/storage/DOMWindowStorage.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
9 #include "core/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 : DOMWindowProperty(window.frame()) | 21 : DOMWindowProperty(window.frame()) |
22 , m_window(&window) | 22 , m_window(&window) |
23 { | 23 { |
24 } | 24 } |
25 | 25 |
26 DEFINE_TRACE(DOMWindowStorage) | 26 DEFINE_TRACE(DOMWindowStorage) |
27 { | 27 { |
28 visitor->trace(m_window); | 28 visitor->trace(m_window); |
29 visitor->trace(m_sessionStorage); | 29 visitor->trace(m_sessionStorage); |
30 visitor->trace(m_localStorage); | 30 visitor->trace(m_localStorage); |
31 HeapSupplement<LocalDOMWindow>::trace(visitor); | 31 Supplement<LocalDOMWindow>::trace(visitor); |
32 DOMWindowProperty::trace(visitor); | 32 DOMWindowProperty::trace(visitor); |
33 } | 33 } |
34 | 34 |
35 // static | 35 // static |
36 const char* DOMWindowStorage::supplementName() | 36 const char* DOMWindowStorage::supplementName() |
37 { | 37 { |
38 return "DOMWindowStorage"; | 38 return "DOMWindowStorage"; |
39 } | 39 } |
40 | 40 |
41 // static | 41 // static |
42 DOMWindowStorage& DOMWindowStorage::from(LocalDOMWindow& window) | 42 DOMWindowStorage& DOMWindowStorage::from(LocalDOMWindow& window) |
43 { | 43 { |
44 DOMWindowStorage* supplement = static_cast<DOMWindowStorage*>(HeapSupplement
<LocalDOMWindow>::from(window, supplementName())); | 44 DOMWindowStorage* supplement = static_cast<DOMWindowStorage*>(Supplement<Loc
alDOMWindow>::from(window, supplementName())); |
45 if (!supplement) { | 45 if (!supplement) { |
46 supplement = new DOMWindowStorage(window); | 46 supplement = new DOMWindowStorage(window); |
47 provideTo(window, supplementName(), supplement); | 47 provideTo(window, supplementName(), supplement); |
48 } | 48 } |
49 return *supplement; | 49 return *supplement; |
50 } | 50 } |
51 | 51 |
52 // static | 52 // static |
53 Storage* DOMWindowStorage::sessionStorage(DOMWindow& window, ExceptionState& exc
eptionState) | 53 Storage* DOMWindowStorage::sessionStorage(DOMWindow& window, ExceptionState& exc
eptionState) |
54 { | 54 { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 StorageArea* storageArea = StorageNamespace::localStorageArea(document->getS
ecurityOrigin()); | 134 StorageArea* storageArea = StorageNamespace::localStorageArea(document->getS
ecurityOrigin()); |
135 if (!storageArea->canAccessStorage(m_window->frame())) { | 135 if (!storageArea->canAccessStorage(m_window->frame())) { |
136 exceptionState.throwSecurityError(accessDeniedMessage); | 136 exceptionState.throwSecurityError(accessDeniedMessage); |
137 return nullptr; | 137 return nullptr; |
138 } | 138 } |
139 m_localStorage = Storage::create(m_window->frame(), storageArea); | 139 m_localStorage = Storage::create(m_window->frame(), storageArea); |
140 return m_localStorage; | 140 return m_localStorage; |
141 } | 141 } |
142 | 142 |
143 } // namespace blink | 143 } // namespace blink |
OLD | NEW |