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 #include <functional> |
8 #include <set> | 9 #include <set> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "ash/accessibility_delegate.h" | 12 #include "ash/accessibility_delegate.h" |
12 #include "ash/ash_switches.h" | 13 #include "ash/ash_switches.h" |
13 #include "ash/metrics/user_metrics_recorder.h" | 14 #include "ash/metrics/user_metrics_recorder.h" |
14 #include "ash/root_window_controller.h" | 15 #include "ash/root_window_controller.h" |
15 #include "ash/shell.h" | 16 #include "ash/shell.h" |
16 #include "ash/shell_window_ids.h" | 17 #include "ash/shell_window_ids.h" |
17 #include "ash/switchable_windows.h" | 18 #include "ash/switchable_windows.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 ash::Shell* shell = ash::Shell::GetInstance(); | 287 ash::Shell* shell = ash::Shell::GetInstance(); |
287 | 288 |
288 ResetFocusRestoreWindow(true); | 289 ResetFocusRestoreWindow(true); |
289 for (std::set<aura::Window*>::iterator iter = observed_windows_.begin(); | 290 for (std::set<aura::Window*>::iterator iter = observed_windows_.begin(); |
290 iter != observed_windows_.end(); ++iter) { | 291 iter != observed_windows_.end(); ++iter) { |
291 (*iter)->RemoveObserver(this); | 292 (*iter)->RemoveObserver(this); |
292 } | 293 } |
293 shell->activation_client()->RemoveObserver(this); | 294 shell->activation_client()->RemoveObserver(this); |
294 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 295 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
295 | 296 |
| 297 OverviewAnimationSettingsProvider* animation_settings_provider = |
| 298 ash::Shell::GetInstance() |
| 299 ->window_selector_controller() |
| 300 ->GetAnimationSettingsProvider(); |
| 301 |
296 const aura::WindowTracker::Windows hidden_windows(hidden_windows_.windows()); | 302 const aura::WindowTracker::Windows hidden_windows(hidden_windows_.windows()); |
297 for (aura::WindowTracker::Windows::const_iterator iter = | 303 for (aura::WindowTracker::Windows::const_iterator iter = |
298 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { | 304 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { |
299 OverviewAnimationSettingsProvider* animation_settings_provider = | 305 scoped_ptr<ui::ScopedLayerAnimationSettings> settings = |
300 ash::Shell::GetInstance() | |
301 ->window_selector_controller() | |
302 ->GetAnimationSettingsProvider(); | |
303 scoped_ptr<ui::ScopedLayerAnimationSettings> animation_settings = | |
304 animation_settings_provider->Create( | 306 animation_settings_provider->Create( |
305 ash::OverviewAnimationSettingsProvider::AnimationType:: | 307 OverviewAnimationSettingsProvider::AnimationType::RESTORE_WINDOW, |
306 LAYOUT_SELECTOR_ITEMS, | 308 (*iter)); |
307 *iter); | |
308 (*iter)->layer()->SetOpacity(1); | 309 (*iter)->layer()->SetOpacity(1); |
309 (*iter)->Show(); | 310 (*iter)->Show(); |
310 } | 311 } |
311 | 312 |
312 shell->GetScreen()->RemoveObserver(this); | 313 shell->GetScreen()->RemoveObserver(this); |
313 | 314 |
314 size_t remaining_items = 0; | 315 size_t remaining_items = 0; |
315 for (ScopedVector<WindowGrid>::iterator iter = grid_list_.begin(); | 316 for (ScopedVector<WindowGrid>::iterator iter = grid_list_.begin(); |
316 iter != grid_list_.end(); iter++) { | 317 iter != grid_list_.end(); iter++) { |
317 remaining_items += (*iter)->size(); | 318 remaining_items += (*iter)->size(); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 for (aura::Window::Windows::const_iterator iter = | 540 for (aura::Window::Windows::const_iterator iter = |
540 container->children().begin(); iter != container->children().end(); | 541 container->children().begin(); iter != container->children().end(); |
541 ++iter) { | 542 ++iter) { |
542 if (!(*iter)->IsVisible() || (*grid_iter)->Contains(*iter)) | 543 if (!(*iter)->IsVisible() || (*grid_iter)->Contains(*iter)) |
543 continue; | 544 continue; |
544 hidden_windows_.Add(*iter); | 545 hidden_windows_.Add(*iter); |
545 } | 546 } |
546 } | 547 } |
547 } | 548 } |
548 | 549 |
| 550 OverviewAnimationSettingsProvider* animation_settings_provider = |
| 551 ash::Shell::GetInstance() |
| 552 ->window_selector_controller() |
| 553 ->GetAnimationSettingsProvider(); |
| 554 |
549 // Copy the window list as it can change during iteration. | 555 // Copy the window list as it can change during iteration. |
550 const aura::WindowTracker::Windows hidden_windows(hidden_windows_.windows()); | 556 const aura::WindowTracker::Windows hidden_windows(hidden_windows_.windows()); |
551 for (aura::WindowTracker::Windows::const_iterator iter = | 557 for (aura::WindowTracker::Windows::const_iterator iter = |
552 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { | 558 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { |
553 if (!hidden_windows_.Contains(*iter)) | 559 if (!hidden_windows_.Contains(*iter)) |
554 continue; | 560 continue; |
555 OverviewAnimationSettingsProvider* animation_settings_provider = | 561 |
556 ash::Shell::GetInstance() | 562 scoped_ptr<ui::ScopedLayerAnimationSettings> settings = |
557 ->window_selector_controller() | |
558 ->GetAnimationSettingsProvider(); | |
559 scoped_ptr<ui::ScopedLayerAnimationSettings> animation_settings = | |
560 animation_settings_provider->Create( | 563 animation_settings_provider->Create( |
561 ash::OverviewAnimationSettingsProvider::AnimationType:: | 564 OverviewAnimationSettingsProvider::AnimationType::HIDE_WINDOW, |
562 HIDE_WINDOW, | 565 (*iter)); |
563 *iter); | |
564 (*iter)->Hide(); | 566 (*iter)->Hide(); |
565 // Hiding the window can result in it being destroyed. | 567 // Hiding the window can result in it being destroyed. |
566 if (!hidden_windows_.Contains(*iter)) | 568 if (!hidden_windows_.Contains(*iter)) |
567 continue; | 569 continue; |
568 (*iter)->layer()->SetOpacity(0); | 570 (*iter)->layer()->SetOpacity(0); |
569 } | 571 } |
570 } | 572 } |
571 | 573 |
572 void WindowSelector::ResetFocusRestoreWindow(bool focus) { | 574 void WindowSelector::ResetFocusRestoreWindow(bool focus) { |
573 if (!restore_focus_window_) | 575 if (!restore_focus_window_) |
(...skipping 17 matching lines...) Expand all Loading... |
591 for (size_t i = 0; | 593 for (size_t i = 0; |
592 i <= grid_list_.size() && | 594 i <= grid_list_.size() && |
593 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { | 595 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { |
594 // TODO(flackr): If there are more than two monitors, move between grids | 596 // TODO(flackr): If there are more than two monitors, move between grids |
595 // in the requested direction. | 597 // in the requested direction. |
596 selected_grid_index_ = (selected_grid_index_ + 1) % grid_list_.size(); | 598 selected_grid_index_ = (selected_grid_index_ + 1) % grid_list_.size(); |
597 } | 599 } |
598 } | 600 } |
599 | 601 |
600 } // namespace ash | 602 } // namespace ash |
OLD | NEW |