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 #include "ui/app_list/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #endif | 46 #endif |
47 #if !defined(OS_CHROMEOS) | 47 #if !defined(OS_CHROMEOS) |
48 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 48 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
49 #endif | 49 #endif |
50 #endif // defined(USE_AURA) | 50 #endif // defined(USE_AURA) |
51 | 51 |
52 namespace app_list { | 52 namespace app_list { |
53 | 53 |
54 namespace { | 54 namespace { |
55 | 55 |
| 56 void (*g_next_paint_callback)(); |
| 57 |
56 // The margin from the edge to the speech UI. | 58 // The margin from the edge to the speech UI. |
57 const int kSpeechUIMargin = 12; | 59 const int kSpeechUIMargin = 12; |
58 | 60 |
59 // The vertical position for the appearing animation of the speech UI. | 61 // The vertical position for the appearing animation of the speech UI. |
60 const float kSpeechUIAppearingPosition = 12; | 62 const float kSpeechUIAppearingPosition = 12; |
61 | 63 |
62 // The distance between the arrow tip and edge of the anchor view. | 64 // The distance between the arrow tip and edge of the anchor view. |
63 const int kArrowOffset = 10; | 65 const int kArrowOffset = 10; |
64 | 66 |
65 // Determines whether the current environment supports shadows bubble borders. | 67 // Determines whether the current environment supports shadows bubble borders. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 bool AppListView::ShouldCenterWindow() const { | 199 bool AppListView::ShouldCenterWindow() const { |
198 return delegate_->ShouldCenterWindow(); | 200 return delegate_->ShouldCenterWindow(); |
199 } | 201 } |
200 | 202 |
201 gfx::Size AppListView::GetPreferredSize() { | 203 gfx::Size AppListView::GetPreferredSize() { |
202 return app_list_main_view_->GetPreferredSize(); | 204 return app_list_main_view_->GetPreferredSize(); |
203 } | 205 } |
204 | 206 |
205 void AppListView::Paint(gfx::Canvas* canvas, const views::CullSet& cull_set) { | 207 void AppListView::Paint(gfx::Canvas* canvas, const views::CullSet& cull_set) { |
206 views::BubbleDelegateView::Paint(canvas, cull_set); | 208 views::BubbleDelegateView::Paint(canvas, cull_set); |
207 if (!next_paint_callback_.is_null()) { | 209 if (g_next_paint_callback) { |
208 next_paint_callback_.Run(); | 210 g_next_paint_callback(); |
209 next_paint_callback_.Reset(); | 211 g_next_paint_callback = NULL; |
210 } | 212 } |
211 } | 213 } |
212 | 214 |
213 void AppListView::OnThemeChanged() { | 215 void AppListView::OnThemeChanged() { |
214 #if defined(OS_WIN) | 216 #if defined(OS_WIN) |
215 GetWidget()->Close(); | 217 GetWidget()->Close(); |
216 #endif | 218 #endif |
217 } | 219 } |
218 | 220 |
219 bool AppListView::ShouldHandleSystemCommands() const { | 221 bool AppListView::ShouldHandleSystemCommands() const { |
(...skipping 21 matching lines...) Expand all Loading... |
241 | 243 |
242 void AppListView::AddObserver(AppListViewObserver* observer) { | 244 void AppListView::AddObserver(AppListViewObserver* observer) { |
243 observers_.AddObserver(observer); | 245 observers_.AddObserver(observer); |
244 } | 246 } |
245 | 247 |
246 void AppListView::RemoveObserver(AppListViewObserver* observer) { | 248 void AppListView::RemoveObserver(AppListViewObserver* observer) { |
247 observers_.RemoveObserver(observer); | 249 observers_.RemoveObserver(observer); |
248 } | 250 } |
249 | 251 |
250 // static | 252 // static |
251 void AppListView::SetNextPaintCallback(const base::Closure& callback) { | 253 void AppListView::SetNextPaintCallback(void (*callback)()) { |
252 next_paint_callback_ = callback; | 254 g_next_paint_callback = callback; |
253 } | 255 } |
254 | 256 |
255 #if defined(OS_WIN) | 257 #if defined(OS_WIN) |
256 HWND AppListView::GetHWND() const { | 258 HWND AppListView::GetHWND() const { |
257 #if defined(USE_AURA) | 259 #if defined(USE_AURA) |
258 gfx::NativeWindow window = | 260 gfx::NativeWindow window = |
259 GetWidget()->GetTopLevelWidget()->GetNativeWindow(); | 261 GetWidget()->GetTopLevelWidget()->GetNativeWindow(); |
260 return window->GetHost()->GetAcceleratedWidget(); | 262 return window->GetHost()->GetAcceleratedWidget(); |
261 #else | 263 #else |
262 return GetWidget()->GetTopLevelWidget()->GetNativeWindow(); | 264 return GetWidget()->GetTopLevelWidget()->GetNativeWindow(); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 #else | 513 #else |
512 speech_view_->SetVisible(recognizing); | 514 speech_view_->SetVisible(recognizing); |
513 app_list_main_view_->SetVisible(!recognizing); | 515 app_list_main_view_->SetVisible(!recognizing); |
514 | 516 |
515 // Needs to schedule paint of AppListView itself, to repaint the background. | 517 // Needs to schedule paint of AppListView itself, to repaint the background. |
516 GetBubbleFrameView()->SchedulePaint(); | 518 GetBubbleFrameView()->SchedulePaint(); |
517 #endif | 519 #endif |
518 } | 520 } |
519 | 521 |
520 } // namespace app_list | 522 } // namespace app_list |
OLD | NEW |