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

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

Issue 68173019: Remove static initializer from AppListView::SetNextPaintCallback(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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 #include "ui/app_list/views/app_list_view.h" 5 #include "ui/app_list/views/app_list_view.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
benwells 2013/11/15 02:13:59 Nit: this seems to be not needed anymore.
koz (OOO until 15th September) 2013/11/17 23:16:19 Done.
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "ui/app_list/app_list_constants.h" 10 #include "ui/app_list/app_list_constants.h"
11 #include "ui/app_list/app_list_model.h" 11 #include "ui/app_list/app_list_model.h"
12 #include "ui/app_list/app_list_view_delegate.h" 12 #include "ui/app_list/app_list_view_delegate.h"
13 #include "ui/app_list/pagination_model.h" 13 #include "ui/app_list/pagination_model.h"
14 #include "ui/app_list/signin_delegate.h" 14 #include "ui/app_list/signin_delegate.h"
15 #include "ui/app_list/views/app_list_background.h" 15 #include "ui/app_list/views/app_list_background.h"
16 #include "ui/app_list/views/app_list_main_view.h" 16 #include "ui/app_list/views/app_list_main_view.h"
17 #include "ui/app_list/views/search_box_view.h" 17 #include "ui/app_list/views/search_box_view.h"
(...skipping 13 matching lines...) Expand all
31 #include "ui/aura/root_window.h" 31 #include "ui/aura/root_window.h"
32 #if defined(OS_WIN) 32 #if defined(OS_WIN)
33 #include "ui/base/win/shell.h" 33 #include "ui/base/win/shell.h"
34 #endif 34 #endif
35 #endif 35 #endif
36 36
37 namespace app_list { 37 namespace app_list {
38 38
39 namespace { 39 namespace {
40 40
41 base::Closure g_next_paint_callback; 41 void (*g_next_paint_callback)();
42 42
43 // The distance between the arrow tip and edge of the anchor view. 43 // The distance between the arrow tip and edge of the anchor view.
44 const int kArrowOffset = 10; 44 const int kArrowOffset = 10;
45 45
46 } // namespace 46 } // namespace
47 47
48 //////////////////////////////////////////////////////////////////////////////// 48 ////////////////////////////////////////////////////////////////////////////////
49 // AppListView: 49 // AppListView:
50 50
51 AppListView::AppListView(AppListViewDelegate* delegate) 51 AppListView::AppListView(AppListViewDelegate* delegate)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void AppListView::UpdateBounds() { 119 void AppListView::UpdateBounds() {
120 SizeToContents(); 120 SizeToContents();
121 } 121 }
122 122
123 gfx::Size AppListView::GetPreferredSize() { 123 gfx::Size AppListView::GetPreferredSize() {
124 return app_list_main_view_->GetPreferredSize(); 124 return app_list_main_view_->GetPreferredSize();
125 } 125 }
126 126
127 void AppListView::Paint(gfx::Canvas* canvas) { 127 void AppListView::Paint(gfx::Canvas* canvas) {
128 views::BubbleDelegateView::Paint(canvas); 128 views::BubbleDelegateView::Paint(canvas);
129 if (!g_next_paint_callback.is_null()) { 129 if (!g_next_paint_callback) {
130 g_next_paint_callback.Run(); 130 g_next_paint_callback();
131 g_next_paint_callback.Reset(); 131 g_next_paint_callback = NULL;
132 } 132 }
133 } 133 }
134 134
135 bool AppListView::ShouldHandleSystemCommands() const { 135 bool AppListView::ShouldHandleSystemCommands() const {
136 return true; 136 return true;
137 } 137 }
138 138
139 void AppListView::Prerender() { 139 void AppListView::Prerender() {
140 app_list_main_view_->Prerender(); 140 app_list_main_view_->Prerender();
141 } 141 }
(...skipping 10 matching lines...) Expand all
152 152
153 void AppListView::AddObserver(Observer* observer) { 153 void AppListView::AddObserver(Observer* observer) {
154 observers_.AddObserver(observer); 154 observers_.AddObserver(observer);
155 } 155 }
156 156
157 void AppListView::RemoveObserver(Observer* observer) { 157 void AppListView::RemoveObserver(Observer* observer) {
158 observers_.RemoveObserver(observer); 158 observers_.RemoveObserver(observer);
159 } 159 }
160 160
161 // static 161 // static
162 void AppListView::SetNextPaintCallback(const base::Closure& callback) { 162 void AppListView::SetNextPaintCallback(void (*callback)()) {
163 g_next_paint_callback = callback; 163 g_next_paint_callback = callback;
164 } 164 }
165 165
166 #if defined(OS_WIN) 166 #if defined(OS_WIN)
167 HWND AppListView::GetHWND() const { 167 HWND AppListView::GetHWND() const {
168 #if defined(USE_AURA) 168 #if defined(USE_AURA)
169 gfx::NativeWindow window = 169 gfx::NativeWindow window =
170 GetWidget()->GetTopLevelWidget()->GetNativeWindow(); 170 GetWidget()->GetTopLevelWidget()->GetNativeWindow();
171 return window->GetDispatcher()->GetAcceleratedWidget(); 171 return window->GetDispatcher()->GetAcceleratedWidget();
172 #else 172 #else
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 void AppListView::OnAppListModelSigninStatusChanged() { 317 void AppListView::OnAppListModelSigninStatusChanged() {
318 OnSigninStatusChanged(); 318 OnSigninStatusChanged();
319 } 319 }
320 320
321 void AppListView::OnAppListModelUsersChanged() { 321 void AppListView::OnAppListModelUsersChanged() {
322 OnSigninStatusChanged(); 322 OnSigninStatusChanged();
323 } 323 }
324 324
325 } // namespace app_list 325 } // namespace app_list
OLDNEW
« ui/app_list/views/app_list_view.h ('K') | « ui/app_list/views/app_list_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698