Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: ui/app_list/views/app_list_view.h

Issue 2802903003: Implementation of a full screen app list and re-alphabetized switches (Closed)
Patch Set: Addressed comments, added my tests to the filter, and refactored! Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 20 matching lines...) Expand all
31 31
32 // AppListView is the top-level view and controller of app list UI. It creates 32 // AppListView is the top-level view and controller of app list UI. It creates
33 // and hosts a AppsGridView and passes AppListModel to it for display. 33 // and hosts a AppsGridView and passes AppListModel to it for display.
34 class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView, 34 class APP_LIST_EXPORT AppListView : public views::BubbleDialogDelegateView,
35 public SpeechUIModelObserver { 35 public SpeechUIModelObserver {
36 public: 36 public:
37 // Does not take ownership of |delegate|. 37 // Does not take ownership of |delegate|.
38 explicit AppListView(AppListViewDelegate* delegate); 38 explicit AppListView(AppListViewDelegate* delegate);
39 ~AppListView() override; 39 ~AppListView() override;
40 40
41 // Initializes the widget. 41 // Initializes the widget as a bubble or fullscreen view.
42 void InitAsBubble(gfx::NativeView parent, int initial_apps_page); 42 void Initialize(gfx::NativeView parent,
sky 2017/04/20 21:08:45 Again, can there be just one Initialize() function
newcomer 2017/04/21 19:51:22 Done!
43 int initial_apps_page,
44 const gfx::Rect& display_work_area_bounds);
45
46 // Initializes the widget as a bubble.
47 void Initialize(gfx::NativeView parent,
48 int initial_apps_page);
43 49
44 void SetBubbleArrow(views::BubbleBorder::Arrow arrow); 50 void SetBubbleArrow(views::BubbleBorder::Arrow arrow);
45 51
46 void SetAnchorPoint(const gfx::Point& anchor_point); 52 void MaybeSetAnchorPoint(const gfx::Point& anchor_point);
47 53
48 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop 54 // If |drag_and_drop_host| is not NULL it will be called upon drag and drop
49 // operations outside the application list. This has to be called after 55 // operations outside the application list. This has to be called after
50 // InitAsBubble was called since the app list object needs to exist so that 56 // Initialize was called since the app list object needs to exist so that
51 // it can set the host. 57 // it can set the host.
52 void SetDragAndDropHostOfCurrentAppList( 58 void SetDragAndDropHostOfCurrentAppList(
53 ApplicationDragAndDropHost* drag_and_drop_host); 59 ApplicationDragAndDropHost* drag_and_drop_host);
54 60
55 // Shows the UI when there are no pending icon loads. Otherwise, starts a 61 // Shows the UI when there are no pending icon loads. Otherwise, starts a
56 // timer to show the UI when a maximum allowed wait time has expired. 62 // timer to show the UI when a maximum allowed wait time has expired.
57 void ShowWhenReady(); 63 void ShowWhenReady();
58 64
59 void CloseAppList(); 65 void CloseAppList();
60 66
61 void UpdateBounds(); 67 void UpdateBounds();
62 68
63 // Enables/disables a semi-transparent overlay over the app list (good for 69 // Enables/disables a semi-transparent overlay over the app list (good for
64 // hiding the app list when a modal dialog is being shown). 70 // hiding the app list when a modal dialog is being shown).
65 void SetAppListOverlayVisible(bool visible); 71 void SetAppListOverlayVisible(bool visible);
66 72
67 views::Widget* search_box_widget() const { return search_box_widget_; } 73 views::Widget* search_box_widget() const { return search_box_widget_; }
68 74
69 // Overridden from views::View: 75 // Overridden from views::View:
70 gfx::Size GetPreferredSize() const override; 76 gfx::Size GetPreferredSize() const override;
71 void OnPaint(gfx::Canvas* canvas) override; 77 void OnPaint(gfx::Canvas* canvas) override;
78 const char* GetClassName() const override;
72 79
73 // WidgetDelegate overrides: 80 // WidgetDelegate overrides:
74 bool ShouldHandleSystemCommands() const override; 81 bool ShouldHandleSystemCommands() const override;
75 bool ShouldDescendIntoChildForEventHandling( 82 bool ShouldDescendIntoChildForEventHandling(
76 gfx::NativeView child, 83 gfx::NativeView child,
77 const gfx::Point& location) override; 84 const gfx::Point& location) override;
78 85
79 AppListMainView* app_list_main_view() { return app_list_main_view_; } 86 AppListMainView* app_list_main_view() { return app_list_main_view_; }
80 87
81 // Gets the PaginationModel owned by this view's apps grid. 88 // Gets the PaginationModel owned by this view's apps grid.
82 PaginationModel* GetAppsPaginationModel(); 89 PaginationModel* GetAppsPaginationModel();
83 90
84 // Overridden from views::View: 91 // Overridden from views::View:
85 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; 92 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
86 void Layout() override; 93 void Layout() override;
87 void SchedulePaintInRect(const gfx::Rect& rect) override; 94 void SchedulePaintInRect(const gfx::Rect& rect) override;
88 95
89 private: 96 private:
90 friend class test::AppListViewTestApi; 97 friend class test::AppListViewTestApi;
91 98
92 void InitContents(gfx::NativeView parent, int initial_apps_page); 99 void InitContents(gfx::NativeView parent, int initial_apps_page);
93 100
94 void InitChildWidgets(); 101 void InitChildWidgets();
95 102
103 // Initializes the widget for fullscreen mode.
104 void InitializeFullscreen(gfx::NativeView parent,
105 int initial_apps_page,
vadimt 2017/04/20 20:21:35 Indent doesn't look right...
newcomer 2017/04/21 19:51:22 git cl format, done!
106 const gfx::Rect& display_work_area_bounds);
107
108 // Initializes the widget as a bubble.
109 void InitializeBubble(gfx::NativeView parent, int initial_apps_page);
110
96 // Overridden from views::BubbleDialogDelegateView: 111 // Overridden from views::BubbleDialogDelegateView:
97 void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, 112 void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
98 views::Widget* widget) const override; 113 views::Widget* widget) const override;
99 int GetDialogButtons() const override; 114 int GetDialogButtons() const override;
100 115
101 // Overridden from views::WidgetDelegateView: 116 // Overridden from views::WidgetDelegateView:
102 views::View* GetInitiallyFocusedView() override; 117 views::View* GetInitiallyFocusedView() override;
103 bool WidgetHasHitTestMask() const override; 118 bool WidgetHasHitTestMask() const override;
104 void GetWidgetHitTestMask(gfx::Path* mask) const override; 119 void GetWidgetHitTestMask(gfx::Path* mask) const override;
105 120
106 // Overridden from views::WidgetObserver: 121 // Overridden from views::WidgetObserver:
107 void OnWidgetDestroying(views::Widget* widget) override; 122 void OnWidgetDestroying(views::Widget* widget) override;
108 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; 123 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override;
109 124
110 // Overridden from SpeechUIModelObserver: 125 // Overridden from SpeechUIModelObserver:
111 void OnSpeechRecognitionStateChanged( 126 void OnSpeechRecognitionStateChanged(
112 SpeechRecognitionState new_state) override; 127 SpeechRecognitionState new_state) override;
113 128
114 AppListViewDelegate* delegate_; // Weak. Owned by AppListService. 129 AppListViewDelegate* delegate_; // Weak. Owned by AppListService.
115 130
116 AppListMainView* app_list_main_view_; 131 AppListMainView* app_list_main_view_;
117 SpeechView* speech_view_; 132 SpeechView* speech_view_;
118 133
119 views::View* search_box_focus_host_; // Owned by the views hierarchy. 134 views::View* search_box_focus_host_; // Owned by the views hierarchy.
120 views::Widget* search_box_widget_; // Owned by the app list's widget. 135 views::Widget* search_box_widget_; // Owned by the app list's widget.
121 SearchBoxView* search_box_view_; // Owned by |search_box_widget_|. 136 SearchBoxView* search_box_view_; // Owned by |search_box_widget_|.
122 137
123 // A semi-transparent white overlay that covers the app list while dialogs are 138 // A semi-transparent white overlay that covers the app list while dialogs are
124 // open. 139 // open.
125 views::View* overlay_view_; 140 views::View* overlay_view_;
126 141
127 std::unique_ptr<HideViewAnimationObserver> animation_observer_; 142 std::unique_ptr<HideViewAnimationObserver> animation_observer_;
128 143
129 // For UMA and testing. If non-null, triggered when the app list is painted. 144 // For UMA and testing. If non-null, triggered when the app list is painted.
130 base::Closure next_paint_callback_; 145 base::Closure next_paint_callback_;
131 146
132 DISALLOW_COPY_AND_ASSIGN(AppListView); 147 DISALLOW_COPY_AND_ASSIGN(AppListView);
133 }; 148 };
134 149
135 } // namespace app_list 150 } // namespace app_list
136 151
137 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ 152 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698