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

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

Issue 1950293003: mash: Add status area container to mash window manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments 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
« no previous file with comments | « mash/wm/window_manager_application.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/public/cpp/event_matcher_util.h" 11 #include "components/mus/public/cpp/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/root_window_controller.h" 15 #include "mash/wm/root_window_controller.h"
16 #include "mash/wm/root_windows_observer.h" 16 #include "mash/wm/root_windows_observer.h"
17 #include "mash/wm/shelf_layout.h" 17 #include "mash/wm/shelf_layout_impl.h"
18 #include "mash/wm/user_window_controller_impl.h" 18 #include "mash/wm/user_window_controller_impl.h"
19 #include "mojo/converters/input_events/input_events_type_converters.h" 19 #include "mojo/converters/input_events/input_events_type_converters.h"
20 #include "services/shell/public/cpp/connection.h" 20 #include "services/shell/public/cpp/connection.h"
21 #include "services/shell/public/cpp/connector.h" 21 #include "services/shell/public/cpp/connector.h"
22 #include "services/tracing/public/cpp/tracing_impl.h" 22 #include "services/tracing/public/cpp/tracing_impl.h"
23 #include "ui/events/event.h" 23 #include "ui/events/event.h"
24 #include "ui/views/mus/aura_init.h" 24 #include "ui/views/mus/aura_init.h"
25 #include "ui/views/mus/display_converter.h" 25 #include "ui/views/mus/display_converter.h"
26 #include "ui/views/mus/screen_mus.h" 26 #include "ui/views/mus/screen_mus.h"
27 27
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 screen_->Init(connector_); 64 screen_->Init(connector_);
65 65
66 // TODO(msw): figure out if this should be per display, or global. 66 // TODO(msw): figure out if this should be per display, or global.
67 user_window_controller_->Initialize(root_controller); 67 user_window_controller_->Initialize(root_controller);
68 for (auto& request : user_window_controller_requests_) 68 for (auto& request : user_window_controller_requests_)
69 user_window_controller_bindings_.AddBinding(user_window_controller_.get(), 69 user_window_controller_bindings_.AddBinding(user_window_controller_.get(),
70 std::move(*request)); 70 std::move(*request));
71 user_window_controller_requests_.clear(); 71 user_window_controller_requests_.clear();
72 72
73 // TODO(msw): figure out if this should be per display, or global. 73 // TODO(msw): figure out if this should be per display, or global.
74 if (root_controller == (*root_controllers_.begin())) { 74 shelf_layout_->Initialize(root_controller);
75 ShelfLayout* shelf_layout = root_controller->GetShelfLayoutManager(); 75 for (auto& request : shelf_layout_requests_)
76 for (auto& request : shelf_layout_requests_) 76 shelf_layout_bindings_.AddBinding(shelf_layout_.get(), std::move(*request));
77 shelf_layout_bindings_.AddBinding(shelf_layout, std::move(*request)); 77 shelf_layout_requests_.clear();
78 shelf_layout_requests_.clear();
79 }
80 78
81 FOR_EACH_OBSERVER(RootWindowsObserver, root_windows_observers_, 79 FOR_EACH_OBSERVER(RootWindowsObserver, root_windows_observers_,
82 OnRootWindowControllerAdded(root_controller)); 80 OnRootWindowControllerAdded(root_controller));
83 } 81 }
84 82
85 void WindowManagerApplication::OnRootWindowDestroyed( 83 void WindowManagerApplication::OnRootWindowDestroyed(
86 RootWindowController* root_controller) { 84 RootWindowController* root_controller) {
87 root_controllers_.erase(root_controller); 85 root_controllers_.erase(root_controller);
88 user_window_controller_.reset(nullptr); 86 user_window_controller_.reset(nullptr);
89 } 87 }
(...skipping 27 matching lines...) Expand all
117 const shell::Identity& identity, 115 const shell::Identity& identity,
118 uint32_t id) { 116 uint32_t id) {
119 connector_ = connector; 117 connector_ = connector;
120 tracing_.Initialize(connector, identity.name()); 118 tracing_.Initialize(connector, identity.name());
121 119
122 mus::mojom::WindowManagerFactoryServicePtr wm_factory_service; 120 mus::mojom::WindowManagerFactoryServicePtr wm_factory_service;
123 connector_->ConnectToInterface("mojo:mus", &wm_factory_service); 121 connector_->ConnectToInterface("mojo:mus", &wm_factory_service);
124 wm_factory_service->SetWindowManagerFactory( 122 wm_factory_service->SetWindowManagerFactory(
125 window_manager_factory_binding_.CreateInterfacePtrAndBind()); 123 window_manager_factory_binding_.CreateInterfacePtrAndBind());
126 124
125 shelf_layout_.reset(new ShelfLayoutImpl);
127 user_window_controller_.reset(new UserWindowControllerImpl()); 126 user_window_controller_.reset(new UserWindowControllerImpl());
128 } 127 }
129 128
130 bool WindowManagerApplication::AcceptConnection(shell::Connection* connection) { 129 bool WindowManagerApplication::AcceptConnection(shell::Connection* connection) {
131 connection->AddInterface<mojom::ShelfLayout>(this); 130 connection->AddInterface<mojom::ShelfLayout>(this);
132 connection->AddInterface<mojom::UserWindowController>(this); 131 connection->AddInterface<mojom::UserWindowController>(this);
133 connection->AddInterface<mus::mojom::AcceleratorRegistrar>(this); 132 connection->AddInterface<mus::mojom::AcceleratorRegistrar>(this);
134 if (connection->GetRemoteIdentity().name() == "mojo:mash_session") 133 if (connection->GetRemoteIdentity().name() == "mojo:mash_session")
135 connection->GetInterface(&session_); 134 connection->GetInterface(&session_);
136 return true; 135 return true;
137 } 136 }
138 137
139 void WindowManagerApplication::Create( 138 void WindowManagerApplication::Create(
140 shell::Connection* connection, 139 shell::Connection* connection,
141 mojo::InterfaceRequest<mojom::ShelfLayout> request) { 140 mojo::InterfaceRequest<mojom::ShelfLayout> request) {
142 // TODO(msw): Handle multiple shelves (one per display). 141 // TODO(msw): Handle multiple shelves (one per display).
143 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) { 142 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) {
144 ShelfLayout* shelf_layout = 143 shelf_layout_bindings_.AddBinding(shelf_layout_.get(), std::move(request));
145 (*root_controllers_.begin())->GetShelfLayoutManager();
146 shelf_layout_bindings_.AddBinding(shelf_layout, std::move(request));
147 } else { 144 } else {
148 shelf_layout_requests_.push_back(base::WrapUnique( 145 shelf_layout_requests_.push_back(base::WrapUnique(
149 new mojo::InterfaceRequest<mojom::ShelfLayout>(std::move(request)))); 146 new mojo::InterfaceRequest<mojom::ShelfLayout>(std::move(request))));
150 } 147 }
151 } 148 }
152 149
153 void WindowManagerApplication::Create( 150 void WindowManagerApplication::Create(
154 shell::Connection* connection, 151 shell::Connection* connection,
155 mojo::InterfaceRequest<mojom::UserWindowController> request) { 152 mojo::InterfaceRequest<mojom::UserWindowController> request) {
156 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) { 153 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) {
(...skipping 26 matching lines...) Expand all
183 180
184 void WindowManagerApplication::CreateWindowManager( 181 void WindowManagerApplication::CreateWindowManager(
185 mus::mojom::DisplayPtr display, 182 mus::mojom::DisplayPtr display,
186 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) { 183 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) {
187 root_controllers_.insert(RootWindowController::CreateFromDisplay( 184 root_controllers_.insert(RootWindowController::CreateFromDisplay(
188 this, std::move(display), std::move(client_request))); 185 this, std::move(display), std::move(client_request)));
189 } 186 }
190 187
191 } // namespace wm 188 } // namespace wm
192 } // namespace mash 189 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/window_manager_application.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698