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

Side by Side Diff: ash/mus/bridge/wm_shell_mus.cc

Issue 2194353002: mash: Migrate ScopedTargetRootWindow to //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: non-virtual Created 4 years, 4 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 | « ash/mus/bridge/wm_shell_mus.h ('k') | ash/root_window_controller.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 "ash/mus/bridge/wm_shell_mus.h" 5 #include "ash/mus/bridge/wm_shell_mus.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/accelerators/accelerator_controller.h" 9 #include "ash/common/accelerators/accelerator_controller.h"
10 #include "ash/common/display/display_info.h" 10 #include "ash/common/display/display_info.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 // static 150 // static
151 WmShellMus* WmShellMus::Get() { 151 WmShellMus* WmShellMus::Get() {
152 return static_cast<WmShellMus*>(WmShell::Get()); 152 return static_cast<WmShellMus*>(WmShell::Get());
153 } 153 }
154 154
155 void WmShellMus::AddRootWindowController( 155 void WmShellMus::AddRootWindowController(
156 WmRootWindowControllerMus* controller) { 156 WmRootWindowControllerMus* controller) {
157 root_window_controllers_.push_back(controller); 157 root_window_controllers_.push_back(controller);
158 // The first root window will be the initial root for new windows.
159 if (!GetRootWindowForNewWindows())
160 set_root_window_for_new_windows(controller->GetWindow());
158 } 161 }
159 162
160 void WmShellMus::RemoveRootWindowController( 163 void WmShellMus::RemoveRootWindowController(
161 WmRootWindowControllerMus* controller) { 164 WmRootWindowControllerMus* controller) {
162 auto iter = std::find(root_window_controllers_.begin(), 165 auto iter = std::find(root_window_controllers_.begin(),
163 root_window_controllers_.end(), controller); 166 root_window_controllers_.end(), controller);
164 DCHECK(iter != root_window_controllers_.end()); 167 DCHECK(iter != root_window_controllers_.end());
165 root_window_controllers_.erase(iter); 168 root_window_controllers_.erase(iter);
166 } 169 }
167 170
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 202 }
200 203
201 WmWindow* WmShellMus::GetPrimaryRootWindow() { 204 WmWindow* WmShellMus::GetPrimaryRootWindow() {
202 return root_window_controllers_[0]->GetWindow(); 205 return root_window_controllers_[0]->GetWindow();
203 } 206 }
204 207
205 WmWindow* WmShellMus::GetRootWindowForDisplayId(int64_t display_id) { 208 WmWindow* WmShellMus::GetRootWindowForDisplayId(int64_t display_id) {
206 return GetRootWindowControllerWithDisplayId(display_id)->GetWindow(); 209 return GetRootWindowControllerWithDisplayId(display_id)->GetWindow();
207 } 210 }
208 211
209 WmWindow* WmShellMus::GetRootWindowForNewWindows() {
210 NOTIMPLEMENTED();
211 return root_window_controllers_[0]->GetWindow();
212 }
213
214 const DisplayInfo& WmShellMus::GetDisplayInfo(int64_t display_id) const { 212 const DisplayInfo& WmShellMus::GetDisplayInfo(int64_t display_id) const {
215 NOTIMPLEMENTED(); 213 NOTIMPLEMENTED();
216 static DisplayInfo fake_info; 214 static DisplayInfo fake_info;
217 return fake_info; 215 return fake_info;
218 } 216 }
219 217
220 bool WmShellMus::IsActiveDisplayId(int64_t display_id) const { 218 bool WmShellMus::IsActiveDisplayId(int64_t display_id) const {
221 // TODO: implement http://crbug.com/622480. 219 // TODO: implement http://crbug.com/622480.
222 NOTIMPLEMENTED(); 220 NOTIMPLEMENTED();
223 return true; 221 return true;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 348
351 // static 349 // static
352 bool WmShellMus::IsActivationParent(ui::Window* window) { 350 bool WmShellMus::IsActivationParent(ui::Window* window) {
353 return window && IsActivatableShellWindowId( 351 return window && IsActivatableShellWindowId(
354 WmWindowMus::Get(window)->GetShellWindowId()); 352 WmWindowMus::Get(window)->GetShellWindowId());
355 } 353 }
356 354
357 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114. 355 // TODO: support OnAttemptToReactivateWindow, http://crbug.com/615114.
358 void WmShellMus::OnWindowTreeFocusChanged(ui::Window* gained_focus, 356 void WmShellMus::OnWindowTreeFocusChanged(ui::Window* gained_focus,
359 ui::Window* lost_focus) { 357 ui::Window* lost_focus) {
360 WmWindowMus* gained_active = GetToplevelAncestor(gained_focus); 358 WmWindow* gained_active = GetToplevelAncestor(gained_focus);
361 WmWindowMus* lost_active = GetToplevelAncestor(gained_focus); 359 if (gained_active)
360 set_root_window_for_new_windows(gained_active->GetRootWindow());
361
362 WmWindow* lost_active = GetToplevelAncestor(gained_focus);
362 if (gained_active == lost_active) 363 if (gained_active == lost_active)
363 return; 364 return;
364 365
365 FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_, 366 FOR_EACH_OBSERVER(WmActivationObserver, activation_observers_,
366 OnWindowActivated(gained_active, lost_active)); 367 OnWindowActivated(gained_active, lost_active));
367 } 368 }
368 369
369 void WmShellMus::OnDidDestroyClient(ui::WindowTreeClient* client) { 370 void WmShellMus::OnDidDestroyClient(ui::WindowTreeClient* client) {
370 DCHECK_EQ(window_tree_client(), client); 371 DCHECK_EQ(window_tree_client(), client);
371 client->RemoveObserver(this); 372 client->RemoveObserver(this);
372 } 373 }
373 374
374 } // namespace mus 375 } // namespace mus
375 } // namespace ash 376 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.h ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698