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

Side by Side Diff: mash/wm/window_manager_application.cc

Issue 1994763002: Wires up WorkspaceLayoutManager in mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: data deps Created 4 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "mash/wm/window_manager_application.h" 5 #include "mash/wm/window_manager_application.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "components/mus/common/event_matcher_util.h" 11 #include "components/mus/common/event_matcher_util.h"
12 #include "components/mus/public/cpp/window.h" 12 #include "components/mus/public/cpp/window.h"
13 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" 13 #include "components/mus/public/interfaces/window_manager_factory.mojom.h"
14 #include "mash/wm/accelerator_registrar_impl.h" 14 #include "mash/wm/accelerator_registrar_impl.h"
15 #include "mash/wm/bridge/wm_globals_mus.h"
16 #include "mash/wm/bridge/wm_lookup_mus.h"
15 #include "mash/wm/root_window_controller.h" 17 #include "mash/wm/root_window_controller.h"
16 #include "mash/wm/root_windows_observer.h" 18 #include "mash/wm/root_windows_observer.h"
17 #include "mash/wm/shelf_layout_impl.h" 19 #include "mash/wm/shelf_layout_impl.h"
18 #include "mash/wm/user_window_controller_impl.h" 20 #include "mash/wm/user_window_controller_impl.h"
19 #include "mojo/converters/input_events/input_events_type_converters.h" 21 #include "mojo/converters/input_events/input_events_type_converters.h"
20 #include "services/shell/public/cpp/connection.h" 22 #include "services/shell/public/cpp/connection.h"
21 #include "services/shell/public/cpp/connector.h" 23 #include "services/shell/public/cpp/connector.h"
22 #include "services/tracing/public/cpp/tracing_impl.h" 24 #include "services/tracing/public/cpp/tracing_impl.h"
23 #include "ui/events/event.h" 25 #include "ui/events/event.h"
24 #include "ui/views/mus/aura_init.h" 26 #include "ui/views/mus/aura_init.h"
(...skipping 23 matching lines...) Expand all
48 std::set<RootWindowController*> root_controllers; 50 std::set<RootWindowController*> root_controllers;
49 for (RootWindowController* controller : root_controllers_) { 51 for (RootWindowController* controller : root_controllers_) {
50 if (controller->root()) 52 if (controller->root())
51 root_controllers.insert(controller); 53 root_controllers.insert(controller);
52 } 54 }
53 return root_controllers; 55 return root_controllers;
54 } 56 }
55 57
56 void WindowManagerApplication::OnRootWindowControllerGotRoot( 58 void WindowManagerApplication::OnRootWindowControllerGotRoot(
57 RootWindowController* root_controller) { 59 RootWindowController* root_controller) {
58 aura_init_.reset(new views::AuraInit(connector_, "mash_wm_resources.pak")); 60 if (globals_)
61 return; // |root_controller| is the > 1 root, nothing to do.
62
63 if (connector_)
64 aura_init_.reset(new views::AuraInit(connector_, "mash_wm_resources.pak"));
65
66 globals_.reset(new WmGlobalsMus(root_controller->root()->connection()));
67 lookup_.reset(new WmLookupMus);
59 } 68 }
60 69
61 void WindowManagerApplication::OnRootWindowControllerDoneInit( 70 void WindowManagerApplication::OnRootWindowControllerDoneInit(
62 RootWindowController* root_controller) { 71 RootWindowController* root_controller) {
63 screen_.reset(new views::ScreenMus(nullptr)); 72 if (!screen_) {
64 screen_->Init(connector_); 73 std::unique_ptr<views::ScreenMus> screen(new views::ScreenMus(nullptr));
74 screen->Init(connector_);
75 screen_ = std::move(screen);
76 }
65 77
66 // TODO(msw): figure out if this should be per display, or global. 78 // TODO(msw): figure out if this should be per display, or global.
67 user_window_controller_->Initialize(root_controller); 79 user_window_controller_->Initialize(root_controller);
68 for (auto& request : user_window_controller_requests_) 80 for (auto& request : user_window_controller_requests_)
69 user_window_controller_bindings_.AddBinding(user_window_controller_.get(), 81 user_window_controller_bindings_.AddBinding(user_window_controller_.get(),
70 std::move(*request)); 82 std::move(*request));
71 user_window_controller_requests_.clear(); 83 user_window_controller_requests_.clear();
72 84
73 // TODO(msw): figure out if this should be per display, or global. 85 // TODO(msw): figure out if this should be per display, or global.
74 shelf_layout_->Initialize(root_controller); 86 shelf_layout_->Initialize(root_controller);
(...skipping 29 matching lines...) Expand all
104 void WindowManagerApplication::RemoveRootWindowsObserver( 116 void WindowManagerApplication::RemoveRootWindowsObserver(
105 RootWindowsObserver* observer) { 117 RootWindowsObserver* observer) {
106 root_windows_observers_.RemoveObserver(observer); 118 root_windows_observers_.RemoveObserver(observer);
107 } 119 }
108 120
109 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( 121 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed(
110 AcceleratorRegistrarImpl* registrar) { 122 AcceleratorRegistrarImpl* registrar) {
111 accelerator_registrars_.erase(registrar); 123 accelerator_registrars_.erase(registrar);
112 } 124 }
113 125
126 void WindowManagerApplication::AddRootWindowController(
127 RootWindowController* root_window_controller) {
128 root_controllers_.insert(root_window_controller);
129 }
130
114 void WindowManagerApplication::Initialize(shell::Connector* connector, 131 void WindowManagerApplication::Initialize(shell::Connector* connector,
115 const shell::Identity& identity, 132 const shell::Identity& identity,
116 uint32_t id) { 133 uint32_t id) {
117 connector_ = connector; 134 connector_ = connector;
118 tracing_.Initialize(connector, identity.name()); 135 if (connector) {
136 tracing_.Initialize(connector, identity.name());
119 137
120 mus::mojom::WindowManagerFactoryServicePtr wm_factory_service; 138 mus::mojom::WindowManagerFactoryServicePtr wm_factory_service;
121 connector_->ConnectToInterface("mojo:mus", &wm_factory_service); 139 connector_->ConnectToInterface("mojo:mus", &wm_factory_service);
122 wm_factory_service->SetWindowManagerFactory( 140 wm_factory_service->SetWindowManagerFactory(
123 window_manager_factory_binding_.CreateInterfacePtrAndBind()); 141 window_manager_factory_binding_.CreateInterfacePtrAndBind());
142 }
124 143
125 shelf_layout_.reset(new ShelfLayoutImpl); 144 shelf_layout_.reset(new ShelfLayoutImpl);
126 user_window_controller_.reset(new UserWindowControllerImpl()); 145 user_window_controller_.reset(new UserWindowControllerImpl());
127 } 146 }
128 147
129 bool WindowManagerApplication::AcceptConnection(shell::Connection* connection) { 148 bool WindowManagerApplication::AcceptConnection(shell::Connection* connection) {
130 connection->AddInterface<mojom::ShelfLayout>(this); 149 connection->AddInterface<mojom::ShelfLayout>(this);
131 connection->AddInterface<mojom::UserWindowController>(this); 150 connection->AddInterface<mojom::UserWindowController>(this);
132 connection->AddInterface<mus::mojom::AcceleratorRegistrar>(this); 151 connection->AddInterface<mus::mojom::AcceleratorRegistrar>(this);
133 if (connection->GetRemoteIdentity().name() == "mojo:mash_session") 152 if (connection->GetRemoteIdentity().name() == "mojo:mash_session")
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 193 }
175 accelerator_registrars_.insert(new AcceleratorRegistrarImpl( 194 accelerator_registrars_.insert(new AcceleratorRegistrarImpl(
176 this, ++accelerator_registrar_count, std::move(request), 195 this, ++accelerator_registrar_count, std::move(request),
177 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, 196 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed,
178 base::Unretained(this)))); 197 base::Unretained(this))));
179 } 198 }
180 199
181 void WindowManagerApplication::CreateWindowManager( 200 void WindowManagerApplication::CreateWindowManager(
182 mus::mojom::DisplayPtr display, 201 mus::mojom::DisplayPtr display,
183 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) { 202 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) {
184 root_controllers_.insert(RootWindowController::CreateFromDisplay( 203 AddRootWindowController(RootWindowController::CreateFromDisplay(
185 this, std::move(display), std::move(client_request))); 204 this, std::move(display), std::move(client_request)));
186 } 205 }
187 206
188 } // namespace wm 207 } // namespace wm
189 } // namespace mash 208 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/window_manager_application.h ('k') | mash/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698