Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: mojo/services/view_manager/connection_manager.h

Issue 685013002: Refactors event dispatching of NativeViewport into its own interface (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: cleanup Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_VIEW_MANAGER_CONNECTION_MANAGER_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_CONNECTION_MANAGER_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_CONNECTION_MANAGER_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_CONNECTION_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 10 matching lines...) Expand all
21 #include "mojo/services/view_manager/view_manager_export.h" 21 #include "mojo/services/view_manager/view_manager_export.h"
22 22
23 namespace mojo { 23 namespace mojo {
24 24
25 class ApplicationConnection; 25 class ApplicationConnection;
26 26
27 namespace service { 27 namespace service {
28 28
29 class ConnectionManagerDelegate; 29 class ConnectionManagerDelegate;
30 class ViewManagerServiceImpl; 30 class ViewManagerServiceImpl;
31 class WindowManagerInternalClientImpl;
31 32
32 // ConnectionManager manages the set of connections to the ViewManager (all the 33 // ConnectionManager manages the set of connections to the ViewManager (all the
33 // ViewManagerServiceImpls) as well as providing the root of the hierarchy. 34 // ViewManagerServiceImpls) as well as providing the root of the hierarchy.
34 class MOJO_VIEW_MANAGER_EXPORT ConnectionManager 35 class MOJO_VIEW_MANAGER_EXPORT ConnectionManager
35 : public ServerViewDelegate, 36 : public ServerViewDelegate,
36 public WindowManagerInternalClient, 37 public WindowManagerInternalClient,
37 public InterfaceFactory<ViewManagerService>, 38 public InterfaceFactory<ViewManagerService>,
39 public InterfaceFactory<WindowManagerInternalClient>,
38 public ErrorHandler { 40 public ErrorHandler {
39 public: 41 public:
40 // Create when a ViewManagerServiceImpl is about to make a change. Ensures 42 // Create when a ViewManagerServiceImpl is about to make a change. Ensures
41 // clients are notified correctly. 43 // clients are notified correctly.
42 class ScopedChange { 44 class ScopedChange {
43 public: 45 public:
44 ScopedChange(ViewManagerServiceImpl* connection, 46 ScopedChange(ViewManagerServiceImpl* connection,
45 ConnectionManager* connection_manager, 47 ConnectionManager* connection_manager,
46 bool is_delete_view); 48 bool is_delete_view);
47 ~ScopedChange(); 49 ~ScopedChange();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Returns true if OnConnectionMessagedClient() was invoked for id. 110 // Returns true if OnConnectionMessagedClient() was invoked for id.
109 bool DidConnectionMessageClient(ConnectionSpecificId id) const; 111 bool DidConnectionMessageClient(ConnectionSpecificId id) const;
110 112
111 // Returns the ViewManagerServiceImpl that has |id| as a root. 113 // Returns the ViewManagerServiceImpl that has |id| as a root.
112 ViewManagerServiceImpl* GetConnectionWithRoot(const ViewId& id) { 114 ViewManagerServiceImpl* GetConnectionWithRoot(const ViewId& id) {
113 return const_cast<ViewManagerServiceImpl*>( 115 return const_cast<ViewManagerServiceImpl*>(
114 const_cast<const ConnectionManager*>(this)->GetConnectionWithRoot(id)); 116 const_cast<const ConnectionManager*>(this)->GetConnectionWithRoot(id));
115 } 117 }
116 const ViewManagerServiceImpl* GetConnectionWithRoot(const ViewId& id) const; 118 const ViewManagerServiceImpl* GetConnectionWithRoot(const ViewId& id) const;
117 119
118 void DispatchViewInputEventToDelegate(EventPtr event);
119
120 // These functions trivially delegate to all ViewManagerServiceImpls, which in 120 // These functions trivially delegate to all ViewManagerServiceImpls, which in
121 // term notify their clients. 121 // term notify their clients.
122 void ProcessViewDestroyed(ServerView* view); 122 void ProcessViewDestroyed(ServerView* view);
123 void ProcessViewBoundsChanged(const ServerView* view, 123 void ProcessViewBoundsChanged(const ServerView* view,
124 const gfx::Rect& old_bounds, 124 const gfx::Rect& old_bounds,
125 const gfx::Rect& new_bounds); 125 const gfx::Rect& new_bounds);
126 void ProcessWillChangeViewHierarchy(const ServerView* view, 126 void ProcessWillChangeViewHierarchy(const ServerView* view,
127 const ServerView* new_parent, 127 const ServerView* new_parent,
128 const ServerView* old_parent); 128 const ServerView* old_parent);
129 void ProcessViewHierarchyChanged(const ServerView* view, 129 void ProcessViewHierarchyChanged(const ServerView* view,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const std::vector<uint8_t>* new_data) override; 177 const std::vector<uint8_t>* new_data) override;
178 178
179 // WindowManagerInternalClient: 179 // WindowManagerInternalClient:
180 virtual void DispatchInputEventToView(Id transport_view_id, 180 virtual void DispatchInputEventToView(Id transport_view_id,
181 EventPtr event) override; 181 EventPtr event) override;
182 182
183 // InterfaceFactory<ViewManagerService>: 183 // InterfaceFactory<ViewManagerService>:
184 virtual void Create(ApplicationConnection* connection, 184 virtual void Create(ApplicationConnection* connection,
185 InterfaceRequest<ViewManagerService> request) override; 185 InterfaceRequest<ViewManagerService> request) override;
186 186
187 // InterfaceFactory<WindowManagerInternalClient>:
188 virtual void Create(
189 ApplicationConnection* connection,
190 InterfaceRequest<WindowManagerInternalClient> request) override;
191
187 // ErrorHandler: 192 // ErrorHandler:
188 void OnConnectionError() override; 193 void OnConnectionError() override;
189 194
190 ApplicationConnection* app_connection_; 195 ApplicationConnection* app_connection_;
191 196
192 ConnectionManagerDelegate* delegate_; 197 ConnectionManagerDelegate* delegate_;
193 198
194 // The ViewManager implementation provided to the initial connection (the 199 // The ViewManager implementation provided to the initial connection (the
195 // WindowManager). 200 // WindowManager).
196 // NOTE: |window_manager_vm_service_| is also in |connection_map_|. 201 // NOTE: |window_manager_vm_service_| is also in |connection_map_|.
197 ViewManagerServiceImpl* window_manager_vm_service_; 202 ViewManagerServiceImpl* window_manager_vm_service_;
198 203
199 WindowManagerInternalServicePtr window_manager_;
200
201 // ID to use for next ViewManagerServiceImpl. 204 // ID to use for next ViewManagerServiceImpl.
202 ConnectionSpecificId next_connection_id_; 205 ConnectionSpecificId next_connection_id_;
203 206
204 // Set of ViewManagerServiceImpls. 207 // Set of ViewManagerServiceImpls.
205 ConnectionMap connection_map_; 208 ConnectionMap connection_map_;
206 209
207 DisplayManager display_manager_; 210 DisplayManager display_manager_;
208 211
209 scoped_ptr<ServerView> root_; 212 scoped_ptr<ServerView> root_;
210 213
214 scoped_ptr<WindowManagerInternalClientImpl> wm_internal_client_impl_;
215
211 // If non-null we're processing a change. The ScopedChange is not owned by us 216 // If non-null we're processing a change. The ScopedChange is not owned by us
212 // (it's created on the stack by ViewManagerServiceImpl). 217 // (it's created on the stack by ViewManagerServiceImpl).
213 ScopedChange* current_change_; 218 ScopedChange* current_change_;
214 219
215 bool in_destructor_; 220 bool in_destructor_;
216 221
217 DISALLOW_COPY_AND_ASSIGN(ConnectionManager); 222 DISALLOW_COPY_AND_ASSIGN(ConnectionManager);
218 }; 223 };
219 224
220 } // namespace service 225 } // namespace service
221 } // namespace mojo 226 } // namespace mojo
222 227
223 #endif // MOJO_SERVICES_VIEW_MANAGER_CONNECTION_MANAGER_H_ 228 #endif // MOJO_SERVICES_VIEW_MANAGER_CONNECTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698