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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 bool DOMWindow::closed() const { | 76 bool DOMWindow::closed() const { |
77 return m_windowIsClosing || !frame() || !frame()->host(); | 77 return m_windowIsClosing || !frame() || !frame()->host(); |
78 } | 78 } |
79 | 79 |
80 unsigned DOMWindow::length() const { | 80 unsigned DOMWindow::length() const { |
81 return frame() ? frame()->tree().scopedChildCount() : 0; | 81 return frame() ? frame()->tree().scopedChildCount() : 0; |
82 } | 82 } |
83 | 83 |
84 v8::Local<v8::Object> DOMWindow::self(ScriptState* scriptState) const { | 84 DOMWindow* DOMWindow::self() const { |
85 return scriptState->context()->Global(); | 85 if (!frame()) |
| 86 return nullptr; |
| 87 |
| 88 return frame()->domWindow(); |
86 } | 89 } |
87 | 90 |
88 DOMWindow* DOMWindow::opener() const { | 91 DOMWindow* DOMWindow::opener() const { |
89 // FIXME: Use FrameTree to get opener as well, to simplify logic here. | 92 // FIXME: Use FrameTree to get opener as well, to simplify logic here. |
90 if (!frame() || !frame()->client()) | 93 if (!frame() || !frame()->client()) |
91 return nullptr; | 94 return nullptr; |
92 | 95 |
93 Frame* opener = frame()->client()->opener(); | 96 Frame* opener = frame()->client()->opener(); |
94 return opener ? opener->domWindow() : nullptr; | 97 return opener ? opener->domWindow() : nullptr; |
95 } | 98 } |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); | 436 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); |
434 } | 437 } |
435 | 438 |
436 DEFINE_TRACE(DOMWindow) { | 439 DEFINE_TRACE(DOMWindow) { |
437 visitor->trace(m_frame); | 440 visitor->trace(m_frame); |
438 visitor->trace(m_location); | 441 visitor->trace(m_location); |
439 EventTargetWithInlineData::trace(visitor); | 442 EventTargetWithInlineData::trace(visitor); |
440 } | 443 } |
441 | 444 |
442 } // namespace blink | 445 } // namespace blink |
OLD | NEW |