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 #ifndef MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ | 5 #ifndef MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ |
6 #define MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ | 6 #define MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 public ViewManagerDelegate, | 48 public ViewManagerDelegate, |
49 public ViewObserver, | 49 public ViewObserver, |
50 public ui::EventHandler, | 50 public ui::EventHandler, |
51 public FocusControllerObserver, | 51 public FocusControllerObserver, |
52 public InterfaceFactory<WindowManagerInternal> { | 52 public InterfaceFactory<WindowManagerInternal> { |
53 public: | 53 public: |
54 WindowManagerApp(ViewManagerDelegate* view_manager_delegate, | 54 WindowManagerApp(ViewManagerDelegate* view_manager_delegate, |
55 WindowManagerDelegate* window_manager_delegate); | 55 WindowManagerDelegate* window_manager_delegate); |
56 ~WindowManagerApp() override; | 56 ~WindowManagerApp() override; |
57 | 57 |
58 static View* GetViewForViewTarget(ViewTarget* view); | |
59 ViewTarget* GetViewTargetForViewId(Id view); | |
60 | |
61 mojo::ViewEventDispatcher* event_dispatcher() { | 58 mojo::ViewEventDispatcher* event_dispatcher() { |
62 return view_event_dispatcher_.get(); | 59 return view_event_dispatcher_.get(); |
63 } | 60 } |
64 | 61 |
65 // Register/deregister new connections to the window manager service. | 62 // Register/deregister new connections to the window manager service. |
66 void AddConnection(WindowManagerImpl* connection); | 63 void AddConnection(WindowManagerImpl* connection); |
67 void RemoveConnection(WindowManagerImpl* connection); | 64 void RemoveConnection(WindowManagerImpl* connection); |
68 | 65 |
69 // These are canonical implementations of the window manager API methods. | 66 // These are canonical implementations of the window manager API methods. |
70 void SetCapture(Id view); | 67 void SetCapture(Id view); |
(...skipping 15 matching lines...) Expand all Loading... |
86 void Embed(const String& url, | 83 void Embed(const String& url, |
87 InterfaceRequest<ServiceProvider> service_provider); | 84 InterfaceRequest<ServiceProvider> service_provider); |
88 | 85 |
89 // Overridden from ApplicationDelegate: | 86 // Overridden from ApplicationDelegate: |
90 void Initialize(ApplicationImpl* impl) override; | 87 void Initialize(ApplicationImpl* impl) override; |
91 bool ConfigureIncomingConnection(ApplicationConnection* connection) override; | 88 bool ConfigureIncomingConnection(ApplicationConnection* connection) override; |
92 | 89 |
93 private: | 90 private: |
94 // TODO(sky): rename this. Connections is ambiguous. | 91 // TODO(sky): rename this. Connections is ambiguous. |
95 typedef std::set<WindowManagerImpl*> Connections; | 92 typedef std::set<WindowManagerImpl*> Connections; |
96 typedef std::map<Id, ViewTarget*> ViewIdToViewTargetMap; | 93 typedef std::set<Id> RegisteredViewIdSet; |
97 | 94 |
98 struct PendingEmbed; | 95 struct PendingEmbed; |
99 class WindowManagerInternalImpl; | 96 class WindowManagerInternalImpl; |
100 | 97 |
101 // Creates an ViewTarget for every view in the hierarchy beneath |view|, | 98 // Creates an ViewTarget for every view in the hierarchy beneath |view|, |
102 // and adds to the registry so that it can be retrieved later via | 99 // and adds to the registry so that it can be retrieved later via |
103 // GetViewTargetForViewId(). | 100 // GetViewTargetForViewId(). |
104 // TODO(beng): perhaps View should have a property bag. | 101 // TODO(beng): perhaps View should have a property bag. |
105 void RegisterSubtree(View* view, ViewTarget* parent); | 102 void RegisterSubtree(View* view); |
106 | 103 |
107 // Recursively invokes Unregister() for |view| and all its descendants. | 104 // Recursively invokes Unregister() for |view| and all its descendants. |
108 void UnregisterSubtree(View* view); | 105 void UnregisterSubtree(View* view); |
109 | 106 |
110 // Deletes the ViewTarget associated with the hierarchy beneath |id|, | 107 // Deletes the ViewTarget associated with the hierarchy beneath |id|, |
111 // and removes from the registry. | 108 // and removes from the registry. |
112 void Unregister(View* view); | 109 void Unregister(View* view); |
113 | 110 |
114 // Overridden from ViewManagerDelegate: | 111 // Overridden from ViewManagerDelegate: |
115 void OnEmbed(ViewManager* view_manager, | 112 void OnEmbed(ViewManager* view_manager, |
116 View* root, | 113 View* root, |
117 ServiceProviderImpl* exported_services, | 114 ServiceProviderImpl* exported_services, |
118 scoped_ptr<ServiceProvider> imported_services) override; | 115 scoped_ptr<ServiceProvider> imported_services) override; |
119 void OnViewManagerDisconnected(ViewManager* view_manager) override; | 116 void OnViewManagerDisconnected(ViewManager* view_manager) override; |
120 | 117 |
121 // Overridden from ViewObserver: | 118 // Overridden from ViewObserver: |
122 void OnTreeChanged(const ViewObserver::TreeChangeParams& params) override; | 119 void OnTreeChanged(const ViewObserver::TreeChangeParams& params) override; |
123 void OnViewDestroying(View* view) override; | 120 void OnViewDestroying(View* view) override; |
124 void OnViewBoundsChanged(View* view, | |
125 const Rect& old_bounds, | |
126 const Rect& new_bounds) override; | |
127 | 121 |
128 // Overridden from ui::EventHandler: | 122 // Overridden from ui::EventHandler: |
129 void OnEvent(ui::Event* event) override; | 123 void OnEvent(ui::Event* event) override; |
130 | 124 |
131 // Overridden from mojo::FocusControllerObserver: | 125 // Overridden from mojo::FocusControllerObserver: |
132 void OnViewFocused(View* gained_focus, View* lost_focus) override; | 126 void OnViewFocused(View* gained_focus, View* lost_focus) override; |
133 void OnViewActivated(View* gained_active, View* lost_active) override; | 127 void OnViewActivated(View* gained_active, View* lost_active) override; |
134 | 128 |
135 // Creates the connection to the ViewManager. | 129 // Creates the connection to the ViewManager. |
136 void LaunchViewManager(ApplicationImpl* app); | 130 void LaunchViewManager(ApplicationImpl* app); |
(...skipping 14 matching lines...) Expand all Loading... |
151 ViewManagerDelegate* wrapped_view_manager_delegate_; | 145 ViewManagerDelegate* wrapped_view_manager_delegate_; |
152 WindowManagerDelegate* window_manager_delegate_; | 146 WindowManagerDelegate* window_manager_delegate_; |
153 | 147 |
154 ViewManager* view_manager_; | 148 ViewManager* view_manager_; |
155 scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_; | 149 scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_; |
156 View* root_; | 150 View* root_; |
157 | 151 |
158 scoped_ptr<mojo::FocusController> focus_controller_; | 152 scoped_ptr<mojo::FocusController> focus_controller_; |
159 | 153 |
160 Connections connections_; | 154 Connections connections_; |
161 ViewIdToViewTargetMap view_id_to_view_target_map_; | 155 RegisteredViewIdSet registered_view_id_set_; |
162 | 156 |
163 WindowManagerInternalClientPtr window_manager_client_; | 157 WindowManagerInternalClientPtr window_manager_client_; |
164 | 158 |
165 ScopedVector<PendingEmbed> pending_embeds_; | 159 ScopedVector<PendingEmbed> pending_embeds_; |
166 | 160 |
167 scoped_ptr<ViewManagerClient> view_manager_client_; | 161 scoped_ptr<ViewManagerClient> view_manager_client_; |
168 | 162 |
169 scoped_ptr<ViewEventDispatcher> view_event_dispatcher_; | 163 scoped_ptr<ViewEventDispatcher> view_event_dispatcher_; |
170 | 164 |
171 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp); | 165 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp); |
172 }; | 166 }; |
173 | 167 |
174 } // namespace mojo | 168 } // namespace mojo |
175 | 169 |
176 #endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ | 170 #endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ |
OLD | NEW |