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_APP_LIST_APP_LIST_H_ | 5 #ifndef ASH_APP_LIST_APP_LIST_H_ |
6 #define ASH_APP_LIST_APP_LIST_H_ | 6 #define ASH_APP_LIST_APP_LIST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "ui/aura/event_filter.h" | 11 #include "ui/aura/event_filter.h" |
12 #include "ui/aura/root_window_observer.h" | 12 #include "ui/aura/root_window_observer.h" |
13 #include "ui/gfx/compositor/layer_animation_observer.h" | 13 #include "ui/gfx/compositor/layer_animation_observer.h" |
14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
| 17 |
| 18 class AppListView; |
| 19 |
17 namespace internal { | 20 namespace internal { |
18 | 21 |
19 // AppList is a controller that manages app list UI for shell. To show the UI, | 22 // AppList is a controller that manages app list UI for shell. To show the UI, |
20 // it requests app list widget from ShellDelegate and shows it when ready. | 23 // it requests app list widget from ShellDelegate and shows it when ready. |
21 // While the UI is visible, it monitors things such as app list widget's | 24 // While the UI is visible, it monitors things such as app list widget's |
22 // activation state and desktop mouse click to auto dismiss the UI. | 25 // activation state and desktop mouse click to auto dismiss the UI. |
23 class AppList : public aura::EventFilter, | 26 class AppList : public aura::EventFilter, |
24 public aura::RootWindowObserver, | 27 public aura::RootWindowObserver, |
25 public ui::ImplicitAnimationObserver, | 28 public ui::ImplicitAnimationObserver, |
26 public views::Widget::Observer { | 29 public views::Widget::Observer { |
27 public: | 30 public: |
28 AppList(); | 31 AppList(); |
29 virtual ~AppList(); | 32 virtual ~AppList(); |
30 | 33 |
31 // Show/hide app list window. | 34 // Show/hide app list window. |
32 void SetVisible(bool visible); | 35 void SetVisible(bool visible); |
33 | 36 |
34 // Whether app list window is visible (shown or being shown). | 37 // Whether app list window is visible (shown or being shown). |
35 bool IsVisible(); | 38 bool IsVisible(); |
36 | 39 |
37 private: | 40 private: |
38 // Sets app list widget. If we are in visible mode, start showing animation. | 41 // Sets app list view. If we are in visible mode, start showing animation. |
39 // Otherwise, we just close the widget. | 42 // Otherwise, we just close it. |
40 void SetWidget(views::Widget* widget); | 43 void SetView(AppListView* view); |
41 | 44 |
42 // Forgets the widget. | 45 // Forgets the view. |
43 void ResetWidget(); | 46 void ResetView(); |
44 | 47 |
45 // Starts show/hide animation. | 48 // Starts show/hide animation. |
46 void ScheduleAnimation(); | 49 void ScheduleAnimation(); |
47 | 50 |
48 // aura::EventFilter overrides: | 51 // aura::EventFilter overrides: |
49 virtual bool PreHandleKeyEvent(aura::Window* target, | 52 virtual bool PreHandleKeyEvent(aura::Window* target, |
50 aura::KeyEvent* event) OVERRIDE; | 53 aura::KeyEvent* event) OVERRIDE; |
51 virtual bool PreHandleMouseEvent(aura::Window* target, | 54 virtual bool PreHandleMouseEvent(aura::Window* target, |
52 aura::MouseEvent* event) OVERRIDE; | 55 aura::MouseEvent* event) OVERRIDE; |
53 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, | 56 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, |
54 aura::TouchEvent* event) OVERRIDE; | 57 aura::TouchEvent* event) OVERRIDE; |
55 virtual ui::GestureStatus PreHandleGestureEvent( | 58 virtual ui::GestureStatus PreHandleGestureEvent( |
56 aura::Window* target, | 59 aura::Window* target, |
57 aura::GestureEvent* event) OVERRIDE; | 60 aura::GestureEvent* event) OVERRIDE; |
58 | 61 |
59 // aura::RootWindowObserver overrides: | 62 // aura::RootWindowObserver overrides: |
60 virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE; | 63 virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE; |
61 | 64 |
62 // ui::ImplicitAnimationObserver overrides: | 65 // ui::ImplicitAnimationObserver overrides: |
63 virtual void OnImplicitAnimationsCompleted() OVERRIDE; | 66 virtual void OnImplicitAnimationsCompleted() OVERRIDE; |
64 | 67 |
65 // views::Widget::Observer overrides: | 68 // views::Widget::Observer overrides: |
66 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 69 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
67 virtual void OnWidgetActivationChanged(views::Widget* widget, | 70 virtual void OnWidgetActivationChanged(views::Widget* widget, |
68 bool active) OVERRIDE; | 71 bool active) OVERRIDE; |
69 | 72 |
70 // Whether we should show or hide app list widget. | 73 // Whether we should show or hide app list widget. |
71 bool is_visible_; | 74 bool is_visible_; |
72 | 75 |
73 // App list widget we get from ShellDelegate. | 76 // The AppListView this class manages, owned by its widget. |
74 views::Widget* widget_; | 77 AppListView* view_; |
75 | 78 |
76 DISALLOW_COPY_AND_ASSIGN(AppList); | 79 DISALLOW_COPY_AND_ASSIGN(AppList); |
77 }; | 80 }; |
78 | 81 |
79 } // namespace internal | 82 } // namespace internal |
80 } // namespace ash | 83 } // namespace ash |
81 | 84 |
82 #endif // ASH_APP_LIST_APP_LIST_H_ | 85 #endif // ASH_APP_LIST_APP_LIST_H_ |
OLD | NEW |