| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef WindowProxyManager_h | 5 #ifndef WindowProxyManager_h |
| 6 #define WindowProxyManager_h | 6 #define WindowProxyManager_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/LocalWindowProxy.h" | 8 #include "bindings/core/v8/LocalWindowProxy.h" |
| 9 #include "bindings/core/v8/RemoteWindowProxy.h" | 9 #include "bindings/core/v8/RemoteWindowProxy.h" |
| 10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 v8::Isolate* const m_isolate; | 49 v8::Isolate* const m_isolate; |
| 50 const Member<Frame> m_frame; | 50 const Member<Frame> m_frame; |
| 51 const Member<WindowProxy> m_windowProxy; | 51 const Member<WindowProxy> m_windowProxy; |
| 52 IsolatedWorldMap m_isolatedWorlds; | 52 IsolatedWorldMap m_isolatedWorlds; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 template <typename FrameType, typename ProxyType> | 55 template <typename FrameType, typename ProxyType> |
| 56 class WindowProxyManagerImplHelper : public WindowProxyManagerBase { | 56 class WindowProxyManagerImplHelper : public WindowProxyManagerBase { |
| 57 private: | 57 protected: |
| 58 using Base = WindowProxyManagerBase; | 58 using Base = WindowProxyManagerBase; |
| 59 | 59 |
| 60 public: | |
| 61 FrameType* frame() const { return static_cast<FrameType*>(Base::frame()); } | 60 FrameType* frame() const { return static_cast<FrameType*>(Base::frame()); } |
| 62 ProxyType* mainWorldProxy() const { | 61 ProxyType* mainWorldProxy() const { |
| 63 return static_cast<ProxyType*>(Base::mainWorldProxy()); | 62 return static_cast<ProxyType*>(Base::mainWorldProxy()); |
| 64 } | 63 } |
| 65 ProxyType* windowProxy(DOMWrapperWorld& world) { | 64 ProxyType* windowProxy(DOMWrapperWorld& world) { |
| 66 return static_cast<ProxyType*>(Base::windowProxy(world)); | 65 return static_cast<ProxyType*>(Base::windowProxy(world)); |
| 67 } | 66 } |
| 68 | 67 |
| 69 protected: | |
| 70 explicit WindowProxyManagerImplHelper(Frame& frame) | 68 explicit WindowProxyManagerImplHelper(Frame& frame) |
| 71 : WindowProxyManagerBase(frame) {} | 69 : WindowProxyManagerBase(frame) {} |
| 72 }; | 70 }; |
| 73 | 71 |
| 74 class LocalWindowProxyManager | 72 class LocalWindowProxyManager |
| 75 : public WindowProxyManagerImplHelper<LocalFrame, LocalWindowProxy> { | 73 : public WindowProxyManagerImplHelper<LocalFrame, LocalWindowProxy> { |
| 76 public: | 74 public: |
| 77 static LocalWindowProxyManager* create(LocalFrame& frame) { | 75 static LocalWindowProxyManager* create(LocalFrame& frame) { |
| 78 return new LocalWindowProxyManager(frame); | 76 return new LocalWindowProxyManager(frame); |
| 79 } | 77 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 91 }; | 89 }; |
| 92 | 90 |
| 93 class RemoteWindowProxyManager | 91 class RemoteWindowProxyManager |
| 94 : public WindowProxyManagerImplHelper<RemoteFrame, RemoteWindowProxy> { | 92 : public WindowProxyManagerImplHelper<RemoteFrame, RemoteWindowProxy> { |
| 95 public: | 93 public: |
| 96 static RemoteWindowProxyManager* create(RemoteFrame& frame) { | 94 static RemoteWindowProxyManager* create(RemoteFrame& frame) { |
| 97 return new RemoteWindowProxyManager(frame); | 95 return new RemoteWindowProxyManager(frame); |
| 98 } | 96 } |
| 99 | 97 |
| 100 private: | 98 private: |
| 99 // TODO(dcheng): Ideally, remove this friend declaration once WindowProxy |
| 100 // initialization details are better encapsulated. |
| 101 friend class RemoteFrame; |
| 102 |
| 101 explicit RemoteWindowProxyManager(RemoteFrame& frame) | 103 explicit RemoteWindowProxyManager(RemoteFrame& frame) |
| 102 : WindowProxyManagerImplHelper<RemoteFrame, RemoteWindowProxy>(frame) {} | 104 : WindowProxyManagerImplHelper<RemoteFrame, RemoteWindowProxy>(frame) {} |
| 103 }; | 105 }; |
| 104 | 106 |
| 105 } // namespace blink | 107 } // namespace blink |
| 106 | 108 |
| 107 #endif // WindowProxyManager_h | 109 #endif // WindowProxyManager_h |
| OLD | NEW |