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

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

Issue 1835403002: Support additional mash shelf alignments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 "components/mus/public/cpp/event_matcher.h" 10 #include "components/mus/public/cpp/event_matcher.h"
11 #include "components/mus/public/cpp/window.h" 11 #include "components/mus/public/cpp/window.h"
12 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" 12 #include "components/mus/public/interfaces/window_manager_factory.mojom.h"
13 #include "mash/wm/accelerator_registrar_impl.h" 13 #include "mash/wm/accelerator_registrar_impl.h"
14 #include "mash/wm/root_window_controller.h" 14 #include "mash/wm/root_window_controller.h"
15 #include "mash/wm/root_windows_observer.h" 15 #include "mash/wm/root_windows_observer.h"
16 #include "mash/wm/shelf_layout.h"
16 #include "mash/wm/user_window_controller_impl.h" 17 #include "mash/wm/user_window_controller_impl.h"
17 #include "mojo/converters/input_events/input_events_type_converters.h" 18 #include "mojo/converters/input_events/input_events_type_converters.h"
18 #include "mojo/services/tracing/public/cpp/tracing_impl.h" 19 #include "mojo/services/tracing/public/cpp/tracing_impl.h"
19 #include "mojo/shell/public/cpp/connection.h" 20 #include "mojo/shell/public/cpp/connection.h"
20 #include "mojo/shell/public/cpp/connector.h" 21 #include "mojo/shell/public/cpp/connector.h"
21 #include "ui/events/event.h" 22 #include "ui/events/event.h"
22 #include "ui/mojo/init/ui_init.h" 23 #include "ui/mojo/init/ui_init.h"
23 #include "ui/views/mus/aura_init.h" 24 #include "ui/views/mus/aura_init.h"
24 #include "ui/views/mus/display_converter.h" 25 #include "ui/views/mus/display_converter.h"
25 26
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 64
64 void WindowManagerApplication::OnRootWindowControllerDoneInit( 65 void WindowManagerApplication::OnRootWindowControllerDoneInit(
65 RootWindowController* root_controller) { 66 RootWindowController* root_controller) {
66 // TODO(msw): figure out if this should be per display, or global. 67 // TODO(msw): figure out if this should be per display, or global.
67 user_window_controller_->Initialize(root_controller); 68 user_window_controller_->Initialize(root_controller);
68 for (auto& request : user_window_controller_requests_) 69 for (auto& request : user_window_controller_requests_)
69 user_window_controller_binding_.AddBinding(user_window_controller_.get(), 70 user_window_controller_binding_.AddBinding(user_window_controller_.get(),
70 std::move(*request)); 71 std::move(*request));
71 user_window_controller_requests_.clear(); 72 user_window_controller_requests_.clear();
72 73
74 LOG(ERROR) << "MSW OnRootWindowControllerDoneInit A";
75 // TODO(msw): figure out if this should be per display, or global.
76 if (root_controller == (*root_controllers_.begin())) {
77 LOG(ERROR) << "MSW OnRootWindowControllerDoneInit B";
78 ShelfLayout* shelf_layout = static_cast<ShelfLayout*>(
79 root_controller->GetLayoutManagerForContainer(
80 mash::wm::mojom::Container::USER_SHELF));
81 for (auto& request : shelf_layout_requests_) {
82 LOG(ERROR) << "MSW OnRootWindowControllerDoneInit C";
83 shelf_layout_binding_.AddBinding(shelf_layout, std::move(*request));
84 }
85 shelf_layout_requests_.clear();
86 }
87
73 FOR_EACH_OBSERVER(RootWindowsObserver, root_windows_observers_, 88 FOR_EACH_OBSERVER(RootWindowsObserver, root_windows_observers_,
74 OnRootWindowControllerAdded(root_controller)); 89 OnRootWindowControllerAdded(root_controller));
75 } 90 }
76 91
77 void WindowManagerApplication::OnRootWindowDestroyed( 92 void WindowManagerApplication::OnRootWindowDestroyed(
78 RootWindowController* root_controller) { 93 RootWindowController* root_controller) {
79 root_controllers_.erase(root_controller); 94 root_controllers_.erase(root_controller);
80 user_window_controller_.reset(nullptr); 95 user_window_controller_.reset(nullptr);
81 } 96 }
82 97
(...skipping 30 matching lines...) Expand all
113 128
114 mus::mojom::WindowManagerFactoryServicePtr wm_factory_service; 129 mus::mojom::WindowManagerFactoryServicePtr wm_factory_service;
115 connector_->ConnectToInterface("mojo:mus", &wm_factory_service); 130 connector_->ConnectToInterface("mojo:mus", &wm_factory_service);
116 wm_factory_service->SetWindowManagerFactory( 131 wm_factory_service->SetWindowManagerFactory(
117 window_manager_factory_binding_.CreateInterfacePtrAndBind()); 132 window_manager_factory_binding_.CreateInterfacePtrAndBind());
118 133
119 user_window_controller_.reset(new UserWindowControllerImpl()); 134 user_window_controller_.reset(new UserWindowControllerImpl());
120 } 135 }
121 136
122 bool WindowManagerApplication::AcceptConnection(mojo::Connection* connection) { 137 bool WindowManagerApplication::AcceptConnection(mojo::Connection* connection) {
123 connection->AddInterface<mash::wm::mojom::UserWindowController>(this); 138 connection->AddInterface<mojom::ShelfLayout>(this);
139 connection->AddInterface<mojom::UserWindowController>(this);
124 connection->AddInterface<mus::mojom::AcceleratorRegistrar>(this); 140 connection->AddInterface<mus::mojom::AcceleratorRegistrar>(this);
141 LOG(ERROR) << "MSW AcceptConn...? " << connection->GetRemoteIdentity().name();
125 if (connection->GetRemoteIdentity().name() == "mojo:mash_session") 142 if (connection->GetRemoteIdentity().name() == "mojo:mash_session")
126 connection->GetInterface(&session_); 143 connection->GetInterface(&session_);
127 return true; 144 return true;
128 } 145 }
129 146
130 void WindowManagerApplication::Create( 147 void WindowManagerApplication::Create(
131 mojo::Connection* connection, 148 mojo::Connection* connection,
132 mojo::InterfaceRequest<mash::wm::mojom::UserWindowController> request) { 149 mojo::InterfaceRequest<mojom::ShelfLayout> request) {
150 LOG(ERROR) << "MSW WindowManagerApplication::Create<ShelfLayout> A";
151 // TODO(msw): Handle multiple shelves (one per display).
152 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) {
153 LOG(ERROR) << "MSW WindowManagerApplication::Create<ShelfLayout> B";
154 ShelfLayout* shelf_layout = static_cast<ShelfLayout*>(
155 (*root_controllers_.begin())->GetLayoutManagerForContainer(
156 mash::wm::mojom::Container::USER_SHELF));
157 shelf_layout_binding_.AddBinding(shelf_layout, std::move(request));
158 } else {
159 // TODO(msw): We may not need this case??? (not sure...)
160 LOG(ERROR) << "MSW WindowManagerApplication::Create<ShelfLayout> C";
161 shelf_layout_requests_.push_back(make_scoped_ptr(
162 new mojo::InterfaceRequest<mojom::ShelfLayout>(std::move(request))));
163 }
164 }
165
166 void WindowManagerApplication::Create(
167 mojo::Connection* connection,
168 mojo::InterfaceRequest<mojom::UserWindowController> request) {
169 LOG(ERROR) << "MSW WindowManagerApplication::Create<UserWindowController> A";
133 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) { 170 if (!root_controllers_.empty() && (*root_controllers_.begin())->root()) {
134 user_window_controller_binding_.AddBinding(user_window_controller_.get(), 171 user_window_controller_binding_.AddBinding(user_window_controller_.get(),
135 std::move(request)); 172 std::move(request));
136 } else { 173 } else {
137 user_window_controller_requests_.push_back(make_scoped_ptr( 174 user_window_controller_requests_.push_back(make_scoped_ptr(
138 new mojo::InterfaceRequest<mash::wm::mojom::UserWindowController>( 175 new mojo::InterfaceRequest<mojom::UserWindowController>(
139 std::move(request)))); 176 std::move(request))));
140 } 177 }
141 } 178 }
142 179
143 void WindowManagerApplication::Create( 180 void WindowManagerApplication::Create(
144 mojo::Connection* connection, 181 mojo::Connection* connection,
145 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) { 182 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) {
146 static int accelerator_registrar_count = 0; 183 static int accelerator_registrar_count = 0;
147 if (accelerator_registrar_count == std::numeric_limits<int>::max()) { 184 if (accelerator_registrar_count == std::numeric_limits<int>::max()) {
148 // Restart from zero if we have reached the limit. It is technically 185 // Restart from zero if we have reached the limit. It is technically
(...skipping 11 matching lines...) Expand all
160 197
161 void WindowManagerApplication::CreateWindowManager( 198 void WindowManagerApplication::CreateWindowManager(
162 mus::mojom::DisplayPtr display, 199 mus::mojom::DisplayPtr display,
163 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) { 200 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> client_request) {
164 root_controllers_.insert(RootWindowController::CreateFromDisplay( 201 root_controllers_.insert(RootWindowController::CreateFromDisplay(
165 this, std::move(display), std::move(client_request))); 202 this, std::move(display), std::move(client_request)));
166 } 203 }
167 204
168 } // namespace wm 205 } // namespace wm
169 } // namespace mash 206 } // namespace mash
OLDNEW
« mash/wm/public/interfaces/shelf_layout.mojom ('K') | « mash/wm/window_manager_application.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698