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

Side by Side Diff: ash/wm/overview/window_selector.cc

Issue 1923983003: Makes WorkspaceLayoutManager use ash/wm/common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix always-on-top and remove mus changes 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/wm/overview/window_selector.h" 5 #include "ash/wm/overview/window_selector.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/accessibility_delegate.h" 13 #include "ash/accessibility_delegate.h"
14 #include "ash/ash_switches.h" 14 #include "ash/ash_switches.h"
15 #include "ash/metrics/user_metrics_recorder.h" 15 #include "ash/metrics/user_metrics_recorder.h"
16 #include "ash/root_window_controller.h" 16 #include "ash/root_window_controller.h"
17 #include "ash/shell.h" 17 #include "ash/shell.h"
18 #include "ash/shell_window_ids.h" 18 #include "ash/shell_window_ids.h"
19 #include "ash/switchable_windows.h"
20 #include "ash/wm/aura/wm_window_aura.h" 19 #include "ash/wm/aura/wm_window_aura.h"
20 #include "ash/wm/common/switchable_windows.h"
21 #include "ash/wm/common/window_state.h" 21 #include "ash/wm/common/window_state.h"
22 #include "ash/wm/mru_window_tracker.h" 22 #include "ash/wm/mru_window_tracker.h"
23 #include "ash/wm/overview/window_grid.h" 23 #include "ash/wm/overview/window_grid.h"
24 #include "ash/wm/overview/window_selector_delegate.h" 24 #include "ash/wm/overview/window_selector_delegate.h"
25 #include "ash/wm/overview/window_selector_item.h" 25 #include "ash/wm/overview/window_selector_item.h"
26 #include "ash/wm/panels/panel_layout_manager.h" 26 #include "ash/wm/panels/panel_layout_manager.h"
27 #include "ash/wm/window_state_aura.h" 27 #include "ash/wm/window_state_aura.h"
28 #include "ash/wm/window_util.h" 28 #include "ash/wm/window_util.h"
29 #include "base/auto_reset.h" 29 #include "base/auto_reset.h"
30 #include "base/command_line.h" 30 #include "base/command_line.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // if you have 3 or more monitors which are not strictly 263 // if you have 3 or more monitors which are not strictly
264 // horizontal or vertical but that case is not yet supported. 264 // horizontal or vertical but that case is not yet supported.
265 return (a->GetBoundsInScreen().x() + a->GetBoundsInScreen().y()) < 265 return (a->GetBoundsInScreen().x() + a->GetBoundsInScreen().y()) <
266 (b->GetBoundsInScreen().x() + b->GetBoundsInScreen().y()); 266 (b->GetBoundsInScreen().x() + b->GetBoundsInScreen().y());
267 }); 267 });
268 268
269 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); 269 for (aura::Window::Windows::const_iterator iter = root_windows.begin();
270 iter != root_windows.end(); iter++) { 270 iter != root_windows.end(); iter++) {
271 // Observed switchable containers for newly created windows on all root 271 // Observed switchable containers for newly created windows on all root
272 // windows. 272 // windows.
273 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { 273 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) {
274 aura::Window* container = Shell::GetContainer(*iter, 274 aura::Window* container =
275 kSwitchableWindowContainerIds[i]); 275 Shell::GetContainer(*iter, wm::kSwitchableWindowContainerIds[i]);
276 container->AddObserver(this); 276 container->AddObserver(this);
277 observed_windows_.insert(container); 277 observed_windows_.insert(container);
278 } 278 }
279 279
280 // Hide the callout widgets for panels. It is safe to call this for 280 // Hide the callout widgets for panels. It is safe to call this for
281 // root windows that don't contain any panel windows. 281 // root windows that don't contain any panel windows.
282 PanelLayoutManager::Get(wm::WmWindowAura::Get(*iter)) 282 PanelLayoutManager::Get(wm::WmWindowAura::Get(*iter))
283 ->SetShowCalloutWidgets(false); 283 ->SetShowCalloutWidgets(false);
284 284
285 std::unique_ptr<WindowGrid> grid(new WindowGrid(*iter, windows, this)); 285 std::unique_ptr<WindowGrid> grid(new WindowGrid(*iter, windows, this));
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 void WindowSelector::OnDisplayMetricsChanged(const display::Display& display, 479 void WindowSelector::OnDisplayMetricsChanged(const display::Display& display,
480 uint32_t metrics) { 480 uint32_t metrics) {
481 PositionWindows(/* animate */ false); 481 PositionWindows(/* animate */ false);
482 RepositionTextFilterOnDisplayMetricsChange(); 482 RepositionTextFilterOnDisplayMetricsChange();
483 } 483 }
484 484
485 void WindowSelector::OnWindowAdded(aura::Window* new_window) { 485 void WindowSelector::OnWindowAdded(aura::Window* new_window) {
486 if (!IsSelectable(new_window)) 486 if (!IsSelectable(new_window))
487 return; 487 return;
488 488
489 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { 489 for (size_t i = 0; i < wm::kSwitchableWindowContainerIdsLength; ++i) {
490 if (new_window->parent()->id() == kSwitchableWindowContainerIds[i] && 490 if (new_window->parent()->id() == wm::kSwitchableWindowContainerIds[i] &&
491 !::wm::GetTransientParent(new_window)) { 491 !::wm::GetTransientParent(new_window)) {
492 // The new window is in one of the switchable containers, abort overview. 492 // The new window is in one of the switchable containers, abort overview.
493 CancelSelection(); 493 CancelSelection();
494 return; 494 return;
495 } 495 }
496 } 496 }
497 } 497 }
498 498
499 void WindowSelector::OnWindowDestroying(aura::Window* window) { 499 void WindowSelector::OnWindowDestroying(aura::Window* window) {
500 window->RemoveObserver(this); 500 window->RemoveObserver(this);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 for (size_t i = 0; 634 for (size_t i = 0;
635 i <= grid_list_.size() && 635 i <= grid_list_.size() &&
636 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { 636 grid_list_[selected_grid_index_]->Move(direction, animate); i++) {
637 selected_grid_index_ = 637 selected_grid_index_ =
638 (selected_grid_index_ + display_direction + grid_list_.size()) % 638 (selected_grid_index_ + display_direction + grid_list_.size()) %
639 grid_list_.size(); 639 grid_list_.size();
640 } 640 }
641 } 641 }
642 642
643 } // namespace ash 643 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698