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/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/mru_window_tracker.h" | 10 #include "ash/wm/mru_window_tracker.h" |
11 #include "ash/wm/overview/window_overview.h" | 11 #include "ash/wm/overview/window_overview.h" |
12 #include "ash/wm/overview/window_selector_delegate.h" | 12 #include "ash/wm/overview/window_selector_delegate.h" |
13 #include "ash/wm/overview/window_selector_panels.h" | 13 #include "ash/wm/overview/window_selector_panels.h" |
14 #include "ash/wm/overview/window_selector_window.h" | 14 #include "ash/wm/overview/window_selector_window.h" |
15 #include "ash/wm/window_settings.h" | 15 #include "ash/wm/window_settings.h" |
16 #include "base/auto_reset.h" | 16 #include "base/auto_reset.h" |
| 17 #include "base/metrics/histogram.h" |
17 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
18 #include "ui/aura/client/activation_client.h" | 19 #include "ui/aura/client/activation_client.h" |
19 #include "ui/aura/client/focus_client.h" | 20 #include "ui/aura/client/focus_client.h" |
20 #include "ui/aura/root_window.h" | 21 #include "ui/aura/root_window.h" |
21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
22 #include "ui/events/event.h" | 23 #include "ui/events/event.h" |
23 #include "ui/events/event_handler.h" | 24 #include "ui/events/event_handler.h" |
24 | 25 |
25 namespace ash { | 26 namespace ash { |
26 | 27 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 windows_.push_back(panels_item); | 126 windows_.push_back(panels_item); |
126 } else { | 127 } else { |
127 panels_item = *iter; | 128 panels_item = *iter; |
128 } | 129 } |
129 panels_item->AddWindow(windows[i]); | 130 panels_item->AddWindow(windows[i]); |
130 } else { | 131 } else { |
131 windows_.push_back(new WindowSelectorWindow(windows[i])); | 132 windows_.push_back(new WindowSelectorWindow(windows[i])); |
132 } | 133 } |
133 } | 134 } |
134 RemoveFocusAndSetRestoreWindow(); | 135 RemoveFocusAndSetRestoreWindow(); |
| 136 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", windows_.size()); |
135 | 137 |
136 // Observe window activations and switchable containers on all root windows | 138 // Observe window activations and switchable containers on all root windows |
137 // for newly created windows during overview. | 139 // for newly created windows during overview. |
138 Shell::GetInstance()->activation_client()->AddObserver(this); | 140 Shell::GetInstance()->activation_client()->AddObserver(this); |
139 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 141 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
140 for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); | 142 for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
141 iter != root_windows.end(); ++iter) { | 143 iter != root_windows.end(); ++iter) { |
142 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { | 144 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { |
143 Shell::GetContainer(*iter, | 145 Shell::GetContainer(*iter, |
144 kSwitchableWindowContainerIds[i])->AddObserver(this); | 146 kSwitchableWindowContainerIds[i])->AddObserver(this); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 // If the window is in the observed_windows_ list it needs to continue to be | 310 // If the window is in the observed_windows_ list it needs to continue to be |
309 // observed. | 311 // observed. |
310 if (observed_windows_.find(restore_focus_window_) == | 312 if (observed_windows_.find(restore_focus_window_) == |
311 observed_windows_.end()) { | 313 observed_windows_.end()) { |
312 restore_focus_window_->RemoveObserver(this); | 314 restore_focus_window_->RemoveObserver(this); |
313 } | 315 } |
314 restore_focus_window_ = NULL; | 316 restore_focus_window_ = NULL; |
315 } | 317 } |
316 | 318 |
317 } // namespace ash | 319 } // namespace ash |
OLD | NEW |