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

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

Issue 805123003: Adds capture to the mojo window_manager. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: sky comments 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"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "mojo/public/cpp/application/application_delegate.h" 12 #include "mojo/public/cpp/application/application_delegate.h"
13 #include "mojo/public/cpp/application/interface_factory_impl.h" 13 #include "mojo/public/cpp/application/interface_factory_impl.h"
14 #include "mojo/public/cpp/bindings/binding.h" 14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "mojo/public/cpp/bindings/string.h" 15 #include "mojo/public/cpp/bindings/string.h"
16 #include "mojo/services/view_manager/public/cpp/types.h" 16 #include "mojo/services/view_manager/public/cpp/types.h"
17 #include "mojo/services/view_manager/public/cpp/view_manager_client_factory.h" 17 #include "mojo/services/view_manager/public/cpp/view_manager_client_factory.h"
18 #include "mojo/services/view_manager/public/cpp/view_manager_delegate.h" 18 #include "mojo/services/view_manager/public/cpp/view_manager_delegate.h"
19 #include "mojo/services/view_manager/public/cpp/view_observer.h" 19 #include "mojo/services/view_manager/public/cpp/view_observer.h"
20 #include "mojo/services/window_manager/public/interfaces/window_manager_internal .mojom.h" 20 #include "mojo/services/window_manager/public/interfaces/window_manager_internal .mojom.h"
21 #include "services/window_manager/capture_controller_observer.h"
21 #include "services/window_manager/focus_controller_observer.h" 22 #include "services/window_manager/focus_controller_observer.h"
22 #include "services/window_manager/native_viewport_event_dispatcher_impl.h" 23 #include "services/window_manager/native_viewport_event_dispatcher_impl.h"
23 #include "services/window_manager/view_target.h" 24 #include "services/window_manager/view_target.h"
24 #include "services/window_manager/window_manager_impl.h" 25 #include "services/window_manager/window_manager_impl.h"
25 #include "ui/events/event_handler.h" 26 #include "ui/events/event_handler.h"
26 27
27 namespace gfx { 28 namespace gfx {
28 class Size; 29 class Size;
29 } 30 }
30 31
31 namespace window_manager { 32 namespace window_manager {
32 33
34 class CaptureController;
33 class FocusController; 35 class FocusController;
34 class FocusRules; 36 class FocusRules;
35 class ViewEventDispatcher; 37 class ViewEventDispatcher;
36 class WindowManagerClient; 38 class WindowManagerClient;
37 class WindowManagerDelegate; 39 class WindowManagerDelegate;
38 class WindowManagerImpl; 40 class WindowManagerImpl;
39 41
40 // Implements core window manager functionality that could conceivably be shared 42 // Implements core window manager functionality that could conceivably be shared
41 // across multiple window managers implementing superficially different user 43 // across multiple window managers implementing superficially different user
42 // experiences. Establishes communication with the view manager. 44 // experiences. Establishes communication with the view manager.
43 // A window manager wishing to use this core should create and own an instance 45 // 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 46 // of this object. They may implement the associated ViewManager/WindowManager
45 // delegate interfaces exposed by the view manager, this object provides the 47 // delegate interfaces exposed by the view manager, this object provides the
46 // canonical implementation of said interfaces but will call out to the wrapped 48 // canonical implementation of said interfaces but will call out to the wrapped
47 // instances. 49 // instances.
48 class WindowManagerApp 50 class WindowManagerApp
49 : public mojo::ApplicationDelegate, 51 : public mojo::ApplicationDelegate,
50 public mojo::ViewManagerDelegate, 52 public mojo::ViewManagerDelegate,
51 public mojo::ViewObserver, 53 public mojo::ViewObserver,
52 public ui::EventHandler, 54 public ui::EventHandler,
53 public FocusControllerObserver, 55 public FocusControllerObserver,
56 public CaptureControllerObserver,
54 public mojo::InterfaceFactory<mojo::WindowManager>, 57 public mojo::InterfaceFactory<mojo::WindowManager>,
55 public mojo::InterfaceFactory<mojo::WindowManagerInternal>, 58 public mojo::InterfaceFactory<mojo::WindowManagerInternal>,
56 public mojo::WindowManagerInternal { 59 public mojo::WindowManagerInternal {
57 public: 60 public:
58 WindowManagerApp(ViewManagerDelegate* view_manager_delegate, 61 WindowManagerApp(ViewManagerDelegate* view_manager_delegate,
59 WindowManagerDelegate* window_manager_delegate); 62 WindowManagerDelegate* window_manager_delegate);
60 ~WindowManagerApp() override; 63 ~WindowManagerApp() override;
61 64
62 ViewEventDispatcher* event_dispatcher() { 65 ViewEventDispatcher* event_dispatcher() {
63 return view_event_dispatcher_.get(); 66 return view_event_dispatcher_.get();
64 } 67 }
65 68
66 // Register/deregister new connections to the window manager service. 69 // Register/deregister new connections to the window manager service.
67 void AddConnection(WindowManagerImpl* connection); 70 void AddConnection(WindowManagerImpl* connection);
68 void RemoveConnection(WindowManagerImpl* connection); 71 void RemoveConnection(WindowManagerImpl* connection);
69 72
70 // These are canonical implementations of the window manager API methods. 73 // These are canonical implementations of the window manager API methods.
71 void SetCapture(mojo::Id view); 74 void SetCapture(mojo::Id view);
72 void FocusWindow(mojo::Id view); 75 void FocusWindow(mojo::Id view);
73 void ActivateWindow(mojo::Id view); 76 void ActivateWindow(mojo::Id view);
74 77
75 void DispatchInputEventToView(mojo::View* view, mojo::EventPtr event); 78 void DispatchInputEventToView(mojo::View* view, mojo::EventPtr event);
76 void SetViewportSize(const gfx::Size& size); 79 void SetViewportSize(const gfx::Size& size);
77 80
78 bool IsReady() const; 81 bool IsReady() const;
79 82
80 FocusController* focus_controller() { return focus_controller_.get(); } 83 FocusController* focus_controller() { return focus_controller_.get(); }
84 CaptureController* capture_controller() { return capture_controller_.get(); }
81 85
82 void InitFocus(scoped_ptr<FocusRules> rules); 86 void InitFocus(scoped_ptr<FocusRules> rules);
83 87
84 // WindowManagerImpl::Embed() forwards to this. If connected to ViewManager 88 // WindowManagerImpl::Embed() forwards to this. If connected to ViewManager
85 // then forwards to delegate, otherwise waits for connection to establish then 89 // then forwards to delegate, otherwise waits for connection to establish then
86 // forwards. 90 // forwards.
87 void Embed(const mojo::String& url, 91 void Embed(const mojo::String& url,
88 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider); 92 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider);
89 93
90 // Overridden from ApplicationDelegate: 94 // Overridden from ApplicationDelegate:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void OnViewDestroying(mojo::View* view) override; 129 void OnViewDestroying(mojo::View* view) override;
126 130
127 // Overridden from ui::EventHandler: 131 // Overridden from ui::EventHandler:
128 void OnEvent(ui::Event* event) override; 132 void OnEvent(ui::Event* event) override;
129 133
130 // Overridden from mojo::FocusControllerObserver: 134 // Overridden from mojo::FocusControllerObserver:
131 void OnViewFocused(mojo::View* gained_focus, mojo::View* lost_focus) override; 135 void OnViewFocused(mojo::View* gained_focus, mojo::View* lost_focus) override;
132 void OnViewActivated(mojo::View* gained_active, 136 void OnViewActivated(mojo::View* gained_active,
133 mojo::View* lost_active) override; 137 mojo::View* lost_active) override;
134 138
139 // Overridden from mojo::CaptureControllerObserver:
140 void OnCaptureChanged(mojo::View* gained_capture,
141 mojo::View* lost_capture) override;
142
135 // Creates the connection to the ViewManager. 143 // Creates the connection to the ViewManager.
136 void LaunchViewManager(mojo::ApplicationImpl* app); 144 void LaunchViewManager(mojo::ApplicationImpl* app);
137 145
138 // InterfaceFactory<WindowManagerInternal>: 146 // InterfaceFactory<WindowManagerInternal>:
139 void Create( 147 void Create(
140 mojo::ApplicationConnection* connection, 148 mojo::ApplicationConnection* connection,
141 mojo::InterfaceRequest<mojo::WindowManagerInternal> request) override; 149 mojo::InterfaceRequest<mojo::WindowManagerInternal> request) override;
142 150
143 // InterfaceFactory<WindowManager>: 151 // InterfaceFactory<WindowManager>:
144 void Create(mojo::ApplicationConnection* connection, 152 void Create(mojo::ApplicationConnection* connection,
(...skipping 11 matching lines...) Expand all
156 native_viewport_event_dispatcher_factory_; 164 native_viewport_event_dispatcher_factory_;
157 165
158 ViewManagerDelegate* wrapped_view_manager_delegate_; 166 ViewManagerDelegate* wrapped_view_manager_delegate_;
159 WindowManagerDelegate* window_manager_delegate_; 167 WindowManagerDelegate* window_manager_delegate_;
160 168
161 mojo::ViewManager* view_manager_; 169 mojo::ViewManager* view_manager_;
162 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_; 170 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
163 mojo::View* root_; 171 mojo::View* root_;
164 172
165 scoped_ptr<FocusController> focus_controller_; 173 scoped_ptr<FocusController> focus_controller_;
174 scoped_ptr<CaptureController> capture_controller_;
166 175
167 Connections connections_; 176 Connections connections_;
168 RegisteredViewIdSet registered_view_id_set_; 177 RegisteredViewIdSet registered_view_id_set_;
169 178
170 mojo::WindowManagerInternalClientPtr window_manager_client_; 179 mojo::WindowManagerInternalClientPtr window_manager_client_;
171 180
172 ScopedVector<PendingEmbed> pending_embeds_; 181 ScopedVector<PendingEmbed> pending_embeds_;
173 182
174 scoped_ptr<mojo::ViewManagerClient> view_manager_client_; 183 scoped_ptr<mojo::ViewManagerClient> view_manager_client_;
175 184
176 scoped_ptr<ViewEventDispatcher> view_event_dispatcher_; 185 scoped_ptr<ViewEventDispatcher> view_event_dispatcher_;
177 186
178 scoped_ptr<mojo::Binding<WindowManagerInternal>> wm_internal_binding_; 187 scoped_ptr<mojo::Binding<WindowManagerInternal>> wm_internal_binding_;
179 188
180 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp); 189 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp);
181 }; 190 };
182 191
183 } // namespace window_manager 192 } // namespace window_manager
184 193
185 #endif // SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ 194 #endif // SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_
OLDNEW
« no previous file with comments | « services/window_manager/view_targeter_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