Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/common/wm/overview/window_selector.h" | 5 #include "ash/common/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> |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 WmShell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( | 374 WmShell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( |
| 375 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); | 375 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); |
| 376 | 376 |
| 377 UpdateShelfVisibility(); | 377 UpdateShelfVisibility(); |
| 378 } | 378 } |
| 379 | 379 |
| 380 // NOTE: The work done in Shutdown() is not done in the destructor because it | 380 // NOTE: The work done in Shutdown() is not done in the destructor because it |
| 381 // may cause other, unrelated classes, (ie PanelLayoutManager) to make indirect | 381 // may cause other, unrelated classes, (ie PanelLayoutManager) to make indirect |
| 382 // calls to restoring_minimized_windows() on a partially destructed object. | 382 // calls to restoring_minimized_windows() on a partially destructed object. |
| 383 void WindowSelector::Shutdown() { | 383 void WindowSelector::Shutdown() { |
| 384 // Stop observing screen metrics changes first to avoid auto-positioning | |
| 385 // windows in response to work area changes from window activation. | |
| 386 display::Screen::GetScreen()->RemoveObserver(this); | |
| 387 | |
| 384 size_t remaining_items = 0; | 388 size_t remaining_items = 0; |
| 385 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { | 389 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { |
| 386 for (WindowSelectorItem* window_selector_item : window_grid->window_list()) | 390 for (WindowSelectorItem* window_selector_item : window_grid->window_list()) |
| 387 window_selector_item->RestoreWindow(); | 391 window_selector_item->RestoreWindow(); |
| 388 remaining_items += window_grid->size(); | 392 remaining_items += window_grid->size(); |
| 389 } | 393 } |
| 390 | 394 |
| 391 // Setting focus after restoring windows' state avoids unnecessary animations. | 395 // Setting focus after restoring windows' state avoids unnecessary animations. |
| 392 ResetFocusRestoreWindow(true); | 396 ResetFocusRestoreWindow(true); |
| 393 RemoveAllObservers(); | 397 RemoveAllObservers(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 | 550 |
| 547 void WindowSelector::OnDisplayAdded(const display::Display& display) {} | 551 void WindowSelector::OnDisplayAdded(const display::Display& display) {} |
| 548 | 552 |
| 549 void WindowSelector::OnDisplayRemoved(const display::Display& display) { | 553 void WindowSelector::OnDisplayRemoved(const display::Display& display) { |
| 550 // TODO(flackr): Keep window selection active on remaining displays. | 554 // TODO(flackr): Keep window selection active on remaining displays. |
| 551 CancelSelection(); | 555 CancelSelection(); |
| 552 } | 556 } |
| 553 | 557 |
| 554 void WindowSelector::OnDisplayMetricsChanged(const display::Display& display, | 558 void WindowSelector::OnDisplayMetricsChanged(const display::Display& display, |
| 555 uint32_t metrics) { | 559 uint32_t metrics) { |
| 556 // If only the work area changes, there is no need to reposition windows in | 560 PositionWindows(/* animate */ false); |
| 557 // overview. | 561 RepositionTextFilterOnDisplayMetricsChange(); |
| 558 if (metrics != DISPLAY_METRIC_WORK_AREA) { | |
|
oshima
2016/08/09 10:59:56
Note that we used to ignore work area only metrics
varkha
2016/08/09 13:13:39
Yes, this callback is here to position windows and
| |
| 559 PositionWindows(/* animate */ false); | |
| 560 RepositionTextFilterOnDisplayMetricsChange(); | |
| 561 } | |
| 562 } | 562 } |
| 563 | 563 |
| 564 void WindowSelector::OnWindowTreeChanged(WmWindow* window, | 564 void WindowSelector::OnWindowTreeChanged(WmWindow* window, |
| 565 const TreeChangeParams& params) { | 565 const TreeChangeParams& params) { |
| 566 // Only care about newly added children of |observed_windows_|. | 566 // Only care about newly added children of |observed_windows_|. |
| 567 if (!observed_windows_.count(window) || | 567 if (!observed_windows_.count(window) || |
| 568 !observed_windows_.count(params.new_parent)) { | 568 !observed_windows_.count(params.new_parent)) { |
| 569 return; | 569 return; |
| 570 } | 570 } |
| 571 | 571 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 713 for (size_t i = 0; i <= grid_list_.size() && | 713 for (size_t i = 0; i <= grid_list_.size() && |
| 714 grid_list_[selected_grid_index_]->Move(direction, animate); | 714 grid_list_[selected_grid_index_]->Move(direction, animate); |
| 715 i++) { | 715 i++) { |
| 716 selected_grid_index_ = | 716 selected_grid_index_ = |
| 717 (selected_grid_index_ + display_direction + grid_list_.size()) % | 717 (selected_grid_index_ + display_direction + grid_list_.size()) % |
| 718 grid_list_.size(); | 718 grid_list_.size(); |
| 719 } | 719 } |
| 720 } | 720 } |
| 721 | 721 |
| 722 } // namespace ash | 722 } // namespace ash |
| OLD | NEW |