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

Unified Diff: ui/app_list/views/app_list_view.cc

Issue 210083009: Add a whole-app-list unit test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/app_list/views/app_list_view.cc
diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc
index 38a61d3e29c280e4ba7f6ed6c06b95bb395833f2..4d08a3592b8bd0ebbc688c9500f1d01c43d9ba60 100644
--- a/ui/app_list/views/app_list_view.cc
+++ b/ui/app_list/views/app_list_view.cc
@@ -50,7 +50,8 @@ namespace app_list {
namespace {
-void (*g_next_paint_callback)();
+// For UMA and testing. If non-null, triggered when the app list is painted.
+base::Closure g_next_paint_callback;
// The margin from the edge to the speech UI.
const int kSpeechUIMargin = 12;
@@ -199,9 +200,9 @@ gfx::Size AppListView::GetPreferredSize() {
void AppListView::Paint(gfx::Canvas* canvas) {
views::BubbleDelegateView::Paint(canvas);
- if (g_next_paint_callback) {
- g_next_paint_callback();
- g_next_paint_callback = NULL;
+ if (!g_next_paint_callback.is_null()) {
+ g_next_paint_callback.Run();
+ g_next_paint_callback.Reset();
}
}
@@ -243,7 +244,7 @@ void AppListView::RemoveObserver(AppListViewObserver* observer) {
}
// static
-void AppListView::SetNextPaintCallback(void (*callback)()) {
+void AppListView::SetNextPaintCallback(const base::Closure& callback) {
g_next_paint_callback = callback;
}

Powered by Google App Engine
This is Rietveld 408576698