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 #include "core/frame/DOMWindow.h" | 5 #include "core/frame/DOMWindow.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | |
9 #include "bindings/core/v8/WindowProxyManager.h" | |
8 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
9 #include "core/dom/ExecutionContext.h" | 11 #include "core/dom/ExecutionContext.h" |
10 #include "core/dom/SecurityContext.h" | 12 #include "core/dom/SecurityContext.h" |
11 #include "core/events/MessageEvent.h" | 13 #include "core/events/MessageEvent.h" |
12 #include "core/frame/Frame.h" | 14 #include "core/frame/Frame.h" |
13 #include "core/frame/FrameClient.h" | 15 #include "core/frame/FrameClient.h" |
14 #include "core/frame/FrameConsole.h" | 16 #include "core/frame/FrameConsole.h" |
15 #include "core/frame/LocalDOMWindow.h" | 17 #include "core/frame/LocalDOMWindow.h" |
16 #include "core/frame/Location.h" | 18 #include "core/frame/Location.h" |
17 #include "core/frame/Settings.h" | 19 #include "core/frame/Settings.h" |
18 #include "core/frame/UseCounter.h" | 20 #include "core/frame/UseCounter.h" |
19 #include "core/input/InputDeviceCapabilities.h" | 21 #include "core/input/InputDeviceCapabilities.h" |
20 #include "core/inspector/ConsoleMessage.h" | 22 #include "core/inspector/ConsoleMessage.h" |
21 #include "core/loader/MixedContentChecker.h" | 23 #include "core/loader/MixedContentChecker.h" |
22 #include "core/page/ChromeClient.h" | 24 #include "core/page/ChromeClient.h" |
23 #include "core/page/FocusController.h" | 25 #include "core/page/FocusController.h" |
24 #include "core/page/Page.h" | 26 #include "core/page/Page.h" |
25 #include "core/probe/CoreProbes.h" | 27 #include "core/probe/CoreProbes.h" |
26 #include "platform/weborigin/KURL.h" | 28 #include "platform/weborigin/KURL.h" |
27 #include "platform/weborigin/SecurityOrigin.h" | 29 #include "platform/weborigin/SecurityOrigin.h" |
28 #include "platform/weborigin/Suborigin.h" | 30 #include "platform/weborigin/Suborigin.h" |
29 | 31 |
30 namespace blink { | 32 namespace blink { |
31 | 33 |
32 DOMWindow::DOMWindow(Frame& frame) : m_frame(frame), m_windowIsClosing(false) {} | 34 DOMWindow::DOMWindow(Frame& frame) |
35 : m_frame(frame), | |
36 m_windowProxyManager(frame.getWindowProxyManager()), | |
37 m_windowIsClosing(false) {} | |
33 | 38 |
34 DOMWindow::~DOMWindow() { | 39 DOMWindow::~DOMWindow() { |
35 // The frame must be disconnected before finalization. | 40 // The frame must be disconnected before finalization. |
36 DCHECK(!m_frame); | 41 DCHECK(!m_frame); |
37 } | 42 } |
38 | 43 |
39 v8::Local<v8::Object> DOMWindow::wrap(v8::Isolate*, | 44 v8::Local<v8::Object> DOMWindow::wrap(v8::Isolate*, |
40 v8::Local<v8::Object> creationContext) { | 45 v8::Local<v8::Object> creationContext) { |
41 LOG(FATAL) << "DOMWindow must never be wrapped with wrap method. The " | 46 LOG(FATAL) << "DOMWindow must never be wrapped with wrap method. The " |
42 "wrappers must be created at WindowProxy::createContext() and " | 47 "wrappers must be created at WindowProxy::createContext() and " |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 (toDocument(context)->domWindow() == opener()); | 413 (toDocument(context)->domWindow() == opener()); |
409 } | 414 } |
410 | 415 |
411 // If we're a top level window, bring the window to the front. | 416 // If we're a top level window, bring the window to the front. |
412 if (frame()->isMainFrame() && allowFocus) | 417 if (frame()->isMainFrame() && allowFocus) |
413 page->chromeClient().focus(); | 418 page->chromeClient().focus(); |
414 | 419 |
415 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); | 420 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); |
416 } | 421 } |
417 | 422 |
423 v8::Local<v8::Object> DOMWindow::globalProxy(DOMWrapperWorld& world) { | |
424 return m_windowProxyManager->windowProxy(world)->globalProxyIfNotDetached(); | |
haraken
2017/04/07 10:08:58
So, are you planning to change this in the future
Yuki
2017/04/07 10:30:44
Yes, I hope that I can make it someday.
| |
425 } | |
426 | |
418 InputDeviceCapabilitiesConstants* DOMWindow::getInputDeviceCapabilities() { | 427 InputDeviceCapabilitiesConstants* DOMWindow::getInputDeviceCapabilities() { |
419 if (!m_inputCapabilities) | 428 if (!m_inputCapabilities) |
420 m_inputCapabilities = new InputDeviceCapabilitiesConstants; | 429 m_inputCapabilities = new InputDeviceCapabilitiesConstants; |
421 return m_inputCapabilities; | 430 return m_inputCapabilities; |
422 } | 431 } |
423 | 432 |
424 DEFINE_TRACE(DOMWindow) { | 433 DEFINE_TRACE(DOMWindow) { |
425 visitor->trace(m_frame); | 434 visitor->trace(m_frame); |
435 visitor->trace(m_windowProxyManager); | |
426 visitor->trace(m_inputCapabilities); | 436 visitor->trace(m_inputCapabilities); |
427 visitor->trace(m_location); | 437 visitor->trace(m_location); |
428 EventTargetWithInlineData::trace(visitor); | 438 EventTargetWithInlineData::trace(visitor); |
429 } | 439 } |
430 | 440 |
431 } // namespace blink | 441 } // namespace blink |
OLD | NEW |