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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 class SpeechView; | 38 class SpeechView; |
39 | 39 |
40 // AppListView is the top-level view and controller of app list UI. It creates | 40 // AppListView is the top-level view and controller of app list UI. It creates |
41 // and hosts a AppsGridView and passes AppListModel to it for display. | 41 // and hosts a AppsGridView and passes AppListModel to it for display. |
42 class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView, | 42 class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView, |
43 public AppListViewDelegateObserver, | 43 public AppListViewDelegateObserver, |
44 public SpeechUIModelObserver { | 44 public SpeechUIModelObserver { |
45 public: | 45 public: |
46 // Does not take ownership of |delegate|. | 46 // Does not take ownership of |delegate|. |
47 explicit AppListView(AppListViewDelegate* delegate); | 47 explicit AppListView(AppListViewDelegate* delegate); |
48 virtual ~AppListView(); | 48 ~AppListView() override; |
49 | 49 |
50 // Initializes the widget and use a given |anchor| plus an |anchor_offset| for | 50 // Initializes the widget and use a given |anchor| plus an |anchor_offset| for |
51 // positioning. | 51 // positioning. |
52 void InitAsBubbleAttachedToAnchor(gfx::NativeView parent, | 52 void InitAsBubbleAttachedToAnchor(gfx::NativeView parent, |
53 int initial_apps_page, | 53 int initial_apps_page, |
54 views::View* anchor, | 54 views::View* anchor, |
55 const gfx::Vector2d& anchor_offset, | 55 const gfx::Vector2d& anchor_offset, |
56 views::BubbleBorder::Arrow arrow, | 56 views::BubbleBorder::Arrow arrow, |
57 bool border_accepts_events); | 57 bool border_accepts_events); |
58 | 58 |
(...skipping 25 matching lines...) Expand all Loading... |
84 void UpdateBounds(); | 84 void UpdateBounds(); |
85 | 85 |
86 // Enables/disables a semi-transparent overlay over the app list (good for | 86 // Enables/disables a semi-transparent overlay over the app list (good for |
87 // hiding the app list when a modal dialog is being shown). | 87 // hiding the app list when a modal dialog is being shown). |
88 void SetAppListOverlayVisible(bool visible); | 88 void SetAppListOverlayVisible(bool visible); |
89 | 89 |
90 // Returns true if the app list should be centered and in landscape mode. | 90 // Returns true if the app list should be centered and in landscape mode. |
91 bool ShouldCenterWindow() const; | 91 bool ShouldCenterWindow() const; |
92 | 92 |
93 // Overridden from views::View: | 93 // Overridden from views::View: |
94 virtual gfx::Size GetPreferredSize() const override; | 94 gfx::Size GetPreferredSize() const override; |
95 virtual void Paint(gfx::Canvas* canvas, | 95 void Paint(gfx::Canvas* canvas, const views::CullSet& cull_set) override; |
96 const views::CullSet& cull_set) override; | 96 void OnThemeChanged() override; |
97 virtual void OnThemeChanged() override; | |
98 | 97 |
99 // WidgetDelegate overrides: | 98 // WidgetDelegate overrides: |
100 virtual bool ShouldHandleSystemCommands() const override; | 99 bool ShouldHandleSystemCommands() const override; |
101 | 100 |
102 // Overridden from AppListViewDelegateObserver: | 101 // Overridden from AppListViewDelegateObserver: |
103 virtual void OnProfilesChanged() override; | 102 void OnProfilesChanged() override; |
104 virtual void OnShutdown() override; | 103 void OnShutdown() override; |
105 | 104 |
106 void Prerender(); | 105 void Prerender(); |
107 | 106 |
108 void SetProfileByPath(const base::FilePath& profile_path); | 107 void SetProfileByPath(const base::FilePath& profile_path); |
109 | 108 |
110 void AddObserver(AppListViewObserver* observer); | 109 void AddObserver(AppListViewObserver* observer); |
111 void RemoveObserver(AppListViewObserver* observer); | 110 void RemoveObserver(AppListViewObserver* observer); |
112 | 111 |
113 // Set a callback to be called the next time any app list paints. | 112 // Set a callback to be called the next time any app list paints. |
114 void SetNextPaintCallback(const base::Closure& callback); | 113 void SetNextPaintCallback(const base::Closure& callback); |
(...skipping 10 matching lines...) Expand all Loading... |
125 private: | 124 private: |
126 friend class ::test::AppListViewTestApi; | 125 friend class ::test::AppListViewTestApi; |
127 | 126 |
128 void InitAsBubbleInternal(gfx::NativeView parent, | 127 void InitAsBubbleInternal(gfx::NativeView parent, |
129 int initial_apps_page, | 128 int initial_apps_page, |
130 views::BubbleBorder::Arrow arrow, | 129 views::BubbleBorder::Arrow arrow, |
131 bool border_accepts_events, | 130 bool border_accepts_events, |
132 const gfx::Vector2d& anchor_offset); | 131 const gfx::Vector2d& anchor_offset); |
133 | 132 |
134 // Overridden from views::BubbleDelegateView: | 133 // Overridden from views::BubbleDelegateView: |
135 virtual void OnBeforeBubbleWidgetInit( | 134 void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, |
136 views::Widget::InitParams* params, | 135 views::Widget* widget) const override; |
137 views::Widget* widget) const override; | |
138 | 136 |
139 // Overridden from views::WidgetDelegateView: | 137 // Overridden from views::WidgetDelegateView: |
140 virtual views::View* GetInitiallyFocusedView() override; | 138 views::View* GetInitiallyFocusedView() override; |
141 virtual gfx::ImageSkia GetWindowIcon() override; | 139 gfx::ImageSkia GetWindowIcon() override; |
142 virtual bool WidgetHasHitTestMask() const override; | 140 bool WidgetHasHitTestMask() const override; |
143 virtual void GetWidgetHitTestMask(gfx::Path* mask) const override; | 141 void GetWidgetHitTestMask(gfx::Path* mask) const override; |
144 | 142 |
145 // Overridden from views::View: | 143 // Overridden from views::View: |
146 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 144 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
147 virtual void Layout() override; | 145 void Layout() override; |
148 virtual void SchedulePaintInRect(const gfx::Rect& rect) override; | 146 void SchedulePaintInRect(const gfx::Rect& rect) override; |
149 | 147 |
150 // Overridden from views::WidgetObserver: | 148 // Overridden from views::WidgetObserver: |
151 virtual void OnWidgetDestroying(views::Widget* widget) override; | 149 void OnWidgetDestroying(views::Widget* widget) override; |
152 virtual void OnWidgetVisibilityChanged( | 150 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; |
153 views::Widget* widget, bool visible) override; | 151 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; |
154 virtual void OnWidgetActivationChanged( | |
155 views::Widget* widget, bool active) override; | |
156 | 152 |
157 // Overridden from SpeechUIModelObserver: | 153 // Overridden from SpeechUIModelObserver: |
158 virtual void OnSpeechRecognitionStateChanged( | 154 void OnSpeechRecognitionStateChanged( |
159 SpeechRecognitionState new_state) override; | 155 SpeechRecognitionState new_state) override; |
160 | 156 |
161 AppListViewDelegate* delegate_; // Weak. Owned by AppListService. | 157 AppListViewDelegate* delegate_; // Weak. Owned by AppListService. |
162 | 158 |
163 AppListMainView* app_list_main_view_; | 159 AppListMainView* app_list_main_view_; |
164 SearchBoxView* search_box_view_; | 160 SearchBoxView* search_box_view_; |
165 SpeechView* speech_view_; | 161 SpeechView* speech_view_; |
166 | 162 |
167 // The red "experimental" banner for the experimental app list. | 163 // The red "experimental" banner for the experimental app list. |
168 views::ImageView* experimental_banner_view_; | 164 views::ImageView* experimental_banner_view_; |
169 | 165 |
170 // A semi-transparent white overlay that covers the app list while dialogs are | 166 // A semi-transparent white overlay that covers the app list while dialogs are |
171 // open. | 167 // open. |
172 views::View* overlay_view_; | 168 views::View* overlay_view_; |
173 | 169 |
174 ObserverList<AppListViewObserver> observers_; | 170 ObserverList<AppListViewObserver> observers_; |
175 scoped_ptr<HideViewAnimationObserver> animation_observer_; | 171 scoped_ptr<HideViewAnimationObserver> animation_observer_; |
176 | 172 |
177 // For UMA and testing. If non-null, triggered when the app list is painted. | 173 // For UMA and testing. If non-null, triggered when the app list is painted. |
178 base::Closure next_paint_callback_; | 174 base::Closure next_paint_callback_; |
179 | 175 |
180 DISALLOW_COPY_AND_ASSIGN(AppListView); | 176 DISALLOW_COPY_AND_ASSIGN(AppListView); |
181 }; | 177 }; |
182 | 178 |
183 } // namespace app_list | 179 } // namespace app_list |
184 | 180 |
185 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 181 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
OLD | NEW |