| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 DOMWindow_h | 5 #ifndef DOMWindow_h |
| 6 #define DOMWindow_h | 6 #define DOMWindow_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/Transferables.h" | 8 #include "bindings/core/v8/Transferables.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
| 11 #include "core/frame/DOMWindowBase64.h" | 11 #include "core/frame/DOMWindowBase64.h" |
| 12 #include "core/frame/Frame.h" | 12 #include "core/frame/Frame.h" |
| 13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
| 14 #include "platform/wtf/Assertions.h" | 14 #include "platform/wtf/Assertions.h" |
| 15 #include "platform/wtf/Forward.h" | 15 #include "platform/wtf/Forward.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 class Document; | 19 class Document; |
| 20 class InputDeviceCapabilitiesConstants; | 20 class InputDeviceCapabilitiesConstants; |
| 21 class LocalDOMWindow; |
| 21 class Location; | 22 class Location; |
| 22 class LocalDOMWindow; | |
| 23 class MessageEvent; | 23 class MessageEvent; |
| 24 class SerializedScriptValue; | 24 class SerializedScriptValue; |
| 25 class WindowProxyManager; |
| 25 | 26 |
| 26 class CORE_EXPORT DOMWindow : public EventTargetWithInlineData, | 27 class CORE_EXPORT DOMWindow : public EventTargetWithInlineData, |
| 27 public DOMWindowBase64 { | 28 public DOMWindowBase64 { |
| 28 DEFINE_WRAPPERTYPEINFO(); | 29 DEFINE_WRAPPERTYPEINFO(); |
| 29 | 30 |
| 30 public: | 31 public: |
| 31 ~DOMWindow() override; | 32 ~DOMWindow() override; |
| 32 | 33 |
| 33 Frame* GetFrame() const { | 34 Frame* GetFrame() const { |
| 34 // A Frame is typically reused for navigations. If |m_frame| is not null, | 35 // A Frame is typically reused for navigations. If |m_frame| is not null, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 102 |
| 102 // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e., | 103 // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e., |
| 103 // when its document is no longer the document that is displayed in its | 104 // when its document is no longer the document that is displayed in its |
| 104 // frame), we would like to zero out m_frame to avoid being confused | 105 // frame), we would like to zero out m_frame to avoid being confused |
| 105 // by the document that is currently active in m_frame. | 106 // by the document that is currently active in m_frame. |
| 106 // See https://bugs.webkit.org/show_bug.cgi?id=62054 | 107 // See https://bugs.webkit.org/show_bug.cgi?id=62054 |
| 107 bool IsCurrentlyDisplayedInFrame() const; | 108 bool IsCurrentlyDisplayedInFrame() const; |
| 108 | 109 |
| 109 bool isSecureContext() const; | 110 bool isSecureContext() const; |
| 110 | 111 |
| 112 v8::Local<v8::Object> GlobalProxy(DOMWrapperWorld&); |
| 113 |
| 111 InputDeviceCapabilitiesConstants* GetInputDeviceCapabilities(); | 114 InputDeviceCapabilitiesConstants* GetInputDeviceCapabilities(); |
| 112 | 115 |
| 113 protected: | 116 protected: |
| 114 explicit DOMWindow(Frame&); | 117 explicit DOMWindow(Frame&); |
| 115 | 118 |
| 116 virtual void SchedulePostMessage(MessageEvent*, | 119 virtual void SchedulePostMessage(MessageEvent*, |
| 117 PassRefPtr<SecurityOrigin> target, | 120 PassRefPtr<SecurityOrigin> target, |
| 118 Document* source) = 0; | 121 Document* source) = 0; |
| 119 | 122 |
| 120 void DisconnectFromFrame() { frame_ = nullptr; } | 123 void DisconnectFromFrame() { frame_ = nullptr; } |
| 121 | 124 |
| 122 private: | 125 private: |
| 123 Member<Frame> frame_; | 126 Member<Frame> frame_; |
| 127 // Unlike |frame_|, |window_proxy_manager_| is available even after the |
| 128 // window's frame gets detached from the DOM, until the end of the lifetime |
| 129 // of this object. |
| 130 const Member<WindowProxyManager> window_proxy_manager_; |
| 124 Member<InputDeviceCapabilitiesConstants> input_capabilities_; | 131 Member<InputDeviceCapabilitiesConstants> input_capabilities_; |
| 125 mutable Member<Location> location_; | 132 mutable Member<Location> location_; |
| 126 | 133 |
| 127 // Set to true when close() has been called. Needed for | 134 // Set to true when close() has been called. Needed for |
| 128 // |window.closed| determinism; having it return 'true' | 135 // |window.closed| determinism; having it return 'true' |
| 129 // only after the layout widget's deferred window close | 136 // only after the layout widget's deferred window close |
| 130 // operation has been performed, exposes (confusing) | 137 // operation has been performed, exposes (confusing) |
| 131 // implementation details to scripts. | 138 // implementation details to scripts. |
| 132 bool window_is_closing_; | 139 bool window_is_closing_; |
| 133 }; | 140 }; |
| 134 | 141 |
| 135 } // namespace blink | 142 } // namespace blink |
| 136 | 143 |
| 137 #endif // DOMWindow_h | 144 #endif // DOMWindow_h |
| OLD | NEW |