| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 // windows in response to work area changes from window activation. | 385 // windows in response to work area changes from window activation. |
| 386 display::Screen::GetScreen()->RemoveObserver(this); | 386 display::Screen::GetScreen()->RemoveObserver(this); |
| 387 | 387 |
| 388 size_t remaining_items = 0; | 388 size_t remaining_items = 0; |
| 389 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { | 389 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { |
| 390 for (WindowSelectorItem* window_selector_item : window_grid->window_list()) | 390 for (WindowSelectorItem* window_selector_item : window_grid->window_list()) |
| 391 window_selector_item->RestoreWindow(); | 391 window_selector_item->RestoreWindow(); |
| 392 remaining_items += window_grid->size(); | 392 remaining_items += window_grid->size(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 // Setting focus after restoring windows' state avoids unnecessary animations. |
| 396 ResetFocusRestoreWindow(true); |
| 395 RemoveAllObservers(); | 397 RemoveAllObservers(); |
| 396 | 398 |
| 397 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows(); | 399 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows(); |
| 398 for (WmWindow* window : root_windows) { | 400 for (WmWindow* window : root_windows) { |
| 399 // Un-hide the callout widgets for panels. It is safe to call this for | 401 // Un-hide the callout widgets for panels. It is safe to call this for |
| 400 // root_windows that don't contain any panel windows. | 402 // root_windows that don't contain any panel windows. |
| 401 PanelLayoutManager::Get(window)->SetShowCalloutWidgets(true); | 403 PanelLayoutManager::Get(window)->SetShowCalloutWidgets(true); |
| 402 } | 404 } |
| 403 | 405 |
| 404 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) | 406 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) |
| 405 window_grid->Shutdown(); | 407 window_grid->Shutdown(); |
| 406 | 408 |
| 407 // Setting focus last so that: | |
| 408 // 1) DockeWindowLayoutManager uses the restored state to re-layout upon | |
| 409 // activation. | |
| 410 // 2) Any bounds change due to activation should not result in reposition. | |
| 411 ResetFocusRestoreWindow(true); | |
| 412 | |
| 413 DCHECK(num_items_ >= remaining_items); | 409 DCHECK(num_items_ >= remaining_items); |
| 414 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems", | 410 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems", |
| 415 num_items_ - remaining_items); | 411 num_items_ - remaining_items); |
| 416 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowSelector.TimeInOverview", | 412 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowSelector.TimeInOverview", |
| 417 base::Time::Now() - overview_start_time_); | 413 base::Time::Now() - overview_start_time_); |
| 418 | 414 |
| 419 // Record metrics related to text filtering. | 415 // Record metrics related to text filtering. |
| 420 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringStringLength", | 416 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringStringLength", |
| 421 text_filter_string_length_); | 417 text_filter_string_length_); |
| 422 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringTextfieldCleared", | 418 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringTextfieldCleared", |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 for (size_t i = 0; i <= grid_list_.size() && | 713 for (size_t i = 0; i <= grid_list_.size() && |
| 718 grid_list_[selected_grid_index_]->Move(direction, animate); | 714 grid_list_[selected_grid_index_]->Move(direction, animate); |
| 719 i++) { | 715 i++) { |
| 720 selected_grid_index_ = | 716 selected_grid_index_ = |
| 721 (selected_grid_index_ + display_direction + grid_list_.size()) % | 717 (selected_grid_index_ + display_direction + grid_list_.size()) % |
| 722 grid_list_.size(); | 718 grid_list_.size(); |
| 723 } | 719 } |
| 724 } | 720 } |
| 725 | 721 |
| 726 } // namespace ash | 722 } // namespace ash |
| OLD | NEW |