Chromium Code Reviews| Index: ui/app_list/views/app_list_view.h | 
| diff --git a/ui/app_list/views/app_list_view.h b/ui/app_list/views/app_list_view.h | 
| index 3b6571411d9f20e5bd753b8cf8e0cf31133b338d..766bf6a19f5f747e18ae3757e37ba64a16aa3f61 100644 | 
| --- a/ui/app_list/views/app_list_view.h | 
| +++ b/ui/app_list/views/app_list_view.h | 
| @@ -9,12 +9,18 @@ | 
| #include "base/callback.h" | 
| #include "base/macros.h" | 
| +#include "base/scoped_observer.h" | 
| #include "build/build_config.h" | 
| #include "ui/app_list/app_list_export.h" | 
| #include "ui/app_list/speech_ui_model_observer.h" | 
| +#include "ui/display/display_observer.h" | 
| #include "ui/views/bubble/bubble_dialog_delegate.h" | 
| #include "ui/views/widget/widget.h" | 
| +namespace display { | 
| +class Screen; | 
| +} | 
| + | 
| namespace app_list { | 
| class ApplicationDragAndDropHost; | 
| class AppListMainView; | 
| @@ -32,8 +38,11 @@ class AppListViewTestApi; | 
| // AppListView is the top-level view and controller of app list UI. It creates | 
| // and hosts a AppsGridView and passes AppListModel to it for display. | 
| class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, | 
| - public SpeechUIModelObserver { | 
| + public SpeechUIModelObserver, | 
| + public display::DisplayObserver { | 
| public: | 
| + enum AppListState { INITIAL = 0, PEEKING, FULLSCREEN }; | 
| 
 
msw
2017/06/07 02:31:39
Comment on this enum and each of its states, the c
 
newcomer
2017/06/07 17:21:37
Done.
 
 | 
| + | 
| // Does not take ownership of |delegate|. | 
| explicit AppListView(AppListViewDelegate* delegate); | 
| ~AppListView() override; | 
| @@ -89,6 +98,13 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, | 
| void Layout() override; | 
| void SchedulePaintInRect(const gfx::Rect& rect) override; | 
| + // Changes the view to the peeking state or to the fullscreen state. | 
| + void ToFullscreen(); | 
| 
 
msw
2017/06/07 02:31:39
Remove these now that we have ChangeState/SetState
 
newcomer
2017/06/07 17:21:38
Done.
 
 | 
| + void ToPeeking(); | 
| + void ChangeState(AppListState new_state); | 
| 
 
msw
2017/06/07 02:31:39
Rename this SetState
 
newcomer
2017/06/07 17:21:38
Done.
 
 | 
| + | 
| + bool IsFullscreen() const; | 
| 
 
msw
2017/06/07 02:31:39
Change this to |AppListState app_list_state() cons
 
newcomer
2017/06/07 17:21:38
I think having both is a good idea. Thanks!
 
 | 
| + | 
| private: | 
| friend class test::AppListViewTestApi; | 
| @@ -102,6 +118,17 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, | 
| // Initializes the widget as a bubble. | 
| void InitializeBubble(gfx::NativeView parent, int initial_apps_page); | 
| + // Initializes |initial_drag_point_|. | 
| + void StartDrag(const gfx::Point& location); | 
| + | 
| + // Updates the bounds of the widget while maintaining the relative position | 
| + // of the top of the widget and the gesture. | 
| + void UpdateDrag(const gfx::Point& location); | 
| + | 
| + // Handles app list state transfers. If the drag was fast enough, ignore the | 
| + // release position and snap to the next state. | 
| + void EndDrag(const gfx::Point& location); | 
| + | 
| // Overridden from views::BubbleDialogDelegateView: | 
| void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, | 
| views::Widget* widget) const override; | 
| @@ -112,6 +139,10 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, | 
| bool WidgetHasHitTestMask() const override; | 
| void GetWidgetHitTestMask(gfx::Path* mask) const override; | 
| + // Overridden from ui::EventHandler: | 
| + void OnMouseEvent(ui::MouseEvent* event) override; | 
| + void OnGestureEvent(ui::GestureEvent* event) override; | 
| + | 
| // Overridden from views::WidgetObserver: | 
| void OnWidgetDestroying(views::Widget* widget) override; | 
| void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; | 
| @@ -120,14 +151,43 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, | 
| void OnSpeechRecognitionStateChanged( | 
| SpeechRecognitionState new_state) override; | 
| + // Overridden from DisplayObserver: | 
| + void OnDisplayMetricsChanged(const display::Display& display, | 
| + uint32_t changed_metrics) override; | 
| + | 
| AppListViewDelegate* delegate_; // Weak. Owned by AppListService. | 
| AppListMainView* app_list_main_view_; | 
| SpeechView* speech_view_; | 
| + views::Widget* fullscreen_widget_ = nullptr; // Owned by AppListView. | 
| views::View* search_box_focus_host_; // Owned by the views hierarchy. | 
| views::Widget* search_box_widget_; // Owned by the app list's widget. | 
| SearchBoxView* search_box_view_; // Owned by |search_box_widget_|. | 
| + // Owned by the app list's widget. Null if the fullscreen app list is not | 
| + // enabled. | 
| + views::View* app_list_background_shield_ = nullptr; | 
| + // The gap between the initial gesture event and the top of the window. | 
| + gfx::Point initial_drag_point_; | 
| + // The velocity of the gesture event. | 
| + float last_fling_velocity_ = 0; | 
| + // The default y coordinate of the current state of the app list. Changes | 
| + // based on the app list state and screen orientation. | 
| + int default_peeking_y_ = 0; | 
| 
 
msw
2017/06/07 02:31:39
Remove this, it's no longer used.
 
newcomer
2017/06/07 17:21:38
Done.
 
 | 
| + bool is_fullscreen_app_list_ = false; | 
| 
 
msw
2017/06/07 02:31:39
Remove this, it's no longer used.
 
newcomer
2017/06/07 17:21:38
Done.
 
 | 
| + // Flag temporarily used to prevent repeated calls to | 
| + // features::IsFullscreenAppListEnabled. | 
| + bool is_fullscreen_app_list_enabled_ = false; | 
| 
 
msw
2017/06/07 02:31:39
Move this to a file-local function in cc file's an
 
newcomer
2017/06/07 17:21:38
Done.
 
 | 
| + // The desktop area, not including the shelf. | 
| + gfx::Rect display_work_area_bounds_; | 
| 
 
msw
2017/06/07 02:31:39
Remove this, it's no longer used.
 
newcomer
2017/06/07 17:21:38
Done.
 
 | 
| + // The bounds of the app list. The size should never change, only the | 
| + // position. | 
| + gfx::Rect fullscreen_widget_bounds_; | 
| 
 
msw
2017/06/07 02:31:39
Remove this, it's no longer used.
 
newcomer
2017/06/07 17:21:37
Done.
 
 | 
| + // The state of the app list, controlled via ChangeState(). | 
| 
 
msw
2017/06/07 02:31:39
Update ChangeState -> SetState if you accept that
 
newcomer
2017/06/07 17:21:37
Done.
 
 | 
| + AppListState app_list_state_; | 
| 
 
msw
2017/06/07 02:31:39
Initialize this value here or in the constructor.
 
newcomer
2017/06/07 17:21:38
Initialized in the constructor.
 
 | 
| + | 
| + // An observer that notifies AppListView when the display has changed. | 
| + ScopedObserver<display::Screen, display::DisplayObserver> display_observer_; | 
| // A semi-transparent white overlay that covers the app list while dialogs are | 
| // open. |