| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 return parent ? parent->domWindow() : frame()->domWindow(); | 105 return parent ? parent->domWindow() : frame()->domWindow(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 DOMWindow* DOMWindow::top() const { | 108 DOMWindow* DOMWindow::top() const { |
| 109 if (!frame()) | 109 if (!frame()) |
| 110 return nullptr; | 110 return nullptr; |
| 111 | 111 |
| 112 return frame()->tree().top()->domWindow(); | 112 return frame()->tree().top()->domWindow(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 External* DOMWindow::external() const { | 115 External* DOMWindow::external() { |
| 116 DEFINE_STATIC_LOCAL(Persistent<External>, external, (new External)); | 116 if (!m_external) |
| 117 return external; | 117 m_external = new External; |
| 118 return m_external; |
| 118 } | 119 } |
| 119 | 120 |
| 120 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) const { | 121 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) const { |
| 121 if (!frame()) | 122 if (!frame()) |
| 122 return nullptr; | 123 return nullptr; |
| 123 | 124 |
| 124 Frame* child = frame()->tree().scopedChild(index); | 125 Frame* child = frame()->tree().scopedChild(index); |
| 125 return child ? child->domWindow() : nullptr; | 126 return child ? child->domWindow() : nullptr; |
| 126 } | 127 } |
| 127 | 128 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 // If we're a top level window, bring the window to the front. | 440 // If we're a top level window, bring the window to the front. |
| 440 if (frame()->isMainFrame() && allowFocus) | 441 if (frame()->isMainFrame() && allowFocus) |
| 441 page->chromeClient().focus(); | 442 page->chromeClient().focus(); |
| 442 | 443 |
| 443 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); | 444 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); |
| 444 } | 445 } |
| 445 | 446 |
| 446 DEFINE_TRACE(DOMWindow) { | 447 DEFINE_TRACE(DOMWindow) { |
| 447 visitor->trace(m_frame); | 448 visitor->trace(m_frame); |
| 448 visitor->trace(m_location); | 449 visitor->trace(m_location); |
| 450 visitor->trace(m_external); |
| 449 EventTargetWithInlineData::trace(visitor); | 451 EventTargetWithInlineData::trace(visitor); |
| 450 } | 452 } |
| 451 | 453 |
| 452 } // namespace blink | 454 } // namespace blink |
| OLD | NEW |