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); | |
397 RemoveAllObservers(); | 395 RemoveAllObservers(); |
398 | 396 |
399 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows(); | 397 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows(); |
400 for (WmWindow* window : root_windows) { | 398 for (WmWindow* window : root_windows) { |
401 // Un-hide the callout widgets for panels. It is safe to call this for | 399 // Un-hide the callout widgets for panels. It is safe to call this for |
402 // root_windows that don't contain any panel windows. | 400 // root_windows that don't contain any panel windows. |
403 PanelLayoutManager::Get(window)->SetShowCalloutWidgets(true); | 401 PanelLayoutManager::Get(window)->SetShowCalloutWidgets(true); |
404 } | 402 } |
405 | 403 |
406 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) | 404 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) |
407 window_grid->Shutdown(); | 405 window_grid->Shutdown(); |
408 | 406 |
| 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 |
409 DCHECK(num_items_ >= remaining_items); | 413 DCHECK(num_items_ >= remaining_items); |
410 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems", | 414 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems", |
411 num_items_ - remaining_items); | 415 num_items_ - remaining_items); |
412 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowSelector.TimeInOverview", | 416 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowSelector.TimeInOverview", |
413 base::Time::Now() - overview_start_time_); | 417 base::Time::Now() - overview_start_time_); |
414 | 418 |
415 // Record metrics related to text filtering. | 419 // Record metrics related to text filtering. |
416 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringStringLength", | 420 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringStringLength", |
417 text_filter_string_length_); | 421 text_filter_string_length_); |
418 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringTextfieldCleared", | 422 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringTextfieldCleared", |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 for (size_t i = 0; i <= grid_list_.size() && | 717 for (size_t i = 0; i <= grid_list_.size() && |
714 grid_list_[selected_grid_index_]->Move(direction, animate); | 718 grid_list_[selected_grid_index_]->Move(direction, animate); |
715 i++) { | 719 i++) { |
716 selected_grid_index_ = | 720 selected_grid_index_ = |
717 (selected_grid_index_ + display_direction + grid_list_.size()) % | 721 (selected_grid_index_ + display_direction + grid_list_.size()) % |
718 grid_list_.size(); | 722 grid_list_.size(); |
719 } | 723 } |
720 } | 724 } |
721 | 725 |
722 } // namespace ash | 726 } // namespace ash |
OLD | NEW |