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