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

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

Issue 2225683005: [ash-md] Prevents auto-positioning after cancelling overview (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 | « ash/common/wm/overview/window_selector.h ('k') | 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 restore_focus_window_(WmShell::Get()->GetFocusedWindow()), 278 restore_focus_window_(WmShell::Get()->GetFocusedWindow()),
279 ignore_activations_(false), 279 ignore_activations_(false),
280 selected_grid_index_(0), 280 selected_grid_index_(0),
281 overview_start_time_(base::Time::Now()), 281 overview_start_time_(base::Time::Now()),
282 num_key_presses_(0), 282 num_key_presses_(0),
283 num_items_(0), 283 num_items_(0),
284 showing_selection_widget_(false), 284 showing_selection_widget_(false),
285 text_filter_string_length_(0), 285 text_filter_string_length_(0),
286 num_times_textfield_cleared_(0), 286 num_times_textfield_cleared_(0),
287 restoring_minimized_windows_(false), 287 restoring_minimized_windows_(false),
288 text_filter_bottom_(0) { 288 text_filter_bottom_(0),
289 shutting_down_(false) {
289 DCHECK(delegate_); 290 DCHECK(delegate_);
290 } 291 }
291 292
292 WindowSelector::~WindowSelector() { 293 WindowSelector::~WindowSelector() {
293 RemoveAllObservers(); 294 RemoveAllObservers();
294 } 295 }
295 296
296 // NOTE: The work done in Init() is not done in the constructor because it may 297 // NOTE: The work done in Init() is not done in the constructor because it may
297 // cause other, unrelated classes, (ie PanelLayoutManager) to make indirect 298 // cause other, unrelated classes, (ie PanelLayoutManager) to make indirect
298 // calls to restoring_minimized_windows() on a partially constructed object. 299 // calls to restoring_minimized_windows() on a partially constructed object.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 WmShell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( 375 WmShell::Get()->accessibility_delegate()->TriggerAccessibilityAlert(
375 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); 376 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED);
376 377
377 UpdateShelfVisibility(); 378 UpdateShelfVisibility();
378 } 379 }
379 380
380 // NOTE: The work done in Shutdown() is not done in the destructor because it 381 // 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 382 // may cause other, unrelated classes, (ie PanelLayoutManager) to make indirect
382 // calls to restoring_minimized_windows() on a partially destructed object. 383 // calls to restoring_minimized_windows() on a partially destructed object.
383 void WindowSelector::Shutdown() { 384 void WindowSelector::Shutdown() {
385 shutting_down_ = true;
oshima 2016/08/08 22:47:37 can we just remove observer?
varkha 2016/08/08 23:45:35 Yes, I considered this before but thought for some
384 size_t remaining_items = 0; 386 size_t remaining_items = 0;
385 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { 387 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) {
386 for (WindowSelectorItem* window_selector_item : window_grid->window_list()) 388 for (WindowSelectorItem* window_selector_item : window_grid->window_list())
387 window_selector_item->RestoreWindow(); 389 window_selector_item->RestoreWindow();
388 remaining_items += window_grid->size(); 390 remaining_items += window_grid->size();
389 } 391 }
390 392
391 // Setting focus after restoring windows' state avoids unnecessary animations. 393 // Setting focus after restoring windows' state avoids unnecessary animations.
392 ResetFocusRestoreWindow(true); 394 ResetFocusRestoreWindow(true);
393 RemoveAllObservers(); 395 RemoveAllObservers();
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 548
547 void WindowSelector::OnDisplayAdded(const display::Display& display) {} 549 void WindowSelector::OnDisplayAdded(const display::Display& display) {}
548 550
549 void WindowSelector::OnDisplayRemoved(const display::Display& display) { 551 void WindowSelector::OnDisplayRemoved(const display::Display& display) {
550 // TODO(flackr): Keep window selection active on remaining displays. 552 // TODO(flackr): Keep window selection active on remaining displays.
551 CancelSelection(); 553 CancelSelection();
552 } 554 }
553 555
554 void WindowSelector::OnDisplayMetricsChanged(const display::Display& display, 556 void WindowSelector::OnDisplayMetricsChanged(const display::Display& display,
555 uint32_t metrics) { 557 uint32_t metrics) {
556 // If only the work area changes, there is no need to reposition windows in 558 if (shutting_down_)
557 // overview. 559 return;
558 if (metrics != DISPLAY_METRIC_WORK_AREA) { 560 PositionWindows(/* animate */ false);
559 PositionWindows(/* animate */ false); 561 RepositionTextFilterOnDisplayMetricsChange();
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
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
OLDNEW
« no previous file with comments | « ash/common/wm/overview/window_selector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698