Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/timer.h" | 11 #include "base/timer.h" |
| 12 #include "ui/aura/root_window_observer.h" | 12 #include "ui/aura/root_window_observer.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ash/wm/workspace/colored_window_controller.h" | |
|
Daniel Erat
2012/10/22 17:45:48
keep this list alphabetized
| |
| 14 | 15 |
| 15 namespace gfx { | 16 namespace gfx { |
| 16 class Rect; | 17 class Rect; |
| 17 class Size; | 18 class Size; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace ui { | 21 namespace ui { |
| 21 class Layer; | 22 class Layer; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace ash { | 25 namespace ash { |
| 25 namespace internal { | 26 namespace internal { |
| 26 | 27 |
| 27 // Displays onscreen animations for session state changes (lock/unlock, sign | 28 // Displays onscreen animations for session state changes (lock/unlock, sign |
| 28 // out, shut down). | 29 // out, shut down). |
| 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_SLOW_CLOSE = 0, | 34 ANIMATION_PARTIAL_CLOSE = 0, |
| 34 ANIMATION_UNDO_SLOW_CLOSE, | 35 ANIMATION_UNDO_PARTIAL_CLOSE, |
| 35 ANIMATION_FAST_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_LIFT_UP, | |
| 41 ANIMATION_PUT_DOWN, | |
|
Daniel Erat
2012/10/22 17:45:48
maybe just ANIMATION_RAISE and ANIMATION_LOWER for
| |
| 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 Loading... | |
| 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 void CreateForeground(); | |
| 118 void DropForeground(); | |
| 119 | |
| 109 // Drops back layer after |UNDO_SLOW_CLOSE| animation delay. | 120 // Drops back layer after |UNDO_SLOW_CLOSE| animation delay. |
| 110 void ScheduleDropBlackLayer(); | 121 void ScheduleDropBlackLayer(); |
| 111 | 122 |
| 112 // Apply animation |type| to all containers included in |container_mask|. | 123 // Apply animation |type| to all containers included in |container_mask|. |
| 113 void StartAnimation(int container_mask, | 124 void StartAnimation(int container_mask, |
| 114 AnimationType type); | 125 AnimationType type); |
| 115 | 126 |
| 116 // Fills |containers| with the containers included in |container_mask|. | 127 // Fills |containers| with the containers included in |container_mask|. |
| 117 void GetContainers(int container_mask, | 128 void GetContainers(int container_mask, |
| 118 aura::Window::Windows* containers); | 129 aura::Window::Windows* containers); |
| 119 | 130 |
| 120 // aura::RootWindowObserver overrides: | 131 // aura::RootWindowObserver overrides: |
| 121 virtual void OnRootWindowResized(const aura::RootWindow* root, | 132 virtual void OnRootWindowResized(const aura::RootWindow* root, |
| 122 const gfx::Size& old_size) OVERRIDE; | 133 const gfx::Size& old_size) OVERRIDE; |
| 123 | 134 |
| 124 private: | 135 private: |
| 125 // Layer that's stacked under all of the root window's children to provide a | 136 // 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. | 137 // 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 | 138 // TODO(derat): Remove this in favor of having the compositor only clear the |
| 128 // viewport when there are regions not covered by a layer: | 139 // viewport when there are regions not covered by a layer: |
| 129 // http://crbug.com/113445 | 140 // http://crbug.com/113445 |
| 130 scoped_ptr<ui::Layer> black_layer_; | 141 scoped_ptr<ui::Layer> black_layer_; |
| 131 | 142 |
| 143 scoped_ptr<ColoredWindowController> foreground_; | |
|
Daniel Erat
2012/10/22 17:45:48
add a comment describing what this is
| |
| 144 | |
| 132 // Started when we abort the pre-lock state. When it fires, we hide | 145 // 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 | 146 // |black_layer_|, as the desktop background is now covering the whole |
| 134 // screen. | 147 // screen. |
| 135 base::OneShotTimer<SessionStateAnimator> hide_black_layer_timer_; | 148 base::OneShotTimer<SessionStateAnimator> hide_black_layer_timer_; |
| 136 | 149 |
| 137 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); | 150 DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); |
| 138 }; | 151 }; |
| 139 | 152 |
| 140 } // namespace internal | 153 } // namespace internal |
| 141 } // namespace ash | 154 } // namespace ash |
| 142 | 155 |
| 143 #endif // ASH_WM_SESSION_STATE_ANIMATOR_H_ | 156 #endif // ASH_WM_SESSION_STATE_ANIMATOR_H_ |
| OLD | NEW |