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

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

Issue 1138073007: Nukes the windowmanager interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_
6 #define COMPONENTS_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_
7
8 #include <set>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h"
12 #include "components/view_manager/public/cpp/types.h"
13 #include "components/view_manager/public/cpp/view_manager_client_factory.h"
14 #include "components/view_manager/public/cpp/view_manager_delegate.h"
15 #include "components/view_manager/public/cpp/view_observer.h"
16 #include "components/window_manager/public/interfaces/window_manager_internal.mo jom.h"
17 #include "components/window_manager/window_manager_impl.h"
18 #include "mojo/application/public/cpp/application_delegate.h"
19 #include "mojo/application/public/cpp/interface_factory_impl.h"
20 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
21 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
22 #include "ui/mojo/events/input_events.mojom.h"
23 #include "ui/mojo/events/input_key_codes.mojom.h"
24
25 namespace gfx {
26 class Size;
27 }
28
29 namespace window_manager {
30
31 class WindowManagerDelegate;
32 class WindowManagerImpl;
33
34 // Implements core window manager functionality that could conceivably be shared
35 // across multiple window managers implementing superficially different user
36 // experiences. Establishes communication with the view manager.
37 // A window manager wishing to use this core should create and own an instance
38 // of this object. They may implement the associated ViewManager/WindowManager
39 // delegate interfaces exposed by the view manager, this object provides the
40 // canonical implementation of said interfaces but will call out to the wrapped
41 // instances.
42 class WindowManagerApp
43 : public mojo::ApplicationDelegate,
44 public mojo::ViewManagerDelegate,
45 public mojo::ViewObserver,
46 public mojo::InterfaceFactory<mojo::WindowManager>,
47 public mojo::InterfaceFactory<mojo::WindowManagerInternal>,
48 public mojo::WindowManagerInternal {
49 public:
50 WindowManagerApp(ViewManagerDelegate* view_manager_delegate,
51 WindowManagerDelegate* window_manager_delegate);
52 ~WindowManagerApp() override;
53
54 // Register/deregister new connections to the window manager service.
55 void AddConnection(WindowManagerImpl* connection);
56 void RemoveConnection(WindowManagerImpl* connection);
57
58 void DispatchInputEventToViewDEPRECATED(mojo::View* view,
59 mojo::EventPtr event);
60 void SetViewportSize(const gfx::Size& size);
61
62 bool IsReady() const;
63
64 void AddAccelerator(mojo::KeyboardCode keyboard_code, mojo::EventFlags flags);
65 void RemoveAccelerator(mojo::KeyboardCode keyboard_code,
66 mojo::EventFlags flags);
67
68 // WindowManagerImpl::Embed() forwards to this. If connected to ViewManager
69 // then forwards to delegate, otherwise waits for connection to establish then
70 // forwards.
71 void Embed(const mojo::String& url,
72 mojo::InterfaceRequest<mojo::ServiceProvider> services,
73 mojo::ServiceProviderPtr exposed_services);
74
75 // Overridden from ApplicationDelegate:
76 void Initialize(mojo::ApplicationImpl* impl) override;
77 bool ConfigureIncomingConnection(
78 mojo::ApplicationConnection* connection) override;
79
80 private:
81 // TODO(sky): rename this. Connections is ambiguous.
82 typedef std::set<WindowManagerImpl*> Connections;
83
84 struct PendingEmbed;
85
86 mojo::ViewManager* view_manager() {
87 return root_ ? root_->view_manager() : nullptr;
88 }
89
90 // Overridden from ViewManagerDelegate:
91 void OnEmbed(mojo::View* root,
92 mojo::InterfaceRequest<mojo::ServiceProvider> services,
93 mojo::ServiceProviderPtr exposed_services) override;
94 void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override;
95
96 // Overridden from ViewObserver:
97 void OnViewDestroying(mojo::View* view) override;
98
99 // Creates the connection to the ViewManager.
100 void LaunchViewManager(mojo::ApplicationImpl* app);
101
102 // InterfaceFactory<WindowManagerInternal>:
103 void Create(
104 mojo::ApplicationConnection* connection,
105 mojo::InterfaceRequest<mojo::WindowManagerInternal> request) override;
106
107 // InterfaceFactory<WindowManager>:
108 void Create(mojo::ApplicationConnection* connection,
109 mojo::InterfaceRequest<mojo::WindowManager> request) override;
110
111 // WindowManagerInternal:
112 void SetViewManagerClient(
113 mojo::ScopedMessagePipeHandle view_manager_client_request) override;
114 void OnAccelerator(mojo::EventPtr event) override;
115
116 mojo::Shell* shell_;
117
118 ViewManagerDelegate* wrapped_view_manager_delegate_;
119 WindowManagerDelegate* window_manager_delegate_;
120
121 mojo::ViewManagerServicePtr view_manager_service_;
122 scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
123
124 mojo::View* root_;
125
126 Connections connections_;
127
128 mojo::WindowManagerInternalClientPtr window_manager_client_;
129
130 ScopedVector<PendingEmbed> pending_embeds_;
131
132 scoped_ptr<mojo::ViewManagerClient> view_manager_client_;
133
134 scoped_ptr<mojo::Binding<WindowManagerInternal>> wm_internal_binding_;
135
136 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp);
137 };
138
139 } // namespace window_manager
140
141 #endif // COMPONENTS_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698