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

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

Issue 788453002: Put code in //services/window_manager in namespace window_manager (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ 5 #ifndef SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_
6 #define SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ 6 #define 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 10 matching lines...) Expand all
21 #include "services/window_manager/focus_controller_observer.h" 21 #include "services/window_manager/focus_controller_observer.h"
22 #include "services/window_manager/native_viewport_event_dispatcher_impl.h" 22 #include "services/window_manager/native_viewport_event_dispatcher_impl.h"
23 #include "services/window_manager/view_target.h" 23 #include "services/window_manager/view_target.h"
24 #include "services/window_manager/window_manager_impl.h" 24 #include "services/window_manager/window_manager_impl.h"
25 #include "ui/events/event_handler.h" 25 #include "ui/events/event_handler.h"
26 26
27 namespace gfx { 27 namespace gfx {
28 class Size; 28 class Size;
29 } 29 }
30 30
31 namespace mojo { 31 namespace window_manager {
32 32
33 class FocusController; 33 class FocusController;
34 class FocusRules; 34 class FocusRules;
35 class ViewEventDispatcher;
35 class WindowManagerClient; 36 class WindowManagerClient;
36 class WindowManagerDelegate; 37 class WindowManagerDelegate;
37 class WindowManagerImpl; 38 class WindowManagerImpl;
38 class ViewEventDispatcher;
39 39
40 // Implements core window manager functionality that could conceivably be shared 40 // Implements core window manager functionality that could conceivably be shared
41 // across multiple window managers implementing superficially different user 41 // across multiple window managers implementing superficially different user
42 // experiences. Establishes communication with the view manager. 42 // experiences. Establishes communication with the view manager.
43 // A window manager wishing to use this core should create and own an instance 43 // A window manager wishing to use this core should create and own an instance
44 // of this object. They may implement the associated ViewManager/WindowManager 44 // of this object. They may implement the associated ViewManager/WindowManager
45 // delegate interfaces exposed by the view manager, this object provides the 45 // delegate interfaces exposed by the view manager, this object provides the
46 // canonical implementation of said interfaces but will call out to the wrapped 46 // canonical implementation of said interfaces but will call out to the wrapped
47 // instances. 47 // instances.
48 class WindowManagerApp : public ApplicationDelegate, 48 class WindowManagerApp
49 public ViewManagerDelegate, 49 : public mojo::ApplicationDelegate,
50 public ViewObserver, 50 public mojo::ViewManagerDelegate,
51 public ui::EventHandler, 51 public mojo::ViewObserver,
52 public FocusControllerObserver, 52 public ui::EventHandler,
53 public InterfaceFactory<WindowManager>, 53 public FocusControllerObserver,
54 public InterfaceFactory<WindowManagerInternal>, 54 public mojo::InterfaceFactory<mojo::WindowManager>,
55 public WindowManagerInternal { 55 public mojo::InterfaceFactory<mojo::WindowManagerInternal>,
56 public mojo::WindowManagerInternal {
56 public: 57 public:
57 WindowManagerApp(ViewManagerDelegate* view_manager_delegate, 58 WindowManagerApp(ViewManagerDelegate* view_manager_delegate,
58 WindowManagerDelegate* window_manager_delegate); 59 WindowManagerDelegate* window_manager_delegate);
59 ~WindowManagerApp() override; 60 ~WindowManagerApp() override;
60 61
61 mojo::ViewEventDispatcher* event_dispatcher() { 62 ViewEventDispatcher* event_dispatcher() {
62 return view_event_dispatcher_.get(); 63 return view_event_dispatcher_.get();
63 } 64 }
64 65
65 // Register/deregister new connections to the window manager service. 66 // Register/deregister new connections to the window manager service.
66 void AddConnection(WindowManagerImpl* connection); 67 void AddConnection(WindowManagerImpl* connection);
67 void RemoveConnection(WindowManagerImpl* connection); 68 void RemoveConnection(WindowManagerImpl* connection);
68 69
69 // These are canonical implementations of the window manager API methods. 70 // These are canonical implementations of the window manager API methods.
70 void SetCapture(Id view); 71 void SetCapture(mojo::Id view);
71 void FocusWindow(Id view); 72 void FocusWindow(mojo::Id view);
72 void ActivateWindow(Id view); 73 void ActivateWindow(mojo::Id view);
73 74
74 void DispatchInputEventToView(View* view, EventPtr event); 75 void DispatchInputEventToView(mojo::View* view, mojo::EventPtr event);
75 void SetViewportSize(const gfx::Size& size); 76 void SetViewportSize(const gfx::Size& size);
76 77
77 bool IsReady() const; 78 bool IsReady() const;
78 79
79 FocusController* focus_controller() { return focus_controller_.get(); } 80 FocusController* focus_controller() { return focus_controller_.get(); }
80 81
81 void InitFocus(scoped_ptr<FocusRules> rules); 82 void InitFocus(scoped_ptr<FocusRules> rules);
82 83
83 // WindowManagerImpl::Embed() forwards to this. If connected to ViewManager 84 // WindowManagerImpl::Embed() forwards to this. If connected to ViewManager
84 // then forwards to delegate, otherwise waits for connection to establish then 85 // then forwards to delegate, otherwise waits for connection to establish then
85 // forwards. 86 // forwards.
86 void Embed(const String& url, 87 void Embed(const mojo::String& url,
87 InterfaceRequest<ServiceProvider> service_provider); 88 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider);
88 89
89 // Overridden from ApplicationDelegate: 90 // Overridden from ApplicationDelegate:
90 void Initialize(ApplicationImpl* impl) override; 91 void Initialize(mojo::ApplicationImpl* impl) override;
91 bool ConfigureIncomingConnection(ApplicationConnection* connection) override; 92 bool ConfigureIncomingConnection(
93 mojo::ApplicationConnection* connection) override;
92 94
93 private: 95 private:
94 // TODO(sky): rename this. Connections is ambiguous. 96 // TODO(sky): rename this. Connections is ambiguous.
95 typedef std::set<WindowManagerImpl*> Connections; 97 typedef std::set<WindowManagerImpl*> Connections;
96 typedef std::set<Id> RegisteredViewIdSet; 98 typedef std::set<mojo::Id> RegisteredViewIdSet;
97 99
98 struct PendingEmbed; 100 struct PendingEmbed;
99 class WindowManagerInternalImpl; 101 class WindowManagerInternalImpl;
100 102
101 // Creates an ViewTarget for every view in the hierarchy beneath |view|, 103 // 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 104 // and adds to the registry so that it can be retrieved later via
103 // GetViewTargetForViewId(). 105 // GetViewTargetForViewId().
104 // TODO(beng): perhaps View should have a property bag. 106 // TODO(beng): perhaps View should have a property bag.
105 void RegisterSubtree(View* view); 107 void RegisterSubtree(mojo::View* view);
106 108
107 // Recursively invokes Unregister() for |view| and all its descendants. 109 // Recursively invokes Unregister() for |view| and all its descendants.
108 void UnregisterSubtree(View* view); 110 void UnregisterSubtree(mojo::View* view);
109 111
110 // Deletes the ViewTarget associated with the hierarchy beneath |id|, 112 // Deletes the ViewTarget associated with the hierarchy beneath |id|,
111 // and removes from the registry. 113 // and removes from the registry.
112 void Unregister(View* view); 114 void Unregister(mojo::View* view);
113 115
114 // Overridden from ViewManagerDelegate: 116 // Overridden from ViewManagerDelegate:
115 void OnEmbed(ViewManager* view_manager, 117 void OnEmbed(mojo::ViewManager* view_manager,
116 View* root, 118 mojo::View* root,
117 ServiceProviderImpl* exported_services, 119 mojo::ServiceProviderImpl* exported_services,
118 scoped_ptr<ServiceProvider> imported_services) override; 120 scoped_ptr<mojo::ServiceProvider> imported_services) override;
119 void OnViewManagerDisconnected(ViewManager* view_manager) override; 121 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override;
120 122
121 // Overridden from ViewObserver: 123 // Overridden from ViewObserver:
122 void OnTreeChanged(const ViewObserver::TreeChangeParams& params) override; 124 void OnTreeChanged(const ViewObserver::TreeChangeParams& params) override;
123 void OnViewDestroying(View* view) override; 125 void OnViewDestroying(mojo::View* view) override;
124 126
125 // Overridden from ui::EventHandler: 127 // Overridden from ui::EventHandler:
126 void OnEvent(ui::Event* event) override; 128 void OnEvent(ui::Event* event) override;
127 129
128 // Overridden from mojo::FocusControllerObserver: 130 // Overridden from mojo::FocusControllerObserver:
129 void OnViewFocused(View* gained_focus, View* lost_focus) override; 131 void OnViewFocused(mojo::View* gained_focus, mojo::View* lost_focus) override;
130 void OnViewActivated(View* gained_active, View* lost_active) override; 132 void OnViewActivated(mojo::View* gained_active,
133 mojo::View* lost_active) override;
131 134
132 // Creates the connection to the ViewManager. 135 // Creates the connection to the ViewManager.
133 void LaunchViewManager(ApplicationImpl* app); 136 void LaunchViewManager(mojo::ApplicationImpl* app);
134 137
135 // InterfaceFactory<WindowManagerInternal>: 138 // InterfaceFactory<WindowManagerInternal>:
136 void Create(ApplicationConnection* connection, 139 void Create(
137 InterfaceRequest<WindowManagerInternal> request) override; 140 mojo::ApplicationConnection* connection,
141 mojo::InterfaceRequest<mojo::WindowManagerInternal> request) override;
138 142
139 // InterfaceFactory<WindowManager>: 143 // InterfaceFactory<WindowManager>:
140 void Create(ApplicationConnection* connection, 144 void Create(mojo::ApplicationConnection* connection,
141 InterfaceRequest<WindowManager> request) override; 145 mojo::InterfaceRequest<mojo::WindowManager> request) override;
142 146
143 // WindowManagerInternal: 147 // WindowManagerInternal:
144 void CreateWindowManagerForViewManagerClient( 148 void CreateWindowManagerForViewManagerClient(
145 uint16_t connection_id, 149 uint16_t connection_id,
146 ScopedMessagePipeHandle window_manager_pipe) override; 150 mojo::ScopedMessagePipeHandle window_manager_pipe) override;
147 151
148 Shell* shell_; 152 mojo::Shell* shell_;
149 153
150 InterfaceFactoryImplWithContext<NativeViewportEventDispatcherImpl, 154 mojo::InterfaceFactoryImplWithContext<NativeViewportEventDispatcherImpl,
151 WindowManagerApp> 155 WindowManagerApp>
152 native_viewport_event_dispatcher_factory_; 156 native_viewport_event_dispatcher_factory_;
153 157
154 ViewManagerDelegate* wrapped_view_manager_delegate_; 158 ViewManagerDelegate* wrapped_view_manager_delegate_;
155 WindowManagerDelegate* window_manager_delegate_; 159 WindowManagerDelegate* window_manager_delegate_;
156 160
157 ViewManager* view_manager_; 161 mojo::ViewManager* view_manager_;
158 scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_; 162 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
159 View* root_; 163 mojo::View* root_;
160 164
161 scoped_ptr<mojo::FocusController> focus_controller_; 165 scoped_ptr<FocusController> focus_controller_;
162 166
163 Connections connections_; 167 Connections connections_;
164 RegisteredViewIdSet registered_view_id_set_; 168 RegisteredViewIdSet registered_view_id_set_;
165 169
166 WindowManagerInternalClientPtr window_manager_client_; 170 mojo::WindowManagerInternalClientPtr window_manager_client_;
167 171
168 ScopedVector<PendingEmbed> pending_embeds_; 172 ScopedVector<PendingEmbed> pending_embeds_;
169 173
170 scoped_ptr<ViewManagerClient> view_manager_client_; 174 scoped_ptr<mojo::ViewManagerClient> view_manager_client_;
171 175
172 scoped_ptr<ViewEventDispatcher> view_event_dispatcher_; 176 scoped_ptr<ViewEventDispatcher> view_event_dispatcher_;
173 177
174 scoped_ptr<Binding<WindowManagerInternal>> wm_internal_binding_; 178 scoped_ptr<mojo::Binding<WindowManagerInternal>> wm_internal_binding_;
175 179
176 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp); 180 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp);
177 }; 181 };
178 182
179 } // namespace mojo 183 } // namespace window_manager
180 184
181 #endif // SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ 185 #endif // SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_
OLDNEW
« no previous file with comments | « services/window_manager/window_manager_api_unittest.cc ('k') | services/window_manager/window_manager_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698