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_LAUNCHER_LAUNCHER_H_ | 5 #ifndef ASH_LAUNCHER_LAUNCHER_H_ |
6 #define ASH_LAUNCHER_LAUNCHER_H_ | 6 #define ASH_LAUNCHER_LAUNCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
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 "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ui/base/animation/animation_delegate.h" |
| 13 #include "ui/base/animation/slide_animation.h" |
12 | 14 |
13 namespace aura { | 15 namespace aura { |
14 class Window; | 16 class Window; |
15 } | 17 } |
16 | 18 |
17 namespace gfx { | 19 namespace gfx { |
18 class Rect; | 20 class Rect; |
19 } | 21 } |
20 | 22 |
21 namespace views { | 23 namespace views { |
22 class Widget; | 24 class Widget; |
23 } | 25 } |
24 | 26 |
25 namespace ash { | 27 namespace ash { |
26 | 28 |
27 namespace internal { | 29 namespace internal { |
28 class FocusCycler; | 30 class FocusCycler; |
29 class LauncherView; | 31 class LauncherView; |
30 } | 32 } |
31 | 33 |
32 class LauncherDelegate; | 34 class LauncherDelegate; |
33 class LauncherModel; | 35 class LauncherModel; |
34 | 36 |
35 class ASH_EXPORT Launcher { | 37 class ASH_EXPORT Launcher : public ui::AnimationDelegate { |
36 public: | 38 public: |
| 39 // How the background can be changed. |
| 40 enum BackgroundChangeSpeed { |
| 41 CHANGE_ANIMATE, |
| 42 CHANGE_IMMEDIATE |
| 43 }; |
| 44 |
37 explicit Launcher(aura::Window* window_container); | 45 explicit Launcher(aura::Window* window_container); |
38 ~Launcher(); | 46 ~Launcher(); |
39 | 47 |
40 // Sets the focus cycler. | 48 // Sets the focus cycler. |
41 void SetFocusCycler(const internal::FocusCycler* focus_cycler); | 49 void SetFocusCycler(const internal::FocusCycler* focus_cycler); |
42 | 50 |
| 51 // Sets whether the launcher renders a background. Default is false, but is |
| 52 // set to true if a window overlaps the shelf. |
| 53 void SetRendersBackground(bool value, BackgroundChangeSpeed speed); |
| 54 |
43 // Sets the width of the status area. | 55 // Sets the width of the status area. |
44 void SetStatusWidth(int width); | 56 void SetStatusWidth(int width); |
45 int GetStatusWidth(); | 57 int GetStatusWidth(); |
46 | 58 |
47 // Returns the screen bounds of the item for the specified window. If there is | 59 // Returns the screen bounds of the item for the specified window. If there is |
48 // no item for the specified window an empty rect is returned. | 60 // no item for the specified window an empty rect is returned. |
49 gfx::Rect GetScreenBoundsOfItemIconForWindow(aura::Window* window); | 61 gfx::Rect GetScreenBoundsOfItemIconForWindow(aura::Window* window); |
50 // Only to be called for testing. Retrieves the LauncherView. | 62 // Only to be called for testing. Retrieves the LauncherView. |
51 internal::LauncherView* GetLauncherViewForTest(); | 63 internal::LauncherView* GetLauncherViewForTest(); |
52 | 64 |
53 LauncherDelegate* delegate() { return delegate_.get(); } | 65 LauncherDelegate* delegate() { return delegate_.get(); } |
54 | 66 |
55 LauncherModel* model() { return model_.get(); } | 67 LauncherModel* model() { return model_.get(); } |
56 views::Widget* widget() { return widget_.get(); } | 68 views::Widget* widget() { return widget_.get(); } |
57 | 69 |
58 aura::Window* window_container() { return window_container_; } | 70 aura::Window* window_container() { return window_container_; } |
59 | 71 |
| 72 // ui::AnimationDelegate overrides: |
| 73 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 74 |
60 private: | 75 private: |
61 class DelegateView; | 76 class DelegateView; |
62 | 77 |
63 scoped_ptr<LauncherModel> model_; | 78 scoped_ptr<LauncherModel> model_; |
64 | 79 |
65 // Widget hosting the view. | 80 // Widget hosting the view. |
66 scoped_ptr<views::Widget> widget_; | 81 scoped_ptr<views::Widget> widget_; |
67 | 82 |
68 aura::Window* window_container_; | 83 aura::Window* window_container_; |
69 | 84 |
70 // Contents view of the widget. Houses the LauncherView. | 85 // Contents view of the widget. Houses the LauncherView. |
71 DelegateView* delegate_view_; | 86 DelegateView* delegate_view_; |
72 | 87 |
73 // LauncherView used to display icons. | 88 // LauncherView used to display icons. |
74 internal::LauncherView* launcher_view_; | 89 internal::LauncherView* launcher_view_; |
75 | 90 |
76 scoped_ptr<LauncherDelegate> delegate_; | 91 scoped_ptr<LauncherDelegate> delegate_; |
77 | 92 |
| 93 // Used to animate the background. |
| 94 ui::SlideAnimation background_animation_; |
| 95 |
| 96 // Whether we render a background. |
| 97 bool renders_background_; |
| 98 |
| 99 // Current alpha value of the background. |
| 100 int background_alpha_; |
| 101 |
78 DISALLOW_COPY_AND_ASSIGN(Launcher); | 102 DISALLOW_COPY_AND_ASSIGN(Launcher); |
79 }; | 103 }; |
80 | 104 |
81 } // namespace ash | 105 } // namespace ash |
82 | 106 |
83 #endif // ASH_LAUNCHER_LAUNCHER_H_ | 107 #endif // ASH_LAUNCHER_LAUNCHER_H_ |
OLD | NEW |