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

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

Issue 11220002: Add new animations in second implementation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Review fixes Created 8 years, 2 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/shell_window_ids.h ('k') | ash/wm/session_state_animator.cc » ('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 #ifndef ASH_WM_SESSION_STATE_ANIMATOR_H_ 5 #ifndef ASH_WM_SESSION_STATE_ANIMATOR_H_
6 #define ASH_WM_SESSION_STATE_ANIMATOR_H_ 6 #define ASH_WM_SESSION_STATE_ANIMATOR_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/wm/workspace/colored_window_controller.h"
9 #include "base/basictypes.h" 10 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/timer.h" 12 #include "base/timer.h"
12 #include "ui/aura/root_window_observer.h" 13 #include "ui/aura/root_window_observer.h"
13 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
14 15
15 namespace gfx { 16 namespace gfx {
16 class Rect; 17 class Rect;
17 class Size; 18 class Size;
18 } 19 }
(...skipping 10 matching lines...) Expand all
29 class ASH_EXPORT SessionStateAnimator : public aura::RootWindowObserver { 30 class ASH_EXPORT SessionStateAnimator : public aura::RootWindowObserver {
30 public: 31 public:
31 // Animations that can be applied to groups of containers. 32 // Animations that can be applied to groups of containers.
32 enum AnimationType { 33 enum AnimationType {
33 ANIMATION_PARTIAL_CLOSE = 0, 34 ANIMATION_PARTIAL_CLOSE = 0,
34 ANIMATION_UNDO_PARTIAL_CLOSE, 35 ANIMATION_UNDO_PARTIAL_CLOSE,
35 ANIMATION_FULL_CLOSE, 36 ANIMATION_FULL_CLOSE,
36 ANIMATION_FADE_IN, 37 ANIMATION_FADE_IN,
37 ANIMATION_HIDE, 38 ANIMATION_HIDE,
38 ANIMATION_RESTORE, 39 ANIMATION_RESTORE,
40 ANIMATION_RAISE,
41 ANIMATION_LOWER,
42 ANIMATION_PARTIAL_FADE_IN,
43 ANIMATION_UNDO_PARTIAL_FADE_IN,
44 ANIMATION_FULL_FADE_IN,
39 }; 45 };
40 46
41 // Specific containers or groups of containers that can be animated. 47 // Specific containers or groups of containers that can be animated.
42 enum Container { 48 enum Container {
43 DESKTOP_BACKGROUND = 1 << 0, 49 DESKTOP_BACKGROUND = 1 << 0,
44 LAUNCHER = 1 << 1, 50 LAUNCHER = 1 << 1,
45 51
46 // All user session related containers including system background but 52 // All user session related containers including system background but
47 // not including desktop background (wallpaper). 53 // not including desktop background (wallpaper).
48 NON_LOCK_SCREEN_CONTAINERS = 1 << 2, 54 NON_LOCK_SCREEN_CONTAINERS = 1 << 2,
49 55
50 // Desktop wallpaper is moved to this layer when screen is locked. 56 // Desktop wallpaper is moved to this layer when screen is locked.
51 // This layer is excluded from lock animation so that wallpaper stays as is, 57 // This layer is excluded from lock animation so that wallpaper stays as is,
52 // user session windows are hidden and lock UI is shown on top of it. 58 // user session windows are hidden and lock UI is shown on top of it.
53 // This layer is included in shutdown animation. 59 // This layer is included in shutdown animation.
54 LOCK_SCREEN_BACKGROUND = 1 << 3, 60 LOCK_SCREEN_BACKGROUND = 1 << 3,
55 61
56 // Lock screen and lock screen modal containers. 62 // Lock screen and lock screen modal containers.
57 LOCK_SCREEN_CONTAINERS = 1 << 4, 63 LOCK_SCREEN_CONTAINERS = 1 << 4,
58 64
59 // Multiple system layers belong here like status, menu, tooltip 65 // Multiple system layers belong here like status, menu, tooltip
60 // and overlay layers. 66 // and overlay layers.
61 LOCK_SCREEN_RELATED_CONTAINERS = 1 << 5, 67 LOCK_SCREEN_RELATED_CONTAINERS = 1 << 5,
68
69 LOCK_SCREEN_SYSTEM_FOREGROUND = 1 << 6,
62 }; 70 };
63 71
64 // Helper class used by tests to access internal state. 72 // Helper class used by tests to access internal state.
65 class ASH_EXPORT TestApi { 73 class ASH_EXPORT TestApi {
66 public: 74 public:
67 explicit TestApi(SessionStateAnimator* animator) 75 explicit TestApi(SessionStateAnimator* animator)
68 : animator_(animator) {} 76 : animator_(animator) {}
69 77
70 bool hide_black_layer_timer_is_running() const { 78 bool hide_black_layer_timer_is_running() const {
71 return animator_->hide_black_layer_timer_.IsRunning(); 79 return animator_->hide_black_layer_timer_.IsRunning();
(...skipping 27 matching lines...) Expand all
99 const static int kAllContainersMask; 107 const static int kAllContainersMask;
100 108
101 SessionStateAnimator(); 109 SessionStateAnimator();
102 virtual ~SessionStateAnimator(); 110 virtual ~SessionStateAnimator();
103 111
104 // Shows or hides |black_layer_|. The show method creates and 112 // Shows or hides |black_layer_|. The show method creates and
105 // initializes the layer if it doesn't already exist. 113 // initializes the layer if it doesn't already exist.
106 void ShowBlackLayer(); 114 void ShowBlackLayer();
107 void DropBlackLayer(); 115 void DropBlackLayer();
108 116
117 // Create |foreground_| layer if it doesn't already exist, but makes it
118 // completely transparent.
119 void CreateForeground();
120 // Destroy |foreground_| when it is not needed anymore.
121 void DropForeground();
122
109 // Drops back layer after |UNDO_SLOW_CLOSE| animation delay. 123 // Drops back layer after |UNDO_SLOW_CLOSE| animation delay.
110 void ScheduleDropBlackLayer(); 124 void ScheduleDropBlackLayer();
111 125
112 // Apply animation |type| to all containers included in |container_mask|. 126 // Apply animation |type| to all containers included in |container_mask|.
113 void StartAnimation(int container_mask, 127 void StartAnimation(int container_mask,
114 AnimationType type); 128 AnimationType type);
115 129
116 // Fills |containers| with the containers included in |container_mask|. 130 // Fills |containers| with the containers included in |container_mask|.
117 void GetContainers(int container_mask, 131 void GetContainers(int container_mask,
118 aura::Window::Windows* containers); 132 aura::Window::Windows* containers);
119 133
120 // aura::RootWindowObserver overrides: 134 // aura::RootWindowObserver overrides:
121 virtual void OnRootWindowResized(const aura::RootWindow* root, 135 virtual void OnRootWindowResized(const aura::RootWindow* root,
122 const gfx::Size& old_size) OVERRIDE; 136 const gfx::Size& old_size) OVERRIDE;
123 137
124 private: 138 private:
125 // Layer that's stacked under all of the root window's children to provide a 139 // Layer that's stacked under all of the root window's children to provide a
126 // black background when we're scaling all of the other windows down. 140 // black background when we're scaling all of the other windows down.
127 // TODO(derat): Remove this in favor of having the compositor only clear the 141 // TODO(derat): Remove this in favor of having the compositor only clear the
128 // viewport when there are regions not covered by a layer: 142 // viewport when there are regions not covered by a layer:
129 // http://crbug.com/113445 143 // http://crbug.com/113445
130 scoped_ptr<ui::Layer> black_layer_; 144 scoped_ptr<ui::Layer> black_layer_;
131 145
146 // White foreground that is used during shutdown animation to "fade
147 // everything into white".
148 scoped_ptr<ColoredWindowController> foreground_;
149
132 // Started when we abort the pre-lock state. When it fires, we hide 150 // Started when we abort the pre-lock state. When it fires, we hide
133 // |black_layer_|, as the desktop background is now covering the whole 151 // |black_layer_|, as the desktop background is now covering the whole
134 // screen. 152 // screen.
135 base::OneShotTimer<SessionStateAnimator> hide_black_layer_timer_; 153 base::OneShotTimer<SessionStateAnimator> hide_black_layer_timer_;
136 154
137 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); 155 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator);
138 }; 156 };
139 157
140 } // namespace internal 158 } // namespace internal
141 } // namespace ash 159 } // namespace ash
142 160
143 #endif // ASH_WM_SESSION_STATE_ANIMATOR_H_ 161 #endif // ASH_WM_SESSION_STATE_ANIMATOR_H_
OLDNEW
« no previous file with comments | « ash/shell_window_ids.h ('k') | ash/wm/session_state_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698