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/window_util.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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 394 } |
394 | 395 |
395 void WindowSelector::OnWindowAdded(aura::Window* new_window) { | 396 void WindowSelector::OnWindowAdded(aura::Window* new_window) { |
396 if (new_window->type() != ui::wm::WINDOW_TYPE_NORMAL && | 397 if (new_window->type() != ui::wm::WINDOW_TYPE_NORMAL && |
397 new_window->type() != ui::wm::WINDOW_TYPE_PANEL) { | 398 new_window->type() != ui::wm::WINDOW_TYPE_PANEL) { |
398 return; | 399 return; |
399 } | 400 } |
400 | 401 |
401 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { | 402 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { |
402 if (new_window->parent()->id() == kSwitchableWindowContainerIds[i] && | 403 if (new_window->parent()->id() == kSwitchableWindowContainerIds[i] && |
403 !new_window->transient_parent()) { | 404 !views::corewm::GetTransientParent(new_window)) { |
404 // The new window is in one of the switchable containers, abort overview. | 405 // The new window is in one of the switchable containers, abort overview. |
405 CancelSelection(); | 406 CancelSelection(); |
406 return; | 407 return; |
407 } | 408 } |
408 } | 409 } |
409 } | 410 } |
410 | 411 |
411 void WindowSelector::OnWindowDestroying(aura::Window* window) { | 412 void WindowSelector::OnWindowDestroying(aura::Window* window) { |
412 // window is one of a container, the restore_focus_window and/or | 413 // window is one of a container, the restore_focus_window and/or |
413 // one of the selectable windows in overview. | 414 // one of the selectable windows in overview. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // If the window is in the observed_windows_ list it needs to continue to be | 513 // If the window is in the observed_windows_ list it needs to continue to be |
513 // observed. | 514 // observed. |
514 if (observed_windows_.find(restore_focus_window_) == | 515 if (observed_windows_.find(restore_focus_window_) == |
515 observed_windows_.end()) { | 516 observed_windows_.end()) { |
516 restore_focus_window_->RemoveObserver(this); | 517 restore_focus_window_->RemoveObserver(this); |
517 } | 518 } |
518 restore_focus_window_ = NULL; | 519 restore_focus_window_ = NULL; |
519 } | 520 } |
520 | 521 |
521 } // namespace ash | 522 } // namespace ash |
OLD | NEW |