| 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 #ifndef DOMWindowStorage_h | 5 #ifndef DOMWindowStorage_h |
| 6 #define DOMWindowStorage_h | 6 #define DOMWindowStorage_h |
| 7 | 7 |
| 8 #include "core/dom/ContextLifecycleObserver.h" | |
| 9 #include "core/frame/LocalDOMWindow.h" | 8 #include "core/frame/LocalDOMWindow.h" |
| 10 #include "platform/Supplementable.h" | 9 #include "platform/Supplementable.h" |
| 11 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 12 | 11 |
| 13 namespace blink { | 12 namespace blink { |
| 14 | 13 |
| 15 class DOMWindow; | 14 class DOMWindow; |
| 16 class ExceptionState; | 15 class ExceptionState; |
| 17 class LocalDOMWindow; | 16 class LocalDOMWindow; |
| 18 class Storage; | 17 class Storage; |
| 19 | 18 |
| 20 class DOMWindowStorage final : public GarbageCollected<DOMWindowStorage>, | 19 class DOMWindowStorage final : public GarbageCollected<DOMWindowStorage>, |
| 21 public Supplement<LocalDOMWindow>, | 20 public Supplement<LocalDOMWindow> { |
| 22 public ContextClient { | |
| 23 USING_GARBAGE_COLLECTED_MIXIN(DOMWindowStorage); | 21 USING_GARBAGE_COLLECTED_MIXIN(DOMWindowStorage); |
| 24 | 22 |
| 25 public: | 23 public: |
| 26 static DOMWindowStorage& from(LocalDOMWindow&); | 24 static DOMWindowStorage& from(LocalDOMWindow&); |
| 27 static Storage* sessionStorage(DOMWindow&, ExceptionState&); | 25 static Storage* sessionStorage(DOMWindow&, ExceptionState&); |
| 28 static Storage* localStorage(DOMWindow&, ExceptionState&); | 26 static Storage* localStorage(DOMWindow&, ExceptionState&); |
| 29 | 27 |
| 30 Storage* sessionStorage(ExceptionState&) const; | 28 Storage* sessionStorage(ExceptionState&) const; |
| 31 Storage* localStorage(ExceptionState&) const; | 29 Storage* localStorage(ExceptionState&) const; |
| 32 Storage* optionalSessionStorage() const { return m_sessionStorage.get(); } | 30 Storage* optionalSessionStorage() const { return m_sessionStorage.get(); } |
| 33 Storage* optionalLocalStorage() const { return m_localStorage.get(); } | 31 Storage* optionalLocalStorage() const { return m_localStorage.get(); } |
| 34 | 32 |
| 35 DECLARE_TRACE(); | 33 DECLARE_TRACE(); |
| 36 | 34 |
| 37 private: | 35 private: |
| 38 explicit DOMWindowStorage(LocalDOMWindow&); | 36 explicit DOMWindowStorage(LocalDOMWindow&); |
| 39 static const char* supplementName(); | 37 static const char* supplementName(); |
| 40 | 38 |
| 41 Member<LocalDOMWindow> m_window; | |
| 42 mutable Member<Storage> m_sessionStorage; | 39 mutable Member<Storage> m_sessionStorage; |
| 43 mutable Member<Storage> m_localStorage; | 40 mutable Member<Storage> m_localStorage; |
| 44 }; | 41 }; |
| 45 | 42 |
| 46 } // namespace blink | 43 } // namespace blink |
| 47 | 44 |
| 48 #endif // DOMWindowStorage_h | 45 #endif // DOMWindowStorage_h |
| OLD | NEW |