| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // FIXME: Use FrameTree to get opener as well, to simplify logic here. | 96 // FIXME: Use FrameTree to get opener as well, to simplify logic here. |
| 97 if (!frame() || !frame()->client()) | 97 if (!frame() || !frame()->client()) |
| 98 return nullptr; | 98 return nullptr; |
| 99 | 99 |
| 100 Frame* opener = frame()->client()->opener(); | 100 Frame* opener = frame()->client()->opener(); |
| 101 return opener ? opener->domWindow() : nullptr; | 101 return opener ? opener->domWindow() : nullptr; |
| 102 } | 102 } |
| 103 | 103 |
| 104 DOMWindow* DOMWindow::parent() const | 104 DOMWindow* DOMWindow::parent() const |
| 105 { | 105 { |
| 106 if (!frame()) | 106 // TODO(yukishiino): The 'parent' attribute must return |this| |
| 107 // (the WindowProxy object of the browsing context itself) when it's |
| 108 // top-level or detached. |
| 109 if (!isCurrentlyDisplayedInFrame()) |
| 107 return nullptr; | 110 return nullptr; |
| 108 | 111 |
| 109 Frame* parent = frame()->tree().parent(); | 112 Frame* parent = frame()->tree().parent(); |
| 110 return parent ? parent->domWindow() : frame()->domWindow(); | 113 return parent ? parent->domWindow() : frame()->domWindow(); |
| 111 } | 114 } |
| 112 | 115 |
| 113 DOMWindow* DOMWindow::top() const | 116 DOMWindow* DOMWindow::top() const |
| 114 { | 117 { |
| 115 if (!frame()) | 118 // TODO(yukishiino): The 'top' attribute must return |this| |
| 119 // (the WindowProxy object of the browsing context itself) when it's |
| 120 // top-level or detached. |
| 121 if (!isCurrentlyDisplayedInFrame()) |
| 116 return nullptr; | 122 return nullptr; |
| 117 | 123 |
| 118 return frame()->tree().top()->domWindow(); | 124 return frame()->tree().top()->domWindow(); |
| 119 } | 125 } |
| 120 | 126 |
| 121 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) const | 127 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) const |
| 122 { | 128 { |
| 123 if (!frame()) | 129 if (!frame()) |
| 124 return nullptr; | 130 return nullptr; |
| 125 | 131 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */
); | 374 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */
); |
| 369 } | 375 } |
| 370 | 376 |
| 371 DEFINE_TRACE(DOMWindow) | 377 DEFINE_TRACE(DOMWindow) |
| 372 { | 378 { |
| 373 visitor->trace(m_location); | 379 visitor->trace(m_location); |
| 374 EventTargetWithInlineData::trace(visitor); | 380 EventTargetWithInlineData::trace(visitor); |
| 375 } | 381 } |
| 376 | 382 |
| 377 } // namespace blink | 383 } // namespace blink |
| OLD | NEW |