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

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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 384 // Stop observing screen metrics changes first to avoid auto-positioning
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
388 size_t remaining_items = 0;
389 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) {
390 for (WindowSelectorItem* window_selector_item : window_grid->window_list())
391 window_selector_item->RestoreWindow();
392 remaining_items += window_grid->size();
393 }
394
395 // Setting focus after restoring windows' state avoids unnecessary animations. 387 // Setting focus after restoring windows' state avoids unnecessary animations.
varkha 2016/08/15 23:09:25 This comment that I have added in https://coderevi
oshima 2016/08/16 17:40:03 Done.
396 ResetFocusRestoreWindow(true); 388 ResetFocusRestoreWindow(true);
397 RemoveAllObservers(); 389 RemoveAllObservers();
398 390
399 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows(); 391 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows();
400 for (WmWindow* window : root_windows) { 392 for (WmWindow* window : root_windows) {
401 // Un-hide the callout widgets for panels. It is safe to call this for 393 // Un-hide the callout widgets for panels. It is safe to call this for
402 // root_windows that don't contain any panel windows. 394 // root_windows that don't contain any panel windows.
403 PanelLayoutManager::Get(window)->SetShowCalloutWidgets(true); 395 PanelLayoutManager::Get(window)->SetShowCalloutWidgets(true);
404 } 396 }
405 397
406 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) 398 size_t remaining_items = 0;
399 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) {
400 for (WindowSelectorItem* window_selector_item : window_grid->window_list())
401 window_selector_item->RestoreWindow();
402 remaining_items += window_grid->size();
varkha 2016/08/15 23:09:25 Hmm. This seems right, I probably did the wrong th
oshima 2016/08/16 17:40:03 Thanks for the info. Looks like this has to be aft
407 window_grid->Shutdown(); 403 window_grid->Shutdown();
404 }
408 405
409 DCHECK(num_items_ >= remaining_items); 406 DCHECK(num_items_ >= remaining_items);
410 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems", 407 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems",
411 num_items_ - remaining_items); 408 num_items_ - remaining_items);
412 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowSelector.TimeInOverview", 409 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowSelector.TimeInOverview",
413 base::Time::Now() - overview_start_time_); 410 base::Time::Now() - overview_start_time_);
414 411
415 // Record metrics related to text filtering. 412 // Record metrics related to text filtering.
416 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringStringLength", 413 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringStringLength",
417 text_filter_string_length_); 414 text_filter_string_length_);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 for (size_t i = 0; i <= grid_list_.size() && 710 for (size_t i = 0; i <= grid_list_.size() &&
714 grid_list_[selected_grid_index_]->Move(direction, animate); 711 grid_list_[selected_grid_index_]->Move(direction, animate);
715 i++) { 712 i++) {
716 selected_grid_index_ = 713 selected_grid_index_ =
717 (selected_grid_index_ + display_direction + grid_list_.size()) % 714 (selected_grid_index_ + display_direction + grid_list_.size()) %
718 grid_list_.size(); 715 grid_list_.size();
719 } 716 }
720 } 717 }
721 718
722 } // namespace ash 719 } // 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