| 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/wm/shelf_types.h" | 11 #include "ash/wm/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(aura::Window* window_container, | 44 Launcher(aura::Window* window_container, |
| 44 internal::ShelfLayoutManager* shelf_layout_manager); | 45 internal::ShelfLayoutManager* shelf_layout_manager); |
| 45 virtual ~Launcher(); | 46 virtual ~Launcher(); |
| 46 | 47 |
| 47 // Return the launcher for the primary display. NULL if no user is | 48 // Return the launcher for the primary display. NULL if no user is |
| 48 // logged in yet. | 49 // logged in yet. |
| 49 static Launcher* ForPrimaryDisplay(); | 50 static Launcher* ForPrimaryDisplay(); |
| 50 | 51 |
| 51 // Return the launcher for the display that |window| is currently on, | 52 // Return the launcher for the display that |window| is currently on, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 113 |
| 113 LauncherDelegate* delegate() { return delegate_.get(); } | 114 LauncherDelegate* delegate() { return delegate_.get(); } |
| 114 | 115 |
| 115 LauncherModel* model() { return model_.get(); } | 116 LauncherModel* model() { return model_.get(); } |
| 116 views::Widget* widget() { return widget_.get(); } | 117 views::Widget* widget() { return widget_.get(); } |
| 117 | 118 |
| 118 views::Widget* GetDimmerWidgetForTest() { return dimmer_.get(); } | 119 views::Widget* GetDimmerWidgetForTest() { return dimmer_.get(); } |
| 119 | 120 |
| 120 aura::Window* window_container() { return window_container_; } | 121 aura::Window* window_container() { return window_container_; } |
| 121 | 122 |
| 123 // Called by the activation delegate, before the launcher is activated |
| 124 // when no other windows are visible. |
| 125 void WillActivateAsFallback() { activating_as_fallback_ = true; } |
| 126 |
| 127 // Overridden from views::WidgetObserver: |
| 128 void OnWidgetActivationChanged(views::Widget* widget, bool active); |
| 129 |
| 122 private: | 130 private: |
| 123 class DelegateView; | 131 class DelegateView; |
| 124 | 132 |
| 125 scoped_ptr<LauncherModel> model_; | 133 scoped_ptr<LauncherModel> model_; |
| 126 | 134 |
| 127 // Widget hosting the view. | 135 // Widget hosting the view. |
| 128 scoped_ptr<views::Widget> widget_; | 136 scoped_ptr<views::Widget> widget_; |
| 129 scoped_ptr<views::Widget> dimmer_; | 137 scoped_ptr<views::Widget> dimmer_; |
| 130 | 138 |
| 131 aura::Window* window_container_; | 139 aura::Window* window_container_; |
| 132 | 140 |
| 133 // Contents view of the widget. Houses the LauncherView. | 141 // Contents view of the widget. Houses the LauncherView. |
| 134 DelegateView* delegate_view_; | 142 DelegateView* delegate_view_; |
| 135 | 143 |
| 136 // LauncherView used to display icons. | 144 // LauncherView used to display icons. |
| 137 internal::LauncherView* launcher_view_; | 145 internal::LauncherView* launcher_view_; |
| 138 | 146 |
| 139 ShelfAlignment alignment_; | 147 ShelfAlignment alignment_; |
| 140 | 148 |
| 141 scoped_ptr<LauncherDelegate> delegate_; | 149 scoped_ptr<LauncherDelegate> delegate_; |
| 142 | 150 |
| 143 // Size reserved for the status area. | 151 // Size reserved for the status area. |
| 144 gfx::Size status_size_; | 152 gfx::Size status_size_; |
| 145 | 153 |
| 146 // Used to animate the background. | 154 // Used to animate the background. |
| 147 internal::BackgroundAnimator background_animator_; | 155 internal::BackgroundAnimator background_animator_; |
| 148 | 156 |
| 157 // Used then activation is forced from the activation delegate. |
| 158 bool activating_as_fallback_; |
| 159 |
| 149 DISALLOW_COPY_AND_ASSIGN(Launcher); | 160 DISALLOW_COPY_AND_ASSIGN(Launcher); |
| 150 }; | 161 }; |
| 151 | 162 |
| 152 } // namespace ash | 163 } // namespace ash |
| 153 | 164 |
| 154 #endif // ASH_LAUNCHER_LAUNCHER_H_ | 165 #endif // ASH_LAUNCHER_LAUNCHER_H_ |
| OLD | NEW |