| 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_WM_APP_LIST_CONTROLLER_H_ | 5 #ifndef ASH_WM_APP_LIST_CONTROLLER_H_ |
| 6 #define ASH_WM_APP_LIST_CONTROLLER_H_ | 6 #define ASH_WM_APP_LIST_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ash/shell_observer.h" | 9 #include "ash/shell_observer.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class AppListController : public aura::EventFilter, | 30 class AppListController : public aura::EventFilter, |
| 31 public aura::FocusChangeObserver, | 31 public aura::FocusChangeObserver, |
| 32 public aura::RootWindowObserver, | 32 public aura::RootWindowObserver, |
| 33 public ui::ImplicitAnimationObserver, | 33 public ui::ImplicitAnimationObserver, |
| 34 public views::Widget::Observer, | 34 public views::Widget::Observer, |
| 35 public ShellObserver { | 35 public ShellObserver { |
| 36 public: | 36 public: |
| 37 AppListController(); | 37 AppListController(); |
| 38 virtual ~AppListController(); | 38 virtual ~AppListController(); |
| 39 | 39 |
| 40 // Returns true if AppListV2 is enabled. | |
| 41 static bool UseAppListV2(); | |
| 42 | |
| 43 // Show/hide app list window. | 40 // Show/hide app list window. |
| 44 void SetVisible(bool visible); | 41 void SetVisible(bool visible); |
| 45 | 42 |
| 46 // Whether app list window is visible (shown or being shown). | 43 // Whether app list window is visible (shown or being shown). |
| 47 bool IsVisible() const; | 44 bool IsVisible() const; |
| 48 | 45 |
| 49 // Returns target visibility. This differs from IsVisible() if an animation | 46 // Returns target visibility. This differs from IsVisible() if an animation |
| 50 // is ongoing. | 47 // is ongoing. |
| 51 bool GetTargetVisibility() const { return is_visible_; } | 48 bool GetTargetVisibility() const { return is_visible_; } |
| 52 | 49 |
| 53 // Returns app list window or NULL if it is not visible. | 50 // Returns app list window or NULL if it is not visible. |
| 54 aura::Window* GetWindow(); | 51 aura::Window* GetWindow(); |
| 55 | 52 |
| 56 private: | 53 private: |
| 57 // Sets app list view. If we are in visible mode, start showing animation. | 54 // Sets app list view. If we are in visible mode, start showing animation. |
| 58 // Otherwise, we just close it. | 55 // Otherwise, we just close it. |
| 59 void SetView(app_list::AppListView* view); | 56 void SetView(app_list::AppListView* view); |
| 60 | 57 |
| 61 // Forgets the view. | 58 // Forgets the view. |
| 62 void ResetView(); | 59 void ResetView(); |
| 63 | 60 |
| 64 // Starts show/hide animation. ScheduleAnimation is the master who manages | 61 // Starts show/hide animation. |
| 65 // when to call sub animations. There are three sub animations: background | |
| 66 // dimming, browser windows scale/fade and app list scale/fade. The background | |
| 67 // dimming runs in parallel with the other two and spans the whole animation | |
| 68 // time. The rest sub animations run in two steps. On showing, the first step | |
| 69 // is browser windows scale-out and fade-out and the 2nd step is app list | |
| 70 // scale-in and fade-in. The 2nd step animation is started via a timer and | |
| 71 // there is is a little overlap between the two animations. Hiding animation | |
| 72 // is the reverse of the showing animation. | |
| 73 void ScheduleAnimation(); | 62 void ScheduleAnimation(); |
| 74 | 63 |
| 75 void ScheduleBrowserWindowsAnimationForContainer(aura::Window* container); | |
| 76 void ScheduleBrowserWindowsAnimation(); | |
| 77 void ScheduleDimmingAnimation(); | |
| 78 void ScheduleAppListAnimation(); | |
| 79 | |
| 80 // aura::EventFilter overrides: | 64 // aura::EventFilter overrides: |
| 81 virtual bool PreHandleKeyEvent(aura::Window* target, | 65 virtual bool PreHandleKeyEvent(aura::Window* target, |
| 82 aura::KeyEvent* event) OVERRIDE; | 66 aura::KeyEvent* event) OVERRIDE; |
| 83 virtual bool PreHandleMouseEvent(aura::Window* target, | 67 virtual bool PreHandleMouseEvent(aura::Window* target, |
| 84 aura::MouseEvent* event) OVERRIDE; | 68 aura::MouseEvent* event) OVERRIDE; |
| 85 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, | 69 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, |
| 86 aura::TouchEvent* event) OVERRIDE; | 70 aura::TouchEvent* event) OVERRIDE; |
| 87 virtual ui::GestureStatus PreHandleGestureEvent( | 71 virtual ui::GestureStatus PreHandleGestureEvent( |
| 88 aura::Window* target, | 72 aura::Window* target, |
| 89 aura::GestureEvent* event) OVERRIDE; | 73 aura::GestureEvent* event) OVERRIDE; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 114 // animation is scheduled in ScheduleAnimation. | 98 // animation is scheduled in ScheduleAnimation. |
| 115 base::OneShotTimer<AppListController> second_animation_timer_; | 99 base::OneShotTimer<AppListController> second_animation_timer_; |
| 116 | 100 |
| 117 DISALLOW_COPY_AND_ASSIGN(AppListController); | 101 DISALLOW_COPY_AND_ASSIGN(AppListController); |
| 118 }; | 102 }; |
| 119 | 103 |
| 120 } // namespace internal | 104 } // namespace internal |
| 121 } // namespace ash | 105 } // namespace ash |
| 122 | 106 |
| 123 #endif // ASH_WM_APP_LIST_CONTROLLER_H_ | 107 #endif // ASH_WM_APP_LIST_CONTROLLER_H_ |
| OLD | NEW |