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/wm/overview/window_selector.h" | 5 #include "ash/wm/overview/window_selector.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 ResetFocusRestoreWindow(false); | 379 ResetFocusRestoreWindow(false); |
380 if (showing_window_ && showing_window_->window() == window) | 380 if (showing_window_ && showing_window_->window() == window) |
381 showing_window_->CancelRestore(); | 381 showing_window_->CancelRestore(); |
382 ScopedVector<WindowSelectorItem>::iterator iter = | 382 ScopedVector<WindowSelectorItem>::iterator iter = |
383 std::find_if(windows_.begin(), windows_.end(), | 383 std::find_if(windows_.begin(), windows_.end(), |
384 WindowSelectorItemTargetComparator(window)); | 384 WindowSelectorItemTargetComparator(window)); |
385 DCHECK(iter != windows_.end()); | 385 DCHECK(iter != windows_.end()); |
386 // The selected window should not be minimized when window selection is | 386 // The selected window should not be minimized when window selection is |
387 // ended. | 387 // ended. |
388 (*iter)->RestoreWindowOnExit(window); | 388 (*iter)->RestoreWindowOnExit(window); |
| 389 // The selected window will be activated, this activation should be ignored. |
| 390 // After selecting the window, this object will be deleted so we just set |
| 391 // ignore_activations_ rather than using AutoReset which would attempt to |
| 392 // change the value back after deleting this WindowSelector. |
| 393 ignore_activations_ = true; |
389 delegate_->OnWindowSelected(window); | 394 delegate_->OnWindowSelected(window); |
390 } | 395 } |
391 | 396 |
392 void WindowSelector::CancelSelection() { | 397 void WindowSelector::CancelSelection() { |
393 delegate_->OnSelectionCanceled(); | 398 delegate_->OnSelectionCanceled(); |
394 } | 399 } |
395 | 400 |
396 void WindowSelector::OnWindowAdded(aura::Window* new_window) { | 401 void WindowSelector::OnWindowAdded(aura::Window* new_window) { |
397 if (new_window->type() != ui::wm::WINDOW_TYPE_NORMAL && | 402 if (new_window->type() != ui::wm::WINDOW_TYPE_NORMAL && |
398 new_window->type() != ui::wm::WINDOW_TYPE_PANEL) { | 403 new_window->type() != ui::wm::WINDOW_TYPE_PANEL) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 // If the window is in the observed_windows_ list it needs to continue to be | 518 // If the window is in the observed_windows_ list it needs to continue to be |
514 // observed. | 519 // observed. |
515 if (observed_windows_.find(restore_focus_window_) == | 520 if (observed_windows_.find(restore_focus_window_) == |
516 observed_windows_.end()) { | 521 observed_windows_.end()) { |
517 restore_focus_window_->RemoveObserver(this); | 522 restore_focus_window_->RemoveObserver(this); |
518 } | 523 } |
519 restore_focus_window_ = NULL; | 524 restore_focus_window_ = NULL; |
520 } | 525 } |
521 | 526 |
522 } // namespace ash | 527 } // namespace ash |
OLD | NEW |