| 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 UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |    5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 
|    6 #define UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |    6 #define UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 
|    7  |    7  | 
|    8 #include <memory> |    8 #include <memory> | 
|    9  |    9  | 
|   10 #include "base/callback.h" |   10 #include "base/callback.h" | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
|   35 class AppListViewTestApi; |   35 class AppListViewTestApi; | 
|   36 } |   36 } | 
|   37  |   37  | 
|   38 // AppListView is the top-level view and controller of app list UI. It creates |   38 // AppListView is the top-level view and controller of app list UI. It creates | 
|   39 // and hosts a AppsGridView and passes AppListModel to it for display. |   39 // and hosts a AppsGridView and passes AppListModel to it for display. | 
|   40 class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, |   40 class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, | 
|   41                                     public SpeechUIModelObserver, |   41                                     public SpeechUIModelObserver, | 
|   42                                     public display::DisplayObserver { |   42                                     public display::DisplayObserver { | 
|   43  public: |   43  public: | 
|   44   enum AppListState { |   44   enum AppListState { | 
|   45     // If set, closes |app_list_main_view_| and dismisses the delegate. |   45     // Closes |app_list_main_view_| and dismisses the delegate. | 
|   46     CLOSED = 0, |   46     CLOSED = 0, | 
|   47  |   47     // The initial state for the app list when neither maximize or side shelf | 
|   48     // The initial state for the app list. If set, the widget will peek over |   48     // modes are active. If set, the widget will peek over the shelf by | 
|   49     // the shelf by kPeekingAppListHeight DIPs. |   49     // kPeekingAppListHeight DIPs. | 
|   50     PEEKING, |   50     PEEKING, | 
|   51  |   51     // Entered when text is entered into the search box from peeking mode. | 
|   52     // If set, the widget will be repositioned to take up the whole screen. |   52     HALF, | 
|   53     FULLSCREEN, |   53     // Default app list state in maximize and side shelf modes. Entered from an | 
 |   54     // upward swipe from |PEEKING| or from clicking the chevron. | 
 |   55     FULLSCREEN_ALL_APPS, | 
 |   56     // Entered from an upward swipe from |HALF| or by entering text in the | 
 |   57     // search box from |FULLSCREEN_ALL_APPS|. | 
 |   58     FULLSCREEN_SEARCH, | 
|   54   }; |   59   }; | 
|   55  |   60  | 
|   56   // Does not take ownership of |delegate|. |   61   // Does not take ownership of |delegate|. | 
|   57   explicit AppListView(AppListViewDelegate* delegate); |   62   explicit AppListView(AppListViewDelegate* delegate); | 
|   58   ~AppListView() override; |   63   ~AppListView() override; | 
|   59  |   64  | 
|   60   // Initializes the widget as a bubble or fullscreen view depending on if the |   65   // Initializes the widget as a bubble or fullscreen view depending on if the | 
|   61   // fullscreen app list feature is set. |parent| and |initial_apps_page| are |   66   // fullscreen app list feature is set. |parent| and |initial_apps_page| are | 
|   62   // used for both the bubble and fullscreen initialization. |   67   // used for both the bubble and fullscreen initialization. |is_maximize_mode| | 
|   63   void Initialize(gfx::NativeView parent, int initial_apps_page); |   68   // is whether the display is in maximize mode and |is_side_shelf| is whether | 
 |   69   // the shelf is oriented on the side, and both are used for fullscreen | 
 |   70   // app list initialization. | 
 |   71   void Initialize(gfx::NativeView parent, | 
 |   72                   int initial_apps_page, | 
 |   73                   bool is_maximize_mode, | 
 |   74                   bool is_side_shelf); | 
|   64  |   75  | 
|   65   void SetBubbleArrow(views::BubbleBorder::Arrow arrow); |   76   void SetBubbleArrow(views::BubbleBorder::Arrow arrow); | 
|   66  |   77  | 
|   67   void MaybeSetAnchorPoint(const gfx::Point& anchor_point); |   78   void MaybeSetAnchorPoint(const gfx::Point& anchor_point); | 
|   68  |   79  | 
|   69   // If |drag_and_drop_host| is not NULL it will be called upon drag and drop |   80   // If |drag_and_drop_host| is not NULL it will be called upon drag and drop | 
|   70   // operations outside the application list. This has to be called after |   81   // operations outside the application list. This has to be called after | 
|   71   // Initialize was called since the app list object needs to exist so that |   82   // Initialize was called since the app list object needs to exist so that | 
|   72   // it can set the host. |   83   // it can set the host. | 
|   73   void SetDragAndDropHostOfCurrentAppList( |   84   void SetDragAndDropHostOfCurrentAppList( | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
|  102   PaginationModel* GetAppsPaginationModel(); |  113   PaginationModel* GetAppsPaginationModel(); | 
|  103  |  114  | 
|  104   // Overridden from views::View: |  115   // Overridden from views::View: | 
|  105   bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |  116   bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 
|  106   void Layout() override; |  117   void Layout() override; | 
|  107   void SchedulePaintInRect(const gfx::Rect& rect) override; |  118   void SchedulePaintInRect(const gfx::Rect& rect) override; | 
|  108  |  119  | 
|  109   // Changes the app list state. |  120   // Changes the app list state. | 
|  110   void SetState(AppListState new_state); |  121   void SetState(AppListState new_state); | 
|  111  |  122  | 
|  112   bool is_fullscreen() const { return app_list_state_ == FULLSCREEN; } |  123   // Changes the app list state depending on the current |app_list_state_| and | 
 |  124   // whether the search box is empty. | 
 |  125   void SetStateFromSearchBoxView(bool search_box_is_empty); | 
 |  126  | 
 |  127   bool is_fullscreen() const { | 
 |  128     return app_list_state_ == FULLSCREEN_ALL_APPS || | 
 |  129            app_list_state_ == FULLSCREEN_SEARCH; | 
 |  130   } | 
 |  131  | 
|  113   AppListState app_list_state() const { return app_list_state_; } |  132   AppListState app_list_state() const { return app_list_state_; } | 
|  114  |  133  | 
 |  134   // Called when maximize mode starts and ends. | 
 |  135   void OnMaximizeModeChanged(bool started); | 
 |  136  | 
|  115  private: |  137  private: | 
|  116   friend class test::AppListViewTestApi; |  138   friend class test::AppListViewTestApi; | 
|  117  |  139  | 
|  118   void InitContents(gfx::NativeView parent, int initial_apps_page); |  140   void InitContents(gfx::NativeView parent, int initial_apps_page); | 
|  119  |  141  | 
|  120   void InitChildWidgets(); |  142   void InitChildWidgets(); | 
|  121  |  143  | 
|  122   // Initializes the widget for fullscreen mode. |  144   // Initializes the widget for fullscreen mode. | 
|  123   void InitializeFullscreen(gfx::NativeView parent, int initial_apps_page); |  145   void InitializeFullscreen(gfx::NativeView parent, int initial_apps_page); | 
|  124  |  146  | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  167   AppListMainView* app_list_main_view_; |  189   AppListMainView* app_list_main_view_; | 
|  168   SpeechView* speech_view_; |  190   SpeechView* speech_view_; | 
|  169   views::Widget* fullscreen_widget_ = nullptr;  // Owned by AppListView. |  191   views::Widget* fullscreen_widget_ = nullptr;  // Owned by AppListView. | 
|  170  |  192  | 
|  171   views::View* search_box_focus_host_;  // Owned by the views hierarchy. |  193   views::View* search_box_focus_host_;  // Owned by the views hierarchy. | 
|  172   views::Widget* search_box_widget_;    // Owned by the app list's widget. |  194   views::Widget* search_box_widget_;    // Owned by the app list's widget. | 
|  173   SearchBoxView* search_box_view_;      // Owned by |search_box_widget_|. |  195   SearchBoxView* search_box_view_;      // Owned by |search_box_widget_|. | 
|  174   // Owned by the app list's widget. Null if the fullscreen app list is not |  196   // Owned by the app list's widget. Null if the fullscreen app list is not | 
|  175   // enabled. |  197   // enabled. | 
|  176   views::View* app_list_background_shield_ = nullptr; |  198   views::View* app_list_background_shield_ = nullptr; | 
 |  199   // Whether maximize mode is active. | 
 |  200   bool is_maximize_mode_ = false; | 
 |  201   // Whether the shelf is oriented on the side. | 
 |  202   bool is_side_shelf_ = false; | 
 |  203  | 
|  177   // The gap between the initial gesture event and the top of the window. |  204   // The gap between the initial gesture event and the top of the window. | 
|  178   gfx::Point initial_drag_point_; |  205   gfx::Point initial_drag_point_; | 
|  179   // The velocity of the gesture event. |  206   // The velocity of the gesture event. | 
|  180   float last_fling_velocity_ = 0; |  207   float last_fling_velocity_ = 0; | 
|  181   // Whether the fullscreen app list feature is enabled. |  208   // Whether the fullscreen app list feature is enabled. | 
|  182   const bool is_fullscreen_app_list_enabled_; |  209   const bool is_fullscreen_app_list_enabled_; | 
|  183   // The state of the app list, controlled via SetState(). |  210   // The state of the app list, controlled via SetState(). | 
|  184   AppListState app_list_state_; |  211   AppListState app_list_state_; | 
|  185  |  212  | 
|  186   // An observer that notifies AppListView when the display has changed. |  213   // An observer that notifies AppListView when the display has changed. | 
|  187   ScopedObserver<display::Screen, display::DisplayObserver> display_observer_; |  214   ScopedObserver<display::Screen, display::DisplayObserver> display_observer_; | 
|  188  |  215  | 
|  189   // A semi-transparent white overlay that covers the app list while dialogs are |  216   // A semi-transparent white overlay that covers the app list while dialogs are | 
|  190   // open. |  217   // open. | 
|  191   views::View* overlay_view_; |  218   views::View* overlay_view_; | 
|  192  |  219  | 
|  193   std::unique_ptr<HideViewAnimationObserver> animation_observer_; |  220   std::unique_ptr<HideViewAnimationObserver> animation_observer_; | 
|  194  |  221  | 
|  195   // For UMA and testing. If non-null, triggered when the app list is painted. |  222   // For UMA and testing. If non-null, triggered when the app list is painted. | 
|  196   base::Closure next_paint_callback_; |  223   base::Closure next_paint_callback_; | 
|  197  |  224  | 
|  198   DISALLOW_COPY_AND_ASSIGN(AppListView); |  225   DISALLOW_COPY_AND_ASSIGN(AppListView); | 
|  199 }; |  226 }; | 
|  200  |  227  | 
|  201 }  // namespace app_list |  228 }  // namespace app_list | 
|  202  |  229  | 
|  203 #endif  // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |  230 #endif  // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 
| OLD | NEW |