OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_grid.h" | 5 #include "ash/wm/overview/window_grid.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
| 10 #include <utility> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "ash/ash_switches.h" | 13 #include "ash/ash_switches.h" |
13 #include "ash/screen_util.h" | 14 #include "ash/screen_util.h" |
14 #include "ash/shell.h" | 15 #include "ash/shell.h" |
15 #include "ash/shell_window_ids.h" | 16 #include "ash/shell_window_ids.h" |
16 #include "ash/wm/overview/scoped_transform_overview_window.h" | 17 #include "ash/wm/overview/scoped_transform_overview_window.h" |
17 #include "ash/wm/overview/window_selector.h" | 18 #include "ash/wm/overview/window_selector.h" |
18 #include "ash/wm/overview/window_selector_item.h" | 19 #include "ash/wm/overview/window_selector_item.h" |
19 #include "ash/wm/window_state.h" | 20 #include "ash/wm/window_state.h" |
(...skipping 30 matching lines...) Expand all Loading... |
50 void OnImplicitAnimationsCompleted() override; | 51 void OnImplicitAnimationsCompleted() override; |
51 | 52 |
52 private: | 53 private: |
53 scoped_ptr<views::Widget> widget_; | 54 scoped_ptr<views::Widget> widget_; |
54 | 55 |
55 DISALLOW_COPY_AND_ASSIGN(CleanupWidgetAfterAnimationObserver); | 56 DISALLOW_COPY_AND_ASSIGN(CleanupWidgetAfterAnimationObserver); |
56 }; | 57 }; |
57 | 58 |
58 CleanupWidgetAfterAnimationObserver::CleanupWidgetAfterAnimationObserver( | 59 CleanupWidgetAfterAnimationObserver::CleanupWidgetAfterAnimationObserver( |
59 scoped_ptr<views::Widget> widget) | 60 scoped_ptr<views::Widget> widget) |
60 : widget_(widget.Pass()) { | 61 : widget_(std::move(widget)) {} |
61 } | |
62 | 62 |
63 CleanupWidgetAfterAnimationObserver::~CleanupWidgetAfterAnimationObserver() { | 63 CleanupWidgetAfterAnimationObserver::~CleanupWidgetAfterAnimationObserver() { |
64 } | 64 } |
65 | 65 |
66 void CleanupWidgetAfterAnimationObserver::OnImplicitAnimationsCompleted() { | 66 void CleanupWidgetAfterAnimationObserver::OnImplicitAnimationsCompleted() { |
67 delete this; | 67 delete this; |
68 } | 68 } |
69 | 69 |
70 // A comparator for locating a given target window. | 70 // A comparator for locating a given target window. |
71 struct WindowSelectorItemComparator | 71 struct WindowSelectorItemComparator |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 old_selection->GetNativeWindow()->layer()->GetAnimator()); | 470 old_selection->GetNativeWindow()->layer()->GetAnimator()); |
471 animation_settings.SetTransitionDuration( | 471 animation_settings.SetTransitionDuration( |
472 base::TimeDelta::FromMilliseconds( | 472 base::TimeDelta::FromMilliseconds( |
473 kOverviewSelectorTransitionMilliseconds)); | 473 kOverviewSelectorTransitionMilliseconds)); |
474 animation_settings.SetPreemptionStrategy( | 474 animation_settings.SetPreemptionStrategy( |
475 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 475 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
476 animation_settings.SetTweenType(gfx::Tween::FAST_OUT_LINEAR_IN); | 476 animation_settings.SetTweenType(gfx::Tween::FAST_OUT_LINEAR_IN); |
477 // CleanupWidgetAfterAnimationObserver will delete itself (and the | 477 // CleanupWidgetAfterAnimationObserver will delete itself (and the |
478 // widget) when the movement animation is complete. | 478 // widget) when the movement animation is complete. |
479 animation_settings.AddObserver( | 479 animation_settings.AddObserver( |
480 new CleanupWidgetAfterAnimationObserver(selection_widget_.Pass())); | 480 new CleanupWidgetAfterAnimationObserver(std::move(selection_widget_))); |
481 old_selection->SetOpacity(0); | 481 old_selection->SetOpacity(0); |
482 old_selection->GetNativeWindow()->SetBounds( | 482 old_selection->GetNativeWindow()->SetBounds( |
483 old_selection->GetNativeWindow()->bounds() + fade_out_direction); | 483 old_selection->GetNativeWindow()->bounds() + fade_out_direction); |
484 old_selection->Hide(); | 484 old_selection->Hide(); |
485 } | 485 } |
486 if (out_of_bounds) | 486 if (out_of_bounds) |
487 return; | 487 return; |
488 | 488 |
489 if (!selection_widget_) | 489 if (!selection_widget_) |
490 InitSelectionWidget(direction); | 490 InitSelectionWidget(direction); |
(...skipping 16 matching lines...) Expand all Loading... |
507 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 507 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
508 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); | 508 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); |
509 selection_widget_->SetOpacity(255); | 509 selection_widget_->SetOpacity(255); |
510 return; | 510 return; |
511 } | 511 } |
512 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); | 512 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); |
513 selection_widget_->SetOpacity(255); | 513 selection_widget_->SetOpacity(255); |
514 } | 514 } |
515 | 515 |
516 } // namespace ash | 516 } // namespace ash |
OLD | NEW |