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

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

Issue 1725353003: Eliminate mojo::Shell client lib class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@15connector
Patch Set: . Created 4 years, 10 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/root_window_controller.h ('k') | mash/wm/window_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/root_window_controller.h" 5 #include "mash/wm/root_window_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "components/mus/common/util.h" 10 #include "components/mus/common/util.h"
11 #include "components/mus/public/cpp/event_matcher.h" 11 #include "components/mus/public/cpp/event_matcher.h"
12 #include "components/mus/public/cpp/window.h" 12 #include "components/mus/public/cpp/window.h"
13 #include "components/mus/public/cpp/window_tree_connection.h" 13 #include "components/mus/public/cpp/window_tree_connection.h"
14 #include "components/mus/public/cpp/window_tree_host_factory.h" 14 #include "components/mus/public/cpp/window_tree_host_factory.h"
15 #include "mash/shell/public/interfaces/shell.mojom.h" 15 #include "mash/shell/public/interfaces/shell.mojom.h"
16 #include "mash/wm/background_layout.h" 16 #include "mash/wm/background_layout.h"
17 #include "mash/wm/fill_layout.h" 17 #include "mash/wm/fill_layout.h"
18 #include "mash/wm/screenlock_layout.h" 18 #include "mash/wm/screenlock_layout.h"
19 #include "mash/wm/shadow_controller.h" 19 #include "mash/wm/shadow_controller.h"
20 #include "mash/wm/shelf_layout.h" 20 #include "mash/wm/shelf_layout.h"
21 #include "mash/wm/window_layout.h" 21 #include "mash/wm/window_layout.h"
22 #include "mash/wm/window_manager.h" 22 #include "mash/wm/window_manager.h"
23 #include "mash/wm/window_manager_application.h" 23 #include "mash/wm/window_manager_application.h"
24 #include "mojo/shell/public/cpp/shell.h" 24 #include "mojo/shell/public/cpp/connector.h"
25 25
26 namespace mash { 26 namespace mash {
27 namespace wm { 27 namespace wm {
28 namespace { 28 namespace {
29 29
30 const uint32_t kWindowSwitchAccelerator = 1; 30 const uint32_t kWindowSwitchAccelerator = 1;
31 31
32 void AssertTrue(bool success) { 32 void AssertTrue(bool success) {
33 DCHECK(success); 33 DCHECK(success);
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 // static 38 // static
39 RootWindowController* RootWindowController::CreateUsingWindowTreeHost( 39 RootWindowController* RootWindowController::CreateUsingWindowTreeHost(
40 WindowManagerApplication* app) { 40 WindowManagerApplication* app) {
41 RootWindowController* controller = new RootWindowController(app); 41 RootWindowController* controller = new RootWindowController(app);
42 mus::CreateWindowTreeHost(app->shell(), controller, 42 mus::CreateWindowTreeHost(app->connector(), controller,
43 &controller->window_tree_host_, 43 &controller->window_tree_host_,
44 controller->window_manager_.get()); 44 controller->window_manager_.get());
45 return controller; 45 return controller;
46 } 46 }
47 47
48 // static 48 // static
49 RootWindowController* RootWindowController::CreateFromDisplay( 49 RootWindowController* RootWindowController::CreateFromDisplay(
50 WindowManagerApplication* app, 50 WindowManagerApplication* app,
51 mus::mojom::DisplayPtr display, 51 mus::mojom::DisplayPtr display,
52 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) { 52 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) {
53 RootWindowController* controller = new RootWindowController(app); 53 RootWindowController* controller = new RootWindowController(app);
54 controller->display_ = std::move(display); 54 controller->display_ = std::move(display);
55 mus::WindowTreeConnection::CreateForWindowManager( 55 mus::WindowTreeConnection::CreateForWindowManager(
56 controller, std::move(client_request), 56 controller, std::move(client_request),
57 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED, 57 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED,
58 controller->window_manager_.get()); 58 controller->window_manager_.get());
59 return controller; 59 return controller;
60 } 60 }
61 61
62 void RootWindowController::Destroy() { 62 void RootWindowController::Destroy() {
63 // See class description for details on lifetime. 63 // See class description for details on lifetime.
64 if (root_) { 64 if (root_) {
65 delete root_->connection(); 65 delete root_->connection();
66 } else { 66 } else {
67 // This case only happens if we're destroyed before OnEmbed(). 67 // This case only happens if we're destroyed before OnEmbed().
68 delete this; 68 delete this;
69 } 69 }
70 } 70 }
71 71
72 mojo::Shell* RootWindowController::GetShell() { 72 mojo::Connector* RootWindowController::GetConnector() {
73 return app_->shell(); 73 return app_->connector();
74 } 74 }
75 75
76 mus::Window* RootWindowController::GetWindowForContainer( 76 mus::Window* RootWindowController::GetWindowForContainer(
77 mojom::Container container) { 77 mojom::Container container) {
78 const mus::Id window_id = root_->connection()->GetConnectionId() << 16 | 78 const mus::Id window_id = root_->connection()->GetConnectionId() << 16 |
79 static_cast<uint16_t>(container); 79 static_cast<uint16_t>(container);
80 return root_->GetChildById(window_id); 80 return root_->GetChildById(window_id);
81 } 81 }
82 82
83 mus::Window* RootWindowController::GetWindowById(mus::Id id) { 83 mus::Window* RootWindowController::GetWindowById(mus::Id id) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 layout_manager_[user_shelf].reset(new ShelfLayout(user_shelf)); 138 layout_manager_[user_shelf].reset(new ShelfLayout(user_shelf));
139 139
140 mus::Window* window = GetWindowForContainer(mojom::Container::USER_WINDOWS); 140 mus::Window* window = GetWindowForContainer(mojom::Container::USER_WINDOWS);
141 layout_manager_[window].reset(new WindowLayout(window)); 141 layout_manager_[window].reset(new WindowLayout(window));
142 window_manager_client()->AddActivationParent(window); 142 window_manager_client()->AddActivationParent(window);
143 window_tree_host_->SetTitle("Mash"); 143 window_tree_host_->SetTitle("Mash");
144 144
145 AddAccelerators(); 145 AddAccelerators();
146 146
147 mash::shell::mojom::ShellPtr shell; 147 mash::shell::mojom::ShellPtr shell;
148 app_->shell()->ConnectToInterface("mojo:mash_shell", &shell); 148 app_->connector()->ConnectToInterface("mojo:mash_shell", &shell);
149 window_manager_->Initialize(this, std::move(shell)); 149 window_manager_->Initialize(this, std::move(shell));
150 150
151 shadow_controller_.reset(new ShadowController(root->connection())); 151 shadow_controller_.reset(new ShadowController(root->connection()));
152 152
153 app_->OnRootWindowControllerDoneInit(this); 153 app_->OnRootWindowControllerDoneInit(this);
154 } 154 }
155 155
156 void RootWindowController::OnConnectionLost( 156 void RootWindowController::OnConnectionLost(
157 mus::WindowTreeConnection* connection) { 157 mus::WindowTreeConnection* connection) {
158 shadow_controller_.reset(); 158 shadow_controller_.reset();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 mojom::Container::LOGIN_WINDOWS); 209 mojom::Container::LOGIN_WINDOWS);
210 CreateContainer(mojom::Container::SYSTEM_MODAL_WINDOWS, 210 CreateContainer(mojom::Container::SYSTEM_MODAL_WINDOWS,
211 mojom::Container::ROOT); 211 mojom::Container::ROOT);
212 CreateContainer(mojom::Container::KEYBOARD, mojom::Container::ROOT); 212 CreateContainer(mojom::Container::KEYBOARD, mojom::Container::ROOT);
213 CreateContainer(mojom::Container::MENUS, mojom::Container::ROOT); 213 CreateContainer(mojom::Container::MENUS, mojom::Container::ROOT);
214 CreateContainer(mojom::Container::TOOLTIPS, mojom::Container::ROOT); 214 CreateContainer(mojom::Container::TOOLTIPS, mojom::Container::ROOT);
215 } 215 }
216 216
217 } // namespace wm 217 } // namespace wm
218 } // namespace mash 218 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/root_window_controller.h ('k') | mash/wm/window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698