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 protected: | 57 private: |
58 using Base = WindowProxyManagerBase; | 58 using Base = WindowProxyManagerBase; |
59 | 59 |
| 60 public: |
60 FrameType* frame() const { return static_cast<FrameType*>(Base::frame()); } | 61 FrameType* frame() const { return static_cast<FrameType*>(Base::frame()); } |
61 ProxyType* mainWorldProxy() const { | 62 ProxyType* mainWorldProxy() const { |
62 return static_cast<ProxyType*>(Base::mainWorldProxy()); | 63 return static_cast<ProxyType*>(Base::mainWorldProxy()); |
63 } | 64 } |
64 ProxyType* windowProxy(DOMWrapperWorld& world) { | 65 ProxyType* windowProxy(DOMWrapperWorld& world) { |
65 return static_cast<ProxyType*>(Base::windowProxy(world)); | 66 return static_cast<ProxyType*>(Base::windowProxy(world)); |
66 } | 67 } |
67 | 68 |
| 69 protected: |
68 explicit WindowProxyManagerImplHelper(Frame& frame) | 70 explicit WindowProxyManagerImplHelper(Frame& frame) |
69 : WindowProxyManagerBase(frame) {} | 71 : WindowProxyManagerBase(frame) {} |
70 }; | 72 }; |
71 | 73 |
72 class LocalWindowProxyManager | 74 class LocalWindowProxyManager |
73 : public WindowProxyManagerImplHelper<LocalFrame, LocalWindowProxy> { | 75 : public WindowProxyManagerImplHelper<LocalFrame, LocalWindowProxy> { |
74 public: | 76 public: |
75 static LocalWindowProxyManager* create(LocalFrame& frame) { | 77 static LocalWindowProxyManager* create(LocalFrame& frame) { |
76 return new LocalWindowProxyManager(frame); | 78 return new LocalWindowProxyManager(frame); |
77 } | 79 } |
(...skipping 11 matching lines...) Expand all Loading... |
89 }; | 91 }; |
90 | 92 |
91 class RemoteWindowProxyManager | 93 class RemoteWindowProxyManager |
92 : public WindowProxyManagerImplHelper<RemoteFrame, RemoteWindowProxy> { | 94 : public WindowProxyManagerImplHelper<RemoteFrame, RemoteWindowProxy> { |
93 public: | 95 public: |
94 static RemoteWindowProxyManager* create(RemoteFrame& frame) { | 96 static RemoteWindowProxyManager* create(RemoteFrame& frame) { |
95 return new RemoteWindowProxyManager(frame); | 97 return new RemoteWindowProxyManager(frame); |
96 } | 98 } |
97 | 99 |
98 private: | 100 private: |
99 // TODO(dcheng): Ideally, remove this friend declaration once WindowProxy | |
100 // initialization details are better encapsulated. | |
101 friend class RemoteFrame; | |
102 | |
103 explicit RemoteWindowProxyManager(RemoteFrame& frame) | 101 explicit RemoteWindowProxyManager(RemoteFrame& frame) |
104 : WindowProxyManagerImplHelper<RemoteFrame, RemoteWindowProxy>(frame) {} | 102 : WindowProxyManagerImplHelper<RemoteFrame, RemoteWindowProxy>(frame) {} |
105 }; | 103 }; |
106 | 104 |
107 } // namespace blink | 105 } // namespace blink |
108 | 106 |
109 #endif // WindowProxyManager_h | 107 #endif // WindowProxyManager_h |
OLD | NEW |