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