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

Side by Side Diff: ash/wm/session_state_animator.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « ash/wm/session_state_animator.h ('k') | ash/wm/session_state_animator_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/session_state_animator.h" 5 #include "ash/wm/session_state_animator.h"
6 6
7 #include "ash/common/shell_window_ids.h" 7 #include "ash/common/shell_window_ids.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/wm/window_animations.h" 9 #include "ash/wm/window_animations.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
11 #include "ui/aura/window_event_dispatcher.h" 11 #include "ui/aura/window_event_dispatcher.h"
12 #include "ui/compositor/layer_animation_observer.h" 12 #include "ui/compositor/layer_animation_observer.h"
13 #include "ui/compositor/layer_animation_sequence.h" 13 #include "ui/compositor/layer_animation_sequence.h"
14 #include "ui/compositor/scoped_layer_animation_settings.h" 14 #include "ui/compositor/scoped_layer_animation_settings.h"
15 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
16 16
17 namespace ash { 17 namespace ash {
18 18
19 const int SessionStateAnimator::kAllLockScreenContainersMask = 19 const int SessionStateAnimator::kAllLockScreenContainersMask =
20 SessionStateAnimator::LOCK_SCREEN_BACKGROUND | 20 SessionStateAnimator::LOCK_SCREEN_BACKGROUND |
21 SessionStateAnimator::LOCK_SCREEN_CONTAINERS | 21 SessionStateAnimator::LOCK_SCREEN_CONTAINERS |
22 SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS; 22 SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS;
23 23
24 const int SessionStateAnimator::kAllNonRootContainersMask = 24 const int SessionStateAnimator::kAllNonRootContainersMask =
25 SessionStateAnimator::kAllLockScreenContainersMask | 25 SessionStateAnimator::kAllLockScreenContainersMask |
26 SessionStateAnimator::DESKTOP_BACKGROUND | 26 SessionStateAnimator::DESKTOP_BACKGROUND | SessionStateAnimator::LAUNCHER |
27 SessionStateAnimator::LAUNCHER |
28 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS; 27 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS;
29 28
30 SessionStateAnimator::AnimationSequence::AnimationSequence( 29 SessionStateAnimator::AnimationSequence::AnimationSequence(
31 base::Closure callback) 30 base::Closure callback)
32 : sequence_ended_(false), 31 : sequence_ended_(false),
33 animation_completed_(false), 32 animation_completed_(false),
34 invoke_callback_(false), 33 invoke_callback_(false),
35 callback_(callback) { 34 callback_(callback) {}
36 }
37 35
38 SessionStateAnimator::AnimationSequence::~AnimationSequence() { 36 SessionStateAnimator::AnimationSequence::~AnimationSequence() {}
39 }
40 37
41 void SessionStateAnimator::AnimationSequence::EndSequence() { 38 void SessionStateAnimator::AnimationSequence::EndSequence() {
42 sequence_ended_ = true; 39 sequence_ended_ = true;
43 CleanupIfSequenceCompleted(); 40 CleanupIfSequenceCompleted();
44 } 41 }
45 42
46 void SessionStateAnimator::AnimationSequence::OnAnimationCompleted() { 43 void SessionStateAnimator::AnimationSequence::OnAnimationCompleted() {
47 animation_completed_ = true; 44 animation_completed_ = true;
48 invoke_callback_ = true; 45 invoke_callback_ = true;
49 CleanupIfSequenceCompleted(); 46 CleanupIfSequenceCompleted();
50 } 47 }
51 48
52 void SessionStateAnimator::AnimationSequence::OnAnimationAborted() { 49 void SessionStateAnimator::AnimationSequence::OnAnimationAborted() {
53 animation_completed_ = true; 50 animation_completed_ = true;
54 invoke_callback_ = false; 51 invoke_callback_ = false;
55 CleanupIfSequenceCompleted(); 52 CleanupIfSequenceCompleted();
56 } 53 }
57 54
58 void SessionStateAnimator::AnimationSequence::CleanupIfSequenceCompleted() { 55 void SessionStateAnimator::AnimationSequence::CleanupIfSequenceCompleted() {
59 if (sequence_ended_ && animation_completed_) { 56 if (sequence_ended_ && animation_completed_) {
60 if (invoke_callback_) 57 if (invoke_callback_)
61 callback_.Run(); 58 callback_.Run();
62 delete this; 59 delete this;
63 } 60 }
64 } 61 }
65 62
66 SessionStateAnimator::SessionStateAnimator() { 63 SessionStateAnimator::SessionStateAnimator() {}
67 }
68 64
69 SessionStateAnimator::~SessionStateAnimator() { 65 SessionStateAnimator::~SessionStateAnimator() {}
70 }
71 66
72 base::TimeDelta SessionStateAnimator::GetDuration( 67 base::TimeDelta SessionStateAnimator::GetDuration(
73 SessionStateAnimator::AnimationSpeed speed) { 68 SessionStateAnimator::AnimationSpeed speed) {
74 switch (speed) { 69 switch (speed) {
75 case ANIMATION_SPEED_IMMEDIATE: 70 case ANIMATION_SPEED_IMMEDIATE:
76 return base::TimeDelta(); 71 return base::TimeDelta();
77 case ANIMATION_SPEED_UNDOABLE: 72 case ANIMATION_SPEED_UNDOABLE:
78 return base::TimeDelta::FromMilliseconds(400); 73 return base::TimeDelta::FromMilliseconds(400);
79 case ANIMATION_SPEED_REVERT: 74 case ANIMATION_SPEED_REVERT:
80 return base::TimeDelta::FromMilliseconds(150); 75 return base::TimeDelta::FromMilliseconds(150);
(...skipping 10 matching lines...) Expand all
91 case ANIMATION_SPEED_REVERT_SHUTDOWN: 86 case ANIMATION_SPEED_REVERT_SHUTDOWN:
92 return base::TimeDelta::FromMilliseconds(500); 87 return base::TimeDelta::FromMilliseconds(500);
93 } 88 }
94 // Satisfy compilers that do not understand that we will return from switch 89 // Satisfy compilers that do not understand that we will return from switch
95 // above anyway. 90 // above anyway.
96 DCHECK(false) << "Unhandled animation speed " << speed; 91 DCHECK(false) << "Unhandled animation speed " << speed;
97 return base::TimeDelta(); 92 return base::TimeDelta();
98 } 93 }
99 94
100 } // namespace ash 95 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/session_state_animator.h ('k') | ash/wm/session_state_animator_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698