Chromium Code Reviews| 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/DeviceSingleWindowEventController.h" | 5 #include "core/frame/DeviceSingleWindowEventController.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/events/Event.h" | 8 #include "core/events/Event.h" |
| 9 #include "core/page/Page.h" | 9 #include "core/page/Page.h" |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 stopUpdating(); | 61 stopUpdating(); |
| 62 m_hasEventListener = false; | 62 m_hasEventListener = false; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void DeviceSingleWindowEventController::didRemoveAllEventListeners( | 65 void DeviceSingleWindowEventController::didRemoveAllEventListeners( |
| 66 LocalDOMWindow*) { | 66 LocalDOMWindow*) { |
| 67 stopUpdating(); | 67 stopUpdating(); |
| 68 m_hasEventListener = false; | 68 m_hasEventListener = false; |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool DeviceSingleWindowEventController::isSameSecurityOriginAsMainFrame() | |
| 72 const { | |
| 73 if (!document().frame() || !document().page()) | |
| 74 return false; | |
| 75 | |
| 76 if (document().frame()->isMainFrame()) | |
| 77 return true; | |
| 78 | |
| 79 SecurityOrigin* mainSecurityOrigin = | |
| 80 document().page()->mainFrame()->securityContext()->getSecurityOrigin(); | |
| 81 | |
| 82 if (mainSecurityOrigin && | |
| 83 document().getSecurityOrigin()->canAccess(mainSecurityOrigin)) | |
| 84 return true; | |
|
Rick Byers
2017/02/17 22:21:28
Looks like this logic is the same as in Deprecatio
timvolodine
2017/02/28 15:48:15
Yes, acknowledged.
| |
| 85 | |
| 86 return false; | |
| 87 } | |
| 88 | |
| 71 DEFINE_TRACE(DeviceSingleWindowEventController) { | 89 DEFINE_TRACE(DeviceSingleWindowEventController) { |
| 72 visitor->trace(m_document); | 90 visitor->trace(m_document); |
| 73 PlatformEventController::trace(visitor); | 91 PlatformEventController::trace(visitor); |
| 74 } | 92 } |
| 75 | 93 |
| 76 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |