Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: ash/wm/overview/scoped_overview_animation_settings.cc

Issue 2918403006: CrOS Tablet Window management - Split Screen part I (Closed)
Patch Set: Add unittests. Will split the CL into two CLs. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/scoped_overview_animation_settings.h" 5 #include "ash/wm/overview/scoped_overview_animation_settings.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 30 matching lines...) Expand all
41 return base::TimeDelta::FromMilliseconds(kFadeInMilliseconds); 41 return base::TimeDelta::FromMilliseconds(kFadeInMilliseconds);
42 case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT: 42 case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT:
43 return base::TimeDelta::FromMilliseconds(kFadeOutMilliseconds); 43 return base::TimeDelta::FromMilliseconds(kFadeOutMilliseconds);
44 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: 44 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS:
45 case OVERVIEW_ANIMATION_RESTORE_WINDOW: 45 case OVERVIEW_ANIMATION_RESTORE_WINDOW:
46 return base::TimeDelta::FromMilliseconds(kTransitionMilliseconds); 46 return base::TimeDelta::FromMilliseconds(kTransitionMilliseconds);
47 case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM: 47 case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM:
48 return base::TimeDelta::FromMilliseconds(kCloseScaleMilliseconds); 48 return base::TimeDelta::FromMilliseconds(kCloseScaleMilliseconds);
49 case OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM: 49 case OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM:
50 return base::TimeDelta::FromMilliseconds(kCloseFadeOutMilliseconds); 50 return base::TimeDelta::FromMilliseconds(kCloseFadeOutMilliseconds);
51 case OVERVIEW_ANIMATION_DRAGGING_SELECTOR_ITEM:
52 return base::TimeDelta::FromMilliseconds(kTransitionMilliseconds);
51 } 53 }
52 NOTREACHED(); 54 NOTREACHED();
53 return base::TimeDelta(); 55 return base::TimeDelta();
54 } 56 }
55 57
56 class OverviewEnterMetricsReporter : public ui::AnimationMetricsReporter { 58 class OverviewEnterMetricsReporter : public ui::AnimationMetricsReporter {
57 public: 59 public:
58 OverviewEnterMetricsReporter() = default; 60 OverviewEnterMetricsReporter() = default;
59 ~OverviewEnterMetricsReporter() override = default; 61 ~OverviewEnterMetricsReporter() override = default;
60 62
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 LAZY_INSTANCE_INITIALIZER; 101 LAZY_INSTANCE_INITIALIZER;
100 base::LazyInstance<OverviewExitMetricsReporter>::Leaky g_reporter_exit = 102 base::LazyInstance<OverviewExitMetricsReporter>::Leaky g_reporter_exit =
101 LAZY_INSTANCE_INITIALIZER; 103 LAZY_INSTANCE_INITIALIZER;
102 base::LazyInstance<OverviewCloseMetricsReporter>::Leaky g_reporter_close = 104 base::LazyInstance<OverviewCloseMetricsReporter>::Leaky g_reporter_close =
103 LAZY_INSTANCE_INITIALIZER; 105 LAZY_INSTANCE_INITIALIZER;
104 106
105 ui::AnimationMetricsReporter* GetMetricsReporter( 107 ui::AnimationMetricsReporter* GetMetricsReporter(
106 OverviewAnimationType animation_type) { 108 OverviewAnimationType animation_type) {
107 switch (animation_type) { 109 switch (animation_type) {
108 case OVERVIEW_ANIMATION_NONE: 110 case OVERVIEW_ANIMATION_NONE:
111 case OVERVIEW_ANIMATION_DRAGGING_SELECTOR_ITEM:
109 return nullptr; 112 return nullptr;
110 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN: 113 case OVERVIEW_ANIMATION_ENTER_OVERVIEW_MODE_FADE_IN:
111 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: 114 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS:
112 return g_reporter_enter.Pointer(); 115 return g_reporter_enter.Pointer();
113 case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT: 116 case OVERVIEW_ANIMATION_EXIT_OVERVIEW_MODE_FADE_OUT:
114 case OVERVIEW_ANIMATION_RESTORE_WINDOW: 117 case OVERVIEW_ANIMATION_RESTORE_WINDOW:
115 return g_reporter_exit.Pointer(); 118 return g_reporter_exit.Pointer();
116 case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM: 119 case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM:
117 case OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM: 120 case OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM:
118 return g_reporter_close.Pointer(); 121 return g_reporter_close.Pointer();
(...skipping 28 matching lines...) Expand all
147 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 150 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
148 break; 151 break;
149 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS: 152 case OVERVIEW_ANIMATION_LAY_OUT_SELECTOR_ITEMS:
150 case OVERVIEW_ANIMATION_RESTORE_WINDOW: 153 case OVERVIEW_ANIMATION_RESTORE_WINDOW:
151 animation_settings_->SetPreemptionStrategy( 154 animation_settings_->SetPreemptionStrategy(
152 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 155 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
153 animation_settings_->SetTweenType(gfx::Tween::EASE_OUT); 156 animation_settings_->SetTweenType(gfx::Tween::EASE_OUT);
154 break; 157 break;
155 case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM: 158 case OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM:
156 case OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM: 159 case OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM:
160 case OVERVIEW_ANIMATION_DRAGGING_SELECTOR_ITEM:
157 animation_settings_->SetPreemptionStrategy( 161 animation_settings_->SetPreemptionStrategy(
158 ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); 162 ui::LayerAnimator::ENQUEUE_NEW_ANIMATION);
159 animation_settings_->SetTweenType(gfx::Tween::EASE_OUT); 163 animation_settings_->SetTweenType(gfx::Tween::EASE_OUT);
160 break; 164 break;
161 } 165 }
162 animation_settings_->SetTransitionDuration( 166 animation_settings_->SetTransitionDuration(
163 GetAnimationDuration(animation_type)); 167 GetAnimationDuration(animation_type));
164 animation_settings_->SetAnimationMetricsReporter( 168 animation_settings_->SetAnimationMetricsReporter(
165 GetMetricsReporter(animation_type)); 169 GetMetricsReporter(animation_type));
166 } 170 }
167 171
168 ScopedOverviewAnimationSettings::~ScopedOverviewAnimationSettings() {} 172 ScopedOverviewAnimationSettings::~ScopedOverviewAnimationSettings() {}
169 173
170 void ScopedOverviewAnimationSettings::AddObserver( 174 void ScopedOverviewAnimationSettings::AddObserver(
171 ui::ImplicitAnimationObserver* observer) { 175 ui::ImplicitAnimationObserver* observer) {
172 animation_settings_->AddObserver(observer); 176 animation_settings_->AddObserver(observer);
173 } 177 }
174 178
175 } // namespace ash 179 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/overview_window_drag_controller.cc ('k') | ash/wm/overview/scoped_transform_overview_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698