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 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/launcher/background_animator.h" | 9 #include "ash/launcher/background_animator.h" |
10 #include "ash/launcher/launcher_types.h" | 10 #include "ash/launcher/launcher_types.h" |
11 #include "ash/shelf_types.h" | 11 #include "ash/shelf_types.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 15 #include "ui/views/widget/widget_observer.h" |
15 | 16 |
16 namespace aura { | 17 namespace aura { |
17 class Window; | 18 class Window; |
18 } | 19 } |
19 | 20 |
20 namespace gfx { | 21 namespace gfx { |
21 class Rect; | 22 class Rect; |
22 } | 23 } |
23 | 24 |
24 namespace views { | 25 namespace views { |
25 class View; | 26 class View; |
26 class Widget; | 27 class Widget; |
27 } | 28 } |
28 | 29 |
29 namespace ash { | 30 namespace ash { |
30 | 31 |
31 namespace internal { | 32 namespace internal { |
32 class FocusCycler; | 33 class FocusCycler; |
33 class LauncherView; | 34 class LauncherView; |
34 class ShelfLayoutManager; | 35 class ShelfLayoutManager; |
35 } | 36 } |
36 | 37 |
37 class LauncherIconObserver; | 38 class LauncherIconObserver; |
38 class LauncherDelegate; | 39 class LauncherDelegate; |
39 class LauncherModel; | 40 class LauncherModel; |
40 | 41 |
41 class ASH_EXPORT Launcher { | 42 class ASH_EXPORT Launcher: public views::WidgetObserver { |
42 public: | 43 public: |
43 Launcher(LauncherModel* launcher_model, | 44 Launcher(LauncherModel* launcher_model, |
44 LauncherDelegate* launcher_delegate, | 45 LauncherDelegate* launcher_delegate, |
45 aura::Window* window_container, | 46 aura::Window* window_container, |
46 internal::ShelfLayoutManager* shelf_layout_manager); | 47 internal::ShelfLayoutManager* shelf_layout_manager); |
47 virtual ~Launcher(); | 48 virtual ~Launcher(); |
48 | 49 |
49 // Return the launcher for the primary display. NULL if no user is | 50 // Return the launcher for the primary display. NULL if no user is |
50 // logged in yet. | 51 // logged in yet. |
51 static Launcher* ForPrimaryDisplay(); | 52 static Launcher* ForPrimaryDisplay(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 internal::LauncherView* GetLauncherViewForTest(); | 118 internal::LauncherView* GetLauncherViewForTest(); |
118 | 119 |
119 LauncherDelegate* delegate() { return delegate_; } | 120 LauncherDelegate* delegate() { return delegate_; } |
120 | 121 |
121 views::Widget* widget() { return widget_.get(); } | 122 views::Widget* widget() { return widget_.get(); } |
122 | 123 |
123 views::Widget* GetDimmerWidgetForTest() { return dimmer_.get(); } | 124 views::Widget* GetDimmerWidgetForTest() { return dimmer_.get(); } |
124 | 125 |
125 aura::Window* window_container() { return window_container_; } | 126 aura::Window* window_container() { return window_container_; } |
126 | 127 |
| 128 // Called by the activation delegate, before the launcher is activated |
| 129 // when no other windows are visible. |
| 130 void WillActivateAsFallback() { activating_as_fallback_ = true; } |
| 131 |
| 132 // Overridden from views::WidgetObserver: |
| 133 void OnWidgetActivationChanged(views::Widget* widget, bool active) OVERRIDE; |
| 134 |
127 private: | 135 private: |
128 class DelegateView; | 136 class DelegateView; |
129 | 137 |
130 // Widget hosting the view. | 138 // Widget hosting the view. |
131 scoped_ptr<views::Widget> widget_; | 139 scoped_ptr<views::Widget> widget_; |
132 scoped_ptr<views::Widget> dimmer_; | 140 scoped_ptr<views::Widget> dimmer_; |
133 | 141 |
134 aura::Window* window_container_; | 142 aura::Window* window_container_; |
135 | 143 |
136 // Contents view of the widget. Houses the LauncherView. | 144 // Contents view of the widget. Houses the LauncherView. |
137 DelegateView* delegate_view_; | 145 DelegateView* delegate_view_; |
138 | 146 |
139 // LauncherView used to display icons. | 147 // LauncherView used to display icons. |
140 internal::LauncherView* launcher_view_; | 148 internal::LauncherView* launcher_view_; |
141 | 149 |
142 ShelfAlignment alignment_; | 150 ShelfAlignment alignment_; |
143 | 151 |
144 LauncherDelegate* delegate_; | 152 LauncherDelegate* delegate_; |
145 | 153 |
146 // Size reserved for the status area. | 154 // Size reserved for the status area. |
147 gfx::Size status_size_; | 155 gfx::Size status_size_; |
148 | 156 |
149 // Used to animate the background. | 157 // Used to animate the background. |
150 internal::BackgroundAnimator background_animator_; | 158 internal::BackgroundAnimator background_animator_; |
151 | 159 |
| 160 // Used then activation is forced from the activation delegate. |
| 161 bool activating_as_fallback_; |
| 162 |
152 DISALLOW_COPY_AND_ASSIGN(Launcher); | 163 DISALLOW_COPY_AND_ASSIGN(Launcher); |
153 }; | 164 }; |
154 | 165 |
155 } // namespace ash | 166 } // namespace ash |
156 | 167 |
157 #endif // ASH_LAUNCHER_LAUNCHER_H_ | 168 #endif // ASH_LAUNCHER_LAUNCHER_H_ |
OLD | NEW |