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 "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
10 #include "core/dom/SecurityContext.h" | 10 #include "core/dom/SecurityContext.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 bool DOMWindow::closed() const { | 71 bool DOMWindow::closed() const { |
72 return m_windowIsClosing || !frame() || !frame()->host(); | 72 return m_windowIsClosing || !frame() || !frame()->host(); |
73 } | 73 } |
74 | 74 |
75 unsigned DOMWindow::length() const { | 75 unsigned DOMWindow::length() const { |
76 return frame() ? frame()->tree().scopedChildCount() : 0; | 76 return frame() ? frame()->tree().scopedChildCount() : 0; |
77 } | 77 } |
78 | 78 |
79 DOMWindow* DOMWindow::self() const { | 79 v8::Local<v8::Object> DOMWindow::self(ScriptState* scriptState) const { |
80 if (!frame()) | 80 return scriptState->context()->Global(); |
81 return nullptr; | |
82 | |
83 return frame()->domWindow(); | |
84 } | 81 } |
85 | 82 |
86 DOMWindow* DOMWindow::opener() const { | 83 DOMWindow* DOMWindow::opener() const { |
87 // FIXME: Use FrameTree to get opener as well, to simplify logic here. | 84 // FIXME: Use FrameTree to get opener as well, to simplify logic here. |
88 if (!frame() || !frame()->client()) | 85 if (!frame() || !frame()->client()) |
89 return nullptr; | 86 return nullptr; |
90 | 87 |
91 Frame* opener = frame()->client()->opener(); | 88 Frame* opener = frame()->client()->opener(); |
92 return opener ? opener->domWindow() : nullptr; | 89 return opener ? opener->domWindow() : nullptr; |
93 } | 90 } |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 428 |
432 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); | 429 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); |
433 } | 430 } |
434 | 431 |
435 DEFINE_TRACE(DOMWindow) { | 432 DEFINE_TRACE(DOMWindow) { |
436 visitor->trace(m_location); | 433 visitor->trace(m_location); |
437 EventTargetWithInlineData::trace(visitor); | 434 EventTargetWithInlineData::trace(visitor); |
438 } | 435 } |
439 | 436 |
440 } // namespace blink | 437 } // namespace blink |
OLD | NEW |