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" |
11 #include "ui/app_list/app_list_export.h" | 11 #include "ui/app_list/app_list_export.h" |
12 #include "ui/app_list/app_list_view_delegate_observer.h" | 12 #include "ui/app_list/app_list_view_delegate_observer.h" |
13 #include "ui/app_list/speech_ui_model_observer.h" | 13 #include "ui/app_list/speech_ui_model_observer.h" |
14 #include "ui/views/bubble/bubble_delegate.h" | 14 #include "ui/views/bubble/bubble_delegate.h" |
15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class FilePath; | 18 class FilePath; |
19 } | 19 } |
20 | 20 |
| 21 namespace test { |
| 22 class AppListViewTestApi; |
| 23 } |
| 24 |
21 namespace app_list { | 25 namespace app_list { |
22 class ApplicationDragAndDropHost; | 26 class ApplicationDragAndDropHost; |
23 class AppListMainView; | 27 class AppListMainView; |
24 class AppListModel; | 28 class AppListModel; |
25 class AppListViewDelegate; | 29 class AppListViewDelegate; |
26 class AppListViewObserver; | 30 class AppListViewObserver; |
27 class HideViewAnimationObserver; | 31 class HideViewAnimationObserver; |
28 class PaginationModel; | 32 class PaginationModel; |
29 class SigninDelegate; | 33 class SigninDelegate; |
30 class SigninView; | 34 class SigninView; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 ApplicationDragAndDropHost* drag_and_drop_host); | 73 ApplicationDragAndDropHost* drag_and_drop_host); |
70 | 74 |
71 // Shows the UI when there are no pending icon loads. Otherwise, starts a | 75 // Shows the UI when there are no pending icon loads. Otherwise, starts a |
72 // timer to show the UI when a maximum allowed wait time has expired. | 76 // timer to show the UI when a maximum allowed wait time has expired. |
73 void ShowWhenReady(); | 77 void ShowWhenReady(); |
74 | 78 |
75 void Close(); | 79 void Close(); |
76 | 80 |
77 void UpdateBounds(); | 81 void UpdateBounds(); |
78 | 82 |
| 83 // Enables/disables a semi-transparent overlay over the app list (good for |
| 84 // hiding the app list when a modal dialog is being shown). |
| 85 void SetAppListOverlayVisible(bool visible); |
| 86 |
79 // Returns true if the app list should be centered and in landscape mode. | 87 // Returns true if the app list should be centered and in landscape mode. |
80 bool ShouldCenterWindow() const; | 88 bool ShouldCenterWindow() const; |
81 | 89 |
82 // Overridden from views::View: | 90 // Overridden from views::View: |
83 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 91 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
84 virtual void Paint(gfx::Canvas* canvas, | 92 virtual void Paint(gfx::Canvas* canvas, |
85 const views::CullSet& cull_set) OVERRIDE; | 93 const views::CullSet& cull_set) OVERRIDE; |
86 virtual void OnThemeChanged() OVERRIDE; | 94 virtual void OnThemeChanged() OVERRIDE; |
87 | 95 |
88 // WidgetDelegate overrides: | 96 // WidgetDelegate overrides: |
(...skipping 12 matching lines...) Expand all Loading... |
101 // Set a callback to be called the next time any app list paints. | 109 // Set a callback to be called the next time any app list paints. |
102 void SetNextPaintCallback(const base::Closure& callback); | 110 void SetNextPaintCallback(const base::Closure& callback); |
103 | 111 |
104 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
105 HWND GetHWND() const; | 113 HWND GetHWND() const; |
106 #endif | 114 #endif |
107 | 115 |
108 AppListMainView* app_list_main_view() { return app_list_main_view_; } | 116 AppListMainView* app_list_main_view() { return app_list_main_view_; } |
109 | 117 |
110 private: | 118 private: |
| 119 friend class test::AppListViewTestApi; |
| 120 |
111 void InitAsBubbleInternal(gfx::NativeView parent, | 121 void InitAsBubbleInternal(gfx::NativeView parent, |
112 PaginationModel* pagination_model, | 122 PaginationModel* pagination_model, |
113 views::BubbleBorder::Arrow arrow, | 123 views::BubbleBorder::Arrow arrow, |
114 bool border_accepts_events, | 124 bool border_accepts_events, |
115 const gfx::Vector2d& anchor_offset); | 125 const gfx::Vector2d& anchor_offset); |
116 | 126 |
117 // Overridden from views::BubbleDelegateView: | 127 // Overridden from views::BubbleDelegateView: |
118 virtual void OnBeforeBubbleWidgetInit( | 128 virtual void OnBeforeBubbleWidgetInit( |
119 views::Widget::InitParams* params, | 129 views::Widget::InitParams* params, |
120 views::Widget* widget) const OVERRIDE; | 130 views::Widget* widget) const OVERRIDE; |
(...skipping 21 matching lines...) Expand all Loading... |
142 SpeechRecognitionState new_state) OVERRIDE; | 152 SpeechRecognitionState new_state) OVERRIDE; |
143 | 153 |
144 SigninDelegate* GetSigninDelegate(); | 154 SigninDelegate* GetSigninDelegate(); |
145 | 155 |
146 scoped_ptr<AppListViewDelegate> delegate_; | 156 scoped_ptr<AppListViewDelegate> delegate_; |
147 | 157 |
148 AppListMainView* app_list_main_view_; | 158 AppListMainView* app_list_main_view_; |
149 SigninView* signin_view_; | 159 SigninView* signin_view_; |
150 SpeechView* speech_view_; | 160 SpeechView* speech_view_; |
151 | 161 |
| 162 // A semi-transparent white overlay that covers the app list while dialogs are |
| 163 // open. |
| 164 views::View* overlay_view_; |
| 165 |
152 ObserverList<AppListViewObserver> observers_; | 166 ObserverList<AppListViewObserver> observers_; |
153 scoped_ptr<HideViewAnimationObserver> animation_observer_; | 167 scoped_ptr<HideViewAnimationObserver> animation_observer_; |
154 | 168 |
155 // For UMA and testing. If non-null, triggered when the app list is painted. | 169 // For UMA and testing. If non-null, triggered when the app list is painted. |
156 base::Closure next_paint_callback_; | 170 base::Closure next_paint_callback_; |
157 | 171 |
158 DISALLOW_COPY_AND_ASSIGN(AppListView); | 172 DISALLOW_COPY_AND_ASSIGN(AppListView); |
159 }; | 173 }; |
160 | 174 |
161 } // namespace app_list | 175 } // namespace app_list |
162 | 176 |
163 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ | 177 #endif // UI_APP_LIST_VIEWS_APP_LIST_VIEW_H_ |
OLD | NEW |