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 COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_ |
6 #define COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_ | 6 #define COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "components/view_manager/animation_runner.h" | 14 #include "components/view_manager/animation_runner.h" |
15 #include "components/view_manager/event_dispatcher.h" | 15 #include "components/view_manager/event_dispatcher.h" |
16 #include "components/view_manager/focus_controller_delegate.h" | 16 #include "components/view_manager/focus_controller_delegate.h" |
17 #include "components/view_manager/ids.h" | 17 #include "components/view_manager/ids.h" |
18 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" | 18 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" |
19 #include "components/view_manager/public/interfaces/view_tree.mojom.h" | 19 #include "components/view_manager/public/interfaces/view_tree.mojom.h" |
20 #include "components/view_manager/server_view_delegate.h" | 20 #include "components/view_manager/server_view_delegate.h" |
21 #include "components/view_manager/server_view_observer.h" | 21 #include "components/view_manager/server_view_observer.h" |
| 22 #include "components/view_manager/surfaces/surfaces_state.h" |
22 #include "components/view_manager/view_manager_root_impl.h" | 23 #include "components/view_manager/view_manager_root_impl.h" |
23 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" | 24 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" |
24 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 25 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
25 | 26 |
26 namespace view_manager { | 27 namespace view_manager { |
27 | 28 |
28 class ClientConnection; | 29 class ClientConnection; |
29 class ConnectionManagerDelegate; | 30 class ConnectionManagerDelegate; |
30 class FocusController; | 31 class FocusController; |
31 class ServerView; | 32 class ServerView; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 ConnectionManager* connection_manager_; | 65 ConnectionManager* connection_manager_; |
65 const mojo::ConnectionSpecificId connection_id_; | 66 const mojo::ConnectionSpecificId connection_id_; |
66 const bool is_delete_view_; | 67 const bool is_delete_view_; |
67 | 68 |
68 // See description of MarkConnectionAsMessaged/DidMessageConnection. | 69 // See description of MarkConnectionAsMessaged/DidMessageConnection. |
69 std::set<mojo::ConnectionSpecificId> message_ids_; | 70 std::set<mojo::ConnectionSpecificId> message_ids_; |
70 | 71 |
71 DISALLOW_COPY_AND_ASSIGN(ScopedChange); | 72 DISALLOW_COPY_AND_ASSIGN(ScopedChange); |
72 }; | 73 }; |
73 | 74 |
74 explicit ConnectionManager(ConnectionManagerDelegate* delegate); | 75 ConnectionManager( |
| 76 ConnectionManagerDelegate* delegate, |
| 77 const scoped_refptr<surfaces::SurfacesState>& surfaces_state); |
75 ~ConnectionManager() override; | 78 ~ConnectionManager() override; |
76 | 79 |
77 // Adds a ViewManagerRoot. | 80 // Adds a ViewManagerRoot. |
78 void AddRoot(ViewManagerRootConnection* root_connection); | 81 void AddRoot(ViewManagerRootConnection* root_connection); |
79 | 82 |
80 // Creates a new ServerView. The return value is owned by the caller, but must | 83 // Creates a new ServerView. The return value is owned by the caller, but must |
81 // be destroyed before ConnectionManager. | 84 // be destroyed before ConnectionManager. |
82 ServerView* CreateServerView(const ViewId& id); | 85 ServerView* CreateServerView(const ViewId& id); |
83 | 86 |
84 // Returns the id for the next ViewTreeImpl. | 87 // Returns the id for the next ViewTreeImpl. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // Callback from animation timer. | 219 // Callback from animation timer. |
217 // TODO(sky): make this real (move to a different class). | 220 // TODO(sky): make this real (move to a different class). |
218 void DoAnimation(); | 221 void DoAnimation(); |
219 | 222 |
220 // Adds |connection| to internal maps. | 223 // Adds |connection| to internal maps. |
221 void AddConnection(ClientConnection* connection); | 224 void AddConnection(ClientConnection* connection); |
222 | 225 |
223 ViewManagerRootImpl* GetViewManagerRootByView(const ServerView* view) const; | 226 ViewManagerRootImpl* GetViewManagerRootByView(const ServerView* view) const; |
224 | 227 |
225 // Overridden from ServerViewDelegate: | 228 // Overridden from ServerViewDelegate: |
| 229 surfaces::SurfacesState* GetSurfacesState() override; |
226 void PrepareToDestroyView(ServerView* view) override; | 230 void PrepareToDestroyView(ServerView* view) override; |
227 void PrepareToChangeViewHierarchy(ServerView* view, | 231 void PrepareToChangeViewHierarchy(ServerView* view, |
228 ServerView* new_parent, | 232 ServerView* new_parent, |
229 ServerView* old_parent) override; | 233 ServerView* old_parent) override; |
230 void PrepareToChangeViewVisibility(ServerView* view) override; | 234 void PrepareToChangeViewVisibility(ServerView* view) override; |
231 void OnScheduleViewPaint(const ServerView* view) override; | 235 void OnScheduleViewPaint(const ServerView* view) override; |
232 const ServerView* GetRootView(const ServerView* view) const override; | 236 const ServerView* GetRootView(const ServerView* view) const override; |
233 | 237 |
234 // Overridden from ServerViewObserver: | 238 // Overridden from ServerViewObserver: |
235 void OnViewDestroyed(ServerView* view) override; | 239 void OnViewDestroyed(ServerView* view) override; |
(...skipping 18 matching lines...) Expand all Loading... |
254 const ui::TextInputState& state) override; | 258 const ui::TextInputState& state) override; |
255 | 259 |
256 void CloneAndAnimate(mojo::Id transport_view_id); | 260 void CloneAndAnimate(mojo::Id transport_view_id); |
257 | 261 |
258 // FocusControllerDelegate: | 262 // FocusControllerDelegate: |
259 void OnFocusChanged(ServerView* old_focused_view, | 263 void OnFocusChanged(ServerView* old_focused_view, |
260 ServerView* new_focused_view) override; | 264 ServerView* new_focused_view) override; |
261 | 265 |
262 ConnectionManagerDelegate* delegate_; | 266 ConnectionManagerDelegate* delegate_; |
263 | 267 |
| 268 // State for rendering into a Surface. |
| 269 scoped_refptr<surfaces::SurfacesState> surfaces_state_; |
| 270 |
264 // ID to use for next ViewTreeImpl. | 271 // ID to use for next ViewTreeImpl. |
265 mojo::ConnectionSpecificId next_connection_id_; | 272 mojo::ConnectionSpecificId next_connection_id_; |
266 | 273 |
267 // ID to use for next ViewManagerRootImpl. | 274 // ID to use for next ViewManagerRootImpl. |
268 uint16_t next_root_id_; | 275 uint16_t next_root_id_; |
269 | 276 |
270 EventDispatcher event_dispatcher_; | 277 EventDispatcher event_dispatcher_; |
271 | 278 |
272 // Set of ViewTreeImpls. | 279 // Set of ViewTreeImpls. |
273 ConnectionMap connection_map_; | 280 ConnectionMap connection_map_; |
(...skipping 13 matching lines...) Expand all Loading... |
287 AnimationRunner animation_runner_; | 294 AnimationRunner animation_runner_; |
288 | 295 |
289 scoped_ptr<FocusController> focus_controller_; | 296 scoped_ptr<FocusController> focus_controller_; |
290 | 297 |
291 DISALLOW_COPY_AND_ASSIGN(ConnectionManager); | 298 DISALLOW_COPY_AND_ASSIGN(ConnectionManager); |
292 }; | 299 }; |
293 | 300 |
294 } // namespace view_manager | 301 } // namespace view_manager |
295 | 302 |
296 #endif // COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_ | 303 #endif // COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_ |
OLD | NEW |