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

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

Issue 474883003: Move focus from the view manager to the window manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months 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 | Annotate | Revision Log
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_ROOT_NODE_MANAGER_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_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 "mojo/public/cpp/bindings/array.h" 12 #include "mojo/public/cpp/bindings/array.h"
13 #include "mojo/services/view_manager/ids.h" 13 #include "mojo/services/view_manager/ids.h"
14 #include "mojo/services/view_manager/node.h" 14 #include "mojo/services/view_manager/node.h"
15 #include "mojo/services/view_manager/node_delegate.h" 15 #include "mojo/services/view_manager/node_delegate.h"
16 #include "mojo/services/view_manager/root_view_manager.h" 16 #include "mojo/services/view_manager/root_view_manager.h"
17 #include "mojo/services/view_manager/view_manager_export.h" 17 #include "mojo/services/view_manager/view_manager_export.h"
18 #include "ui/aura/client/focus_change_observer.h"
19 18
20 namespace ui { 19 namespace ui {
21 class Event; 20 class Event;
22 } 21 }
23 22
24 namespace mojo { 23 namespace mojo {
25 24
26 class ApplicationConnection; 25 class ApplicationConnection;
27 26
28 namespace service { 27 namespace service {
29 28
30 class RootViewManagerDelegate; 29 class RootViewManagerDelegate;
31 class ViewManagerServiceImpl; 30 class ViewManagerServiceImpl;
32 31
33 // RootNodeManager is responsible for managing the set of 32 // RootNodeManager is responsible for managing the set of
34 // ViewManagerServiceImpls as well as providing the root of the node hierarchy. 33 // ViewManagerServiceImpls as well as providing the root of the node hierarchy.
35 class MOJO_VIEW_MANAGER_EXPORT RootNodeManager 34 class MOJO_VIEW_MANAGER_EXPORT RootNodeManager : public NodeDelegate {
36 : public NodeDelegate,
37 public aura::client::FocusChangeObserver {
38 public: 35 public:
39 // Create when a ViewManagerServiceImpl is about to make a change. Ensures 36 // Create when a ViewManagerServiceImpl is about to make a change. Ensures
40 // clients are notified of the correct change id. 37 // clients are notified of the correct change id.
41 class ScopedChange { 38 class ScopedChange {
42 public: 39 public:
43 ScopedChange(ViewManagerServiceImpl* connection, 40 ScopedChange(ViewManagerServiceImpl* connection,
44 RootNodeManager* root, 41 RootNodeManager* root,
45 bool is_delete_node); 42 bool is_delete_node);
46 ~ScopedChange(); 43 ~ScopedChange();
47 44
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 ConnectionSpecificId creator_id, 113 ConnectionSpecificId creator_id,
117 const std::string& url) const; 114 const std::string& url) const;
118 115
119 // Returns the ViewManagerServiceImpl that has |id| as a root. 116 // Returns the ViewManagerServiceImpl that has |id| as a root.
120 ViewManagerServiceImpl* GetConnectionWithRoot(const NodeId& id) { 117 ViewManagerServiceImpl* GetConnectionWithRoot(const NodeId& id) {
121 return const_cast<ViewManagerServiceImpl*>( 118 return const_cast<ViewManagerServiceImpl*>(
122 const_cast<const RootNodeManager*>(this)->GetConnectionWithRoot(id)); 119 const_cast<const RootNodeManager*>(this)->GetConnectionWithRoot(id));
123 } 120 }
124 const ViewManagerServiceImpl* GetConnectionWithRoot(const NodeId& id) const; 121 const ViewManagerServiceImpl* GetConnectionWithRoot(const NodeId& id) const;
125 122
126 void DispatchNodeInputEventToWindowManager(const Node* node, 123 void DispatchNodeInputEventToWindowManager(EventPtr event);
127 const ui::Event* event);
128 124
129 // These functions trivially delegate to all ViewManagerServiceImpls, which in 125 // These functions trivially delegate to all ViewManagerServiceImpls, which in
130 // term notify their clients. 126 // term notify their clients.
131 void ProcessNodeDestroyed(Node* node); 127 void ProcessNodeDestroyed(Node* node);
132 void ProcessNodeBoundsChanged(const Node* node, 128 void ProcessNodeBoundsChanged(const Node* node,
133 const gfx::Rect& old_bounds, 129 const gfx::Rect& old_bounds,
134 const gfx::Rect& new_bounds); 130 const gfx::Rect& new_bounds);
135 void ProcessNodeHierarchyChanged(const Node* node, 131 void ProcessNodeHierarchyChanged(const Node* node,
136 const Node* new_parent, 132 const Node* new_parent,
137 const Node* old_parent); 133 const Node* old_parent);
138 void ProcessNodeReorder(const Node* node, 134 void ProcessNodeReorder(const Node* node,
139 const Node* relative_node, 135 const Node* relative_node,
140 const OrderDirection direction); 136 const OrderDirection direction);
141 void ProcessNodeDeleted(const NodeId& node); 137 void ProcessNodeDeleted(const NodeId& node);
142 138
143 private: 139 private:
144 // Used to setup any static state needed by RootNodeManager. 140 // Used to setup any static state needed by RootNodeManager.
145 struct Context { 141 struct Context {
146 Context(); 142 Context();
147 ~Context(); 143 ~Context();
148 }; 144 };
149 145
150 typedef std::map<ConnectionSpecificId, ViewManagerServiceImpl*> ConnectionMap; 146 typedef std::map<ConnectionSpecificId, ViewManagerServiceImpl*> ConnectionMap;
151 147
152 // Overridden from aura::client::FocusChangeObserver:
153 virtual void OnWindowFocused(aura::Window* gained_focus,
154 aura::Window* lost_focus) OVERRIDE;
155
156 // Invoked when a connection is about to make a change. Subsequently followed 148 // Invoked when a connection is about to make a change. Subsequently followed
157 // by FinishChange() once the change is done. 149 // by FinishChange() once the change is done.
158 // 150 //
159 // Changes should never nest, meaning each PrepareForChange() must be 151 // Changes should never nest, meaning each PrepareForChange() must be
160 // balanced with a call to FinishChange() with no PrepareForChange() 152 // balanced with a call to FinishChange() with no PrepareForChange()
161 // in between. 153 // in between.
162 void PrepareForChange(ScopedChange* change); 154 void PrepareForChange(ScopedChange* change);
163 155
164 // Balances a call to PrepareForChange(). 156 // Balances a call to PrepareForChange().
165 void FinishChange(); 157 void FinishChange();
(...skipping 11 matching lines...) Expand all
177 InterfaceRequest<ServiceProvider> service_provider); 169 InterfaceRequest<ServiceProvider> service_provider);
178 170
179 // Overridden from NodeDelegate: 171 // Overridden from NodeDelegate:
180 virtual void OnNodeDestroyed(const Node* node) OVERRIDE; 172 virtual void OnNodeDestroyed(const Node* node) OVERRIDE;
181 virtual void OnNodeHierarchyChanged(const Node* node, 173 virtual void OnNodeHierarchyChanged(const Node* node,
182 const Node* new_parent, 174 const Node* new_parent,
183 const Node* old_parent) OVERRIDE; 175 const Node* old_parent) OVERRIDE;
184 virtual void OnNodeBoundsChanged(const Node* node, 176 virtual void OnNodeBoundsChanged(const Node* node,
185 const gfx::Rect& old_bounds, 177 const gfx::Rect& old_bounds,
186 const gfx::Rect& new_bounds) OVERRIDE; 178 const gfx::Rect& new_bounds) OVERRIDE;
187 virtual void OnNodeInputEvent(const Node* node,
188 const ui::Event* event) OVERRIDE;
189 179
190 Context context_; 180 Context context_;
191 181
192 ApplicationConnection* app_connection_; 182 ApplicationConnection* app_connection_;
193 183
194 // ID to use for next ViewManagerServiceImpl. 184 // ID to use for next ViewManagerServiceImpl.
195 ConnectionSpecificId next_connection_id_; 185 ConnectionSpecificId next_connection_id_;
196 186
197 // Set of ViewManagerServiceImpls. 187 // Set of ViewManagerServiceImpls.
198 ConnectionMap connection_map_; 188 ConnectionMap connection_map_;
(...skipping 11 matching lines...) Expand all
210 // (it's created on the stack by ViewManagerServiceImpl). 200 // (it's created on the stack by ViewManagerServiceImpl).
211 ScopedChange* current_change_; 201 ScopedChange* current_change_;
212 202
213 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); 203 DISALLOW_COPY_AND_ASSIGN(RootNodeManager);
214 }; 204 };
215 205
216 } // namespace service 206 } // namespace service
217 } // namespace mojo 207 } // namespace mojo
218 208
219 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ 209 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_
OLDNEW
« no previous file with comments | « mojo/services/view_manager/node_delegate.h ('k') | mojo/services/view_manager/root_node_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698