OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ASH_WM_APP_LIST_SHOWER_DELEGATE_H_ |
| 6 #define ASH_WM_APP_LIST_SHOWER_DELEGATE_H_ |
| 7 |
| 8 #include "ash/ash_export.h" |
| 9 #include "ash/shelf/shelf_icon_observer.h" |
| 10 #include "ash/shell_observer.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" |
| 13 #include "ui/app_list/shower/app_list_shower_delegate.h" |
| 14 #include "ui/events/event_handler.h" |
| 15 #include "ui/keyboard/keyboard_controller_observer.h" |
| 16 |
| 17 namespace app_list { |
| 18 class ApplicationDragAndDropHost; |
| 19 class AppListView; |
| 20 } |
| 21 |
| 22 namespace app_list { |
| 23 class AppListShower; |
| 24 } |
| 25 |
| 26 namespace ui { |
| 27 class LocatedEvent; |
| 28 } |
| 29 |
| 30 namespace ash { |
| 31 namespace test { |
| 32 class AppListShowerAshTestApi; |
| 33 } |
| 34 |
| 35 class AppListViewDelegateFactory; |
| 36 |
| 37 // Responsible for laying out the app list UI as well as updating the Shelf |
| 38 // launch icon as the state of the app list changes. Listens to shell events |
| 39 // and touches/mouse clicks outside the app list to auto dismiss the UI or |
| 40 // update its layout as necessary. |
| 41 class ASH_EXPORT AppListShowerDelegate |
| 42 : public app_list::AppListShowerDelegate, |
| 43 public ui::EventHandler, |
| 44 public keyboard::KeyboardControllerObserver, |
| 45 public ShellObserver, |
| 46 public ShelfIconObserver { |
| 47 public: |
| 48 AppListShowerDelegate(app_list::AppListShower* shower, |
| 49 AppListViewDelegateFactory* view_delegate_factory); |
| 50 ~AppListShowerDelegate() override; |
| 51 |
| 52 // app_list::AppListShowerDelegate: |
| 53 app_list::AppListViewDelegate* GetViewDelegate() override; |
| 54 void Init(app_list::AppListView* view, |
| 55 aura::Window* root_window, |
| 56 int current_apps_page) override; |
| 57 void OnShown(aura::Window* root_window) override; |
| 58 void OnDismissed() override; |
| 59 void UpdateBounds() override; |
| 60 gfx::Vector2d GetVisibilityAnimationOffset( |
| 61 aura::Window* root_window) override; |
| 62 |
| 63 private: |
| 64 void ProcessLocatedEvent(ui::LocatedEvent* event); |
| 65 |
| 66 // ui::EventHandler overrides: |
| 67 void OnMouseEvent(ui::MouseEvent* event) override; |
| 68 void OnGestureEvent(ui::GestureEvent* event) override; |
| 69 |
| 70 // KeyboardControllerObserver overrides: |
| 71 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; |
| 72 |
| 73 // ShellObserver overrides: |
| 74 void OnShelfAlignmentChanged(aura::Window* root_window) override; |
| 75 void OnMaximizeModeStarted() override; |
| 76 void OnMaximizeModeEnded() override; |
| 77 |
| 78 // ShelfIconObserver overrides: |
| 79 void OnShelfIconPositionsChanged() override; |
| 80 |
| 81 // Whether the app list is visible (or in the process of being shown). |
| 82 bool is_visible_ = false; |
| 83 |
| 84 // Whether the app list should remain centered. |
| 85 bool is_centered_ = false; |
| 86 |
| 87 // Not owned. Pointer is guaranteed to be valid while this object is alive. |
| 88 app_list::AppListShower* shower_; |
| 89 |
| 90 // Not owned. Pointer is guaranteed to be valid while this object is alive. |
| 91 AppListViewDelegateFactory* view_delegate_factory_; |
| 92 |
| 93 // The AppListView this class manages, owned by its widget. |
| 94 app_list::AppListView* view_ = nullptr; |
| 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(AppListShowerDelegate); |
| 97 }; |
| 98 |
| 99 } // namespace ash |
| 100 |
| 101 #endif // ASH_WM_APP_LIST_SHOWER_DELEGATE_H_ |
OLD | NEW |