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

Side by Side Diff: mojo/services/window_manager/window_manager_app.h

Issue 599213002: First cut at supporting activation in the window manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 2 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
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_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 14 matching lines...) Expand all
25 25
26 namespace aura { 26 namespace aura {
27 namespace client { 27 namespace client {
28 class ActivationClient; 28 class ActivationClient;
29 class FocusClient; 29 class FocusClient;
30 } 30 }
31 class Window; 31 class Window;
32 } 32 }
33 33
34 namespace wm { 34 namespace wm {
35 class FocusRules;
35 class ScopedCaptureClient; 36 class ScopedCaptureClient;
36 } 37 }
37 38
38 namespace mojo { 39 namespace mojo {
39 40
40 class AuraInit; 41 class AuraInit;
41 class DummyDelegate; 42 class DummyDelegate;
42 class WindowManagerServiceImpl; 43 class WindowManagerServiceImpl;
43 class WindowTreeHostMojo; 44 class WindowTreeHostMojo;
44 45
(...skipping 16 matching lines...) Expand all
61 public WindowTreeHostMojoDelegate, 62 public WindowTreeHostMojoDelegate,
62 public ui::EventHandler, 63 public ui::EventHandler,
63 public aura::client::FocusChangeObserver, 64 public aura::client::FocusChangeObserver,
64 public aura::client::ActivationChangeObserver { 65 public aura::client::ActivationChangeObserver {
65 public: 66 public:
66 WindowManagerApp(ViewManagerDelegate* view_manager_delegate, 67 WindowManagerApp(ViewManagerDelegate* view_manager_delegate,
67 WindowManagerDelegate* window_manager_delegate); 68 WindowManagerDelegate* window_manager_delegate);
68 virtual ~WindowManagerApp(); 69 virtual ~WindowManagerApp();
69 70
70 static View* GetViewForWindow(aura::Window* window); 71 static View* GetViewForWindow(aura::Window* window);
72 aura::Window* GetWindowForViewId(Id view) const;
sky 2014/09/26 23:01:41 nit: either non-const, or return const aura::Windo
71 73
72 // Register/deregister new connections to the window manager service. 74 // Register/deregister new connections to the window manager service.
73 void AddConnection(WindowManagerServiceImpl* connection); 75 void AddConnection(WindowManagerServiceImpl* connection);
74 void RemoveConnection(WindowManagerServiceImpl* connection); 76 void RemoveConnection(WindowManagerServiceImpl* connection);
75 77
76 // These are canonical implementations of the window manager API methods. 78 // These are canonical implementations of the window manager API methods.
77 void SetCapture(Id view); 79 void SetCapture(Id view);
78 void FocusWindow(Id view); 80 void FocusWindow(Id view);
79 void ActivateWindow(Id view); 81 void ActivateWindow(Id view);
80 82
81 bool IsReady() const; 83 bool IsReady() const;
82 84
83 // A client of this object will use this accessor to gain access to the 85 // A client of this object will use this accessor to gain access to the
84 // aura::Window hierarchy and attach event handlers. 86 // aura::Window hierarchy and attach event handlers.
85 aura::WindowTreeHost* host() { return window_tree_host_.get(); } 87 aura::WindowTreeHost* host() { return window_tree_host_.get(); }
86 88
89 void InitFocus(wm::FocusRules* rules);
90
87 // Overridden from ApplicationDelegate: 91 // Overridden from ApplicationDelegate:
88 virtual void Initialize(ApplicationImpl* impl) MOJO_OVERRIDE; 92 virtual void Initialize(ApplicationImpl* impl) MOJO_OVERRIDE;
89 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) 93 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
90 MOJO_OVERRIDE; 94 MOJO_OVERRIDE;
91 95
92 private: 96 private:
93 typedef std::set<WindowManagerServiceImpl*> Connections; 97 typedef std::set<WindowManagerServiceImpl*> Connections;
94 typedef std::map<Id, aura::Window*> ViewIdToWindowMap; 98 typedef std::map<Id, aura::Window*> ViewIdToWindowMap;
95 99
96 // Overridden from ViewManagerDelegate: 100 // Overridden from ViewManagerDelegate:
(...skipping 26 matching lines...) Expand all
123 virtual void OnEvent(ui::Event* event) MOJO_OVERRIDE; 127 virtual void OnEvent(ui::Event* event) MOJO_OVERRIDE;
124 128
125 // Overridden from aura::client::FocusChangeObserver: 129 // Overridden from aura::client::FocusChangeObserver:
126 virtual void OnWindowFocused(aura::Window* gained_focus, 130 virtual void OnWindowFocused(aura::Window* gained_focus,
127 aura::Window* lost_focus) MOJO_OVERRIDE; 131 aura::Window* lost_focus) MOJO_OVERRIDE;
128 132
129 // Overridden from aura::client::ActivationChangeObserver: 133 // Overridden from aura::client::ActivationChangeObserver:
130 virtual void OnWindowActivated(aura::Window* gained_active, 134 virtual void OnWindowActivated(aura::Window* gained_active,
131 aura::Window* lost_active) MOJO_OVERRIDE; 135 aura::Window* lost_active) MOJO_OVERRIDE;
132 136
133 aura::Window* GetWindowForViewId(Id view) const;
134
135 // Creates an aura::Window for every view in the hierarchy beneath |view|, 137 // Creates an aura::Window for every view in the hierarchy beneath |view|,
136 // and adds to the registry so that it can be retrieved later via 138 // and adds to the registry so that it can be retrieved later via
137 // GetWindowForViewId(). 139 // GetWindowForViewId().
138 // TODO(beng): perhaps View should have a property bag. 140 // TODO(beng): perhaps View should have a property bag.
139 void RegisterSubtree(View* view, aura::Window* parent); 141 void RegisterSubtree(View* view, aura::Window* parent);
140 // Deletes the aura::Windows associated with the hierarchy beneath |id|, 142 // Deletes the aura::Windows associated with the hierarchy beneath |id|,
141 // and removes from the registry. 143 // and removes from the registry.
142 void UnregisterSubtree(View* view); 144 void UnregisterSubtree(View* view);
143 145
144 InterfaceFactoryImplWithContext<WindowManagerServiceImpl, WindowManagerApp> 146 InterfaceFactoryImplWithContext<WindowManagerServiceImpl, WindowManagerApp>
(...skipping 17 matching lines...) Expand all
162 ViewIdToWindowMap view_id_to_window_map_; 164 ViewIdToWindowMap view_id_to_window_map_;
163 165
164 scoped_ptr<DummyDelegate> dummy_delegate_; 166 scoped_ptr<DummyDelegate> dummy_delegate_;
165 167
166 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp); 168 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp);
167 }; 169 };
168 170
169 } // namespace mojo 171 } // namespace mojo
170 172
171 #endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ 173 #endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698