Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: ash/wm/app_list_controller.h

Issue 10388032: Move app list from ash to ui. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix nits in #3 Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_WM_APP_LIST_CONTROLLER_H_
6 #define ASH_APP_LIST_APP_LIST_H_ 6 #define ASH_WM_APP_LIST_CONTROLLER_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 "base/timer.h" 11 #include "base/timer.h"
12 #include "ui/aura/event_filter.h" 12 #include "ui/aura/event_filter.h"
13 #include "ui/aura/root_window_observer.h" 13 #include "ui/aura/root_window_observer.h"
14 #include "ui/compositor/layer_animation_observer.h" 14 #include "ui/compositor/layer_animation_observer.h"
15 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
16 16
17 namespace app_list {
18 class AppListView;
19 }
20
17 namespace ash { 21 namespace ash {
18
19 class AppListView;
20
21 namespace internal { 22 namespace internal {
22 23
23 // AppList is a controller that manages app list UI for shell. To show the UI, 24 // AppListController is a controller that manages app list UI for shell.
24 // it requests app list widget from ShellDelegate and shows it when ready. 25 // It creates AppListView and schedules showing/hiding animation.
25 // While the UI is visible, it monitors things such as app list widget's 26 // While the UI is visible, it monitors things such as app list widget's
26 // activation state and desktop mouse click to auto dismiss the UI. 27 // activation state and desktop mouse click to auto dismiss the UI.
27 class AppList : public aura::EventFilter, 28 class AppListController : public aura::EventFilter,
28 public aura::RootWindowObserver, 29 public aura::RootWindowObserver,
29 public ui::ImplicitAnimationObserver, 30 public ui::ImplicitAnimationObserver,
30 public views::Widget::Observer { 31 public views::Widget::Observer {
31 public: 32 public:
32 AppList(); 33 AppListController();
33 virtual ~AppList(); 34 virtual ~AppListController();
34 35
35 // Returns true if AppListV2 is enabled. 36 // Returns true if AppListV2 is enabled.
36 static bool UseAppListV2(); 37 static bool UseAppListV2();
37 38
38 // Show/hide app list window. 39 // Show/hide app list window.
39 void SetVisible(bool visible); 40 void SetVisible(bool visible);
40 41
41 // Whether app list window is visible (shown or being shown). 42 // Whether app list window is visible (shown or being shown).
42 bool IsVisible(); 43 bool IsVisible();
tfarina 2012/05/09 00:34:10 nit: we could we make this function const in a fol
xiyuan 2012/05/09 01:28:46 Done.
43 44
44 // Returns target visibility. This differs from IsVisible() if an animation 45 // Returns target visibility. This differs from IsVisible() if an animation
45 // is ongoing. 46 // is ongoing.
46 bool GetTargetVisibility() const { return is_visible_; } 47 bool GetTargetVisibility() const { return is_visible_; }
47 48
48 // Returns app list window or NULL if it is not visible. 49 // Returns app list window or NULL if it is not visible.
49 aura::Window* GetWindow(); 50 aura::Window* GetWindow();
50 51
51 private: 52 private:
52 // Sets app list view. If we are in visible mode, start showing animation. 53 // Sets app list view. If we are in visible mode, start showing animation.
53 // Otherwise, we just close it. 54 // Otherwise, we just close it.
54 void SetView(AppListView* view); 55 void SetView(app_list::AppListView* view);
55 56
56 // Forgets the view. 57 // Forgets the view.
57 void ResetView(); 58 void ResetView();
58 59
59 // Starts show/hide animation. ScheduleAnimation is the master who manages 60 // Starts show/hide animation. ScheduleAnimation is the master who manages
60 // when to call sub animations. There are three sub animations: background 61 // when to call sub animations. There are three sub animations: background
61 // dimming, browser windows scale/fade and app list scale/fade. The background 62 // dimming, browser windows scale/fade and app list scale/fade. The background
62 // dimming runs in parallel with the other two and spans the whole animation 63 // dimming runs in parallel with the other two and spans the whole animation
63 // time. The rest sub animations run in two steps. On showing, the first step 64 // time. The rest sub animations run in two steps. On showing, the first step
64 // is browser windows scale-out and fade-out and the 2nd step is app list 65 // is browser windows scale-out and fade-out and the 2nd step is app list
(...skipping 26 matching lines...) Expand all
91 // ui::ImplicitAnimationObserver overrides: 92 // ui::ImplicitAnimationObserver overrides:
92 virtual void OnImplicitAnimationsCompleted() OVERRIDE; 93 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
93 94
94 // views::Widget::Observer overrides: 95 // views::Widget::Observer overrides:
95 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; 96 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
96 97
97 // Whether we should show or hide app list widget. 98 // Whether we should show or hide app list widget.
98 bool is_visible_; 99 bool is_visible_;
99 100
100 // The AppListView this class manages, owned by its widget. 101 // The AppListView this class manages, owned by its widget.
101 AppListView* view_; 102 app_list::AppListView* view_;
102 103
103 // Timer to schedule the 2nd step animation, started when the first step 104 // Timer to schedule the 2nd step animation, started when the first step
104 // animation is scheduled in ScheduleAnimation. 105 // animation is scheduled in ScheduleAnimation.
105 base::OneShotTimer<AppList> second_animation_timer_; 106 base::OneShotTimer<AppListController> second_animation_timer_;
106 107
107 DISALLOW_COPY_AND_ASSIGN(AppList); 108 DISALLOW_COPY_AND_ASSIGN(AppListController);
108 }; 109 };
109 110
110 } // namespace internal 111 } // namespace internal
111 } // namespace ash 112 } // namespace ash
112 113
113 #endif // ASH_APP_LIST_APP_LIST_H_ 114 #endif // ASH_WM_APP_LIST_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698