| 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" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/wm/mru_window_tracker.h" | 12 #include "ash/wm/mru_window_tracker.h" |
| 13 #include "ash/wm/overview/window_overview.h" | 13 #include "ash/wm/overview/window_overview.h" |
| 14 #include "ash/wm/overview/window_selector_delegate.h" | 14 #include "ash/wm/overview/window_selector_delegate.h" |
| 15 #include "ash/wm/overview/window_selector_panels.h" | 15 #include "ash/wm/overview/window_selector_panels.h" |
| 16 #include "ash/wm/overview/window_selector_window.h" | 16 #include "ash/wm/overview/window_selector_window.h" |
| 17 #include "ash/wm/window_state.h" | 17 #include "ash/wm/window_state.h" |
| 18 #include "base/auto_reset.h" | 18 #include "base/auto_reset.h" |
| 19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| 20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
| 21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/timer/timer.h" | 22 #include "base/timer/timer.h" |
| 23 #include "ui/aura/client/activation_client.h" | 23 #include "ui/aura/client/activation_client.h" |
| 24 #include "ui/aura/client/focus_client.h" | 24 #include "ui/aura/client/focus_client.h" |
| 25 #include "ui/aura/root_window.h" | 25 #include "ui/aura/root_window.h" |
| 26 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| 27 #include "ui/aura/window_observer.h" | 27 #include "ui/aura/window_observer.h" |
| 28 #include "ui/events/event.h" | 28 #include "ui/events/event.h" |
| 29 #include "ui/events/event_handler.h" | 29 #include "ui/events/event_handler.h" |
| 30 #include "ui/views/corewm/transient_window_manager.h" |
| 30 | 31 |
| 31 namespace ash { | 32 namespace ash { |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 | 35 |
| 35 // The time from when the user pressed alt+tab while still holding alt before | 36 // The time from when the user pressed alt+tab while still holding alt before |
| 36 // overview is engaged. | 37 // overview is engaged. |
| 37 const int kOverviewDelayOnCycleMilliseconds = 10000; | 38 const int kOverviewDelayOnCycleMilliseconds = 10000; |
| 38 | 39 |
| 39 // If the delay before overview is less than or equal to this threshold the | 40 // If the delay before overview is less than or equal to this threshold the |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 } | 385 } |
| 385 | 386 |
| 386 void WindowSelector::OnWindowAdded(aura::Window* new_window) { | 387 void WindowSelector::OnWindowAdded(aura::Window* new_window) { |
| 387 if (new_window->type() != aura::client::WINDOW_TYPE_NORMAL && | 388 if (new_window->type() != aura::client::WINDOW_TYPE_NORMAL && |
| 388 new_window->type() != aura::client::WINDOW_TYPE_PANEL) { | 389 new_window->type() != aura::client::WINDOW_TYPE_PANEL) { |
| 389 return; | 390 return; |
| 390 } | 391 } |
| 391 | 392 |
| 392 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { | 393 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { |
| 393 if (new_window->parent()->id() == kSwitchableWindowContainerIds[i] && | 394 if (new_window->parent()->id() == kSwitchableWindowContainerIds[i] && |
| 394 !new_window->transient_parent()) { | 395 !views::corewm::GetTransientParent(new_window)) { |
| 395 // The new window is in one of the switchable containers, abort overview. | 396 // The new window is in one of the switchable containers, abort overview. |
| 396 CancelSelection(); | 397 CancelSelection(); |
| 397 return; | 398 return; |
| 398 } | 399 } |
| 399 } | 400 } |
| 400 } | 401 } |
| 401 | 402 |
| 402 void WindowSelector::OnWindowDestroying(aura::Window* window) { | 403 void WindowSelector::OnWindowDestroying(aura::Window* window) { |
| 403 ScopedVector<WindowSelectorItem>::iterator iter = | 404 ScopedVector<WindowSelectorItem>::iterator iter = |
| 404 std::find_if(windows_.begin(), windows_.end(), | 405 std::find_if(windows_.begin(), windows_.end(), |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 // If the window is in the observed_windows_ list it needs to continue to be | 506 // If the window is in the observed_windows_ list it needs to continue to be |
| 506 // observed. | 507 // observed. |
| 507 if (observed_windows_.find(restore_focus_window_) == | 508 if (observed_windows_.find(restore_focus_window_) == |
| 508 observed_windows_.end()) { | 509 observed_windows_.end()) { |
| 509 restore_focus_window_->RemoveObserver(this); | 510 restore_focus_window_->RemoveObserver(this); |
| 510 } | 511 } |
| 511 restore_focus_window_ = NULL; | 512 restore_focus_window_ = NULL; |
| 512 } | 513 } |
| 513 | 514 |
| 514 } // namespace ash | 515 } // namespace ash |
| OLD | NEW |