Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: third_party/WebKit/Source/core/frame/DOMWindow.cpp

Issue 2713623002: v8binding: Makes ToV8(window) work without a frame. (Closed)
Patch Set: Synced. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMWindow.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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) : frame_(frame), window_is_closing_(false) {} 34 DOMWindow::DOMWindow(Frame& frame)
35 : frame_(frame),
36 window_proxy_manager_(frame.GetWindowProxyManager()),
37 window_is_closing_(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(!frame_); 41 DCHECK(!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> creation_context) { 45 v8::Local<v8::Object> creation_context) {
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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 418 }
414 419
415 // If we're a top level window, bring the window to the front. 420 // If we're a top level window, bring the window to the front.
416 if (GetFrame()->IsMainFrame() && allow_focus) 421 if (GetFrame()->IsMainFrame() && allow_focus)
417 page->GetChromeClient().Focus(); 422 page->GetChromeClient().Focus();
418 423
419 page->GetFocusController().FocusDocumentView(GetFrame(), 424 page->GetFocusController().FocusDocumentView(GetFrame(),
420 true /* notifyEmbedder */); 425 true /* notifyEmbedder */);
421 } 426 }
422 427
428 v8::Local<v8::Object> DOMWindow::GlobalProxy(DOMWrapperWorld& world) {
429 return window_proxy_manager_->GetWindowProxy(world)
430 ->GlobalProxyIfNotDetached();
haraken 2017/04/14 18:51:50 Shall we add a TODO and mention that this should r
Yuki 2017/04/17 07:15:26 Done.
431 }
432
423 InputDeviceCapabilitiesConstants* DOMWindow::GetInputDeviceCapabilities() { 433 InputDeviceCapabilitiesConstants* DOMWindow::GetInputDeviceCapabilities() {
424 if (!input_capabilities_) 434 if (!input_capabilities_)
425 input_capabilities_ = new InputDeviceCapabilitiesConstants; 435 input_capabilities_ = new InputDeviceCapabilitiesConstants;
426 return input_capabilities_; 436 return input_capabilities_;
427 } 437 }
428 438
429 DEFINE_TRACE(DOMWindow) { 439 DEFINE_TRACE(DOMWindow) {
430 visitor->Trace(frame_); 440 visitor->Trace(frame_);
441 visitor->Trace(window_proxy_manager_);
431 visitor->Trace(input_capabilities_); 442 visitor->Trace(input_capabilities_);
432 visitor->Trace(location_); 443 visitor->Trace(location_);
433 EventTargetWithInlineData::Trace(visitor); 444 EventTargetWithInlineData::Trace(visitor);
434 } 445 }
435 446
436 } // namespace blink 447 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMWindow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698