| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } else { | 274 } else { |
| 275 windows_.push_back(new WindowSelectorWindow(windows[i])); | 275 windows_.push_back(new WindowSelectorWindow(windows[i])); |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 RemoveFocusAndSetRestoreWindow(); | 278 RemoveFocusAndSetRestoreWindow(); |
| 279 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", windows_.size()); | 279 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", windows_.size()); |
| 280 | 280 |
| 281 // Observe window activations and switchable containers on all root windows | 281 // Observe window activations and switchable containers on all root windows |
| 282 // for newly created windows during overview. | 282 // for newly created windows during overview. |
| 283 Shell::GetInstance()->activation_client()->AddObserver(this); | 283 Shell::GetInstance()->activation_client()->AddObserver(this); |
| 284 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 284 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 285 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); | 285 for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
| 286 iter != root_windows.end(); ++iter) { | 286 iter != root_windows.end(); ++iter) { |
| 287 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { | 287 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { |
| 288 Shell::GetContainer(*iter, | 288 Shell::GetContainer(*iter, |
| 289 kSwitchableWindowContainerIds[i])->AddObserver(this); | 289 kSwitchableWindowContainerIds[i])->AddObserver(this); |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 if (mode == WindowSelector::CYCLE) { | 293 if (mode == WindowSelector::CYCLE) { |
| 294 event_handler_.reset(new WindowSelectorEventFilter(this)); | 294 event_handler_.reset(new WindowSelectorEventFilter(this)); |
| 295 if (timer_enabled_) | 295 if (timer_enabled_) |
| 296 start_overview_timer_.Reset(); | 296 start_overview_timer_.Reset(); |
| 297 } else { | 297 } else { |
| 298 StartOverview(); | 298 StartOverview(); |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 | 301 |
| 302 WindowSelector::~WindowSelector() { | 302 WindowSelector::~WindowSelector() { |
| 303 ResetFocusRestoreWindow(true); | 303 ResetFocusRestoreWindow(true); |
| 304 for (std::set<aura::Window*>::iterator iter = observed_windows_.begin(); | 304 for (std::set<aura::Window*>::iterator iter = observed_windows_.begin(); |
| 305 iter != observed_windows_.end(); ++iter) { | 305 iter != observed_windows_.end(); ++iter) { |
| 306 (*iter)->RemoveObserver(this); | 306 (*iter)->RemoveObserver(this); |
| 307 } | 307 } |
| 308 Shell::GetInstance()->activation_client()->RemoveObserver(this); | 308 Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| 309 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 309 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 310 for (aura::Window::Windows::const_iterator iter = root_windows.begin(); | 310 for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); |
| 311 iter != root_windows.end(); ++iter) { | 311 iter != root_windows.end(); ++iter) { |
| 312 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { | 312 for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i) { |
| 313 Shell::GetContainer(*iter, | 313 Shell::GetContainer(*iter, |
| 314 kSwitchableWindowContainerIds[i])->RemoveObserver(this); | 314 kSwitchableWindowContainerIds[i])->RemoveObserver(this); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 window_overview_.reset(); | 317 window_overview_.reset(); |
| 318 // Clearing the window list resets the ignored_by_shelf flag on the windows. | 318 // Clearing the window list resets the ignored_by_shelf flag on the windows. |
| 319 windows_.clear(); | 319 windows_.clear(); |
| 320 UpdateShelfVisibility(); | 320 UpdateShelfVisibility(); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 // If the window is in the observed_windows_ list it needs to continue to be | 499 // If the window is in the observed_windows_ list it needs to continue to be |
| 500 // observed. | 500 // observed. |
| 501 if (observed_windows_.find(restore_focus_window_) == | 501 if (observed_windows_.find(restore_focus_window_) == |
| 502 observed_windows_.end()) { | 502 observed_windows_.end()) { |
| 503 restore_focus_window_->RemoveObserver(this); | 503 restore_focus_window_->RemoveObserver(this); |
| 504 } | 504 } |
| 505 restore_focus_window_ = NULL; | 505 restore_focus_window_ = NULL; |
| 506 } | 506 } |
| 507 | 507 |
| 508 } // namespace ash | 508 } // namespace ash |
| OLD | NEW |