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

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

Issue 2244173006: Reset the focus after windows are restored, and grids are shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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 the restored state to re-layout upon
varkha 2016/08/16 22:38:35 nit: the the
oshima 2016/08/16 23:16:14 Done.
409 // activation.
410 // 2) Any bounds change due to activation should not result in repositioin.
varkha 2016/08/16 22:38:35 nit: typo - repositioin.
oshima 2016/08/16 23:16:14 Done.
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698