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

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: other nit 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
« no previous file with comments | « ui/app_list/views/app_list_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
8 #include "base/command_line.h" 7 #include "base/command_line.h"
9 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
10 #include "ui/app_list/app_list_constants.h" 9 #include "ui/app_list/app_list_constants.h"
11 #include "ui/app_list/app_list_model.h" 10 #include "ui/app_list/app_list_model.h"
12 #include "ui/app_list/app_list_view_delegate.h" 11 #include "ui/app_list/app_list_view_delegate.h"
13 #include "ui/app_list/pagination_model.h" 12 #include "ui/app_list/pagination_model.h"
14 #include "ui/app_list/signin_delegate.h" 13 #include "ui/app_list/signin_delegate.h"
15 #include "ui/app_list/views/app_list_background.h" 14 #include "ui/app_list/views/app_list_background.h"
16 #include "ui/app_list/views/app_list_main_view.h" 15 #include "ui/app_list/views/app_list_main_view.h"
17 #include "ui/app_list/views/search_box_view.h" 16 #include "ui/app_list/views/search_box_view.h"
(...skipping 16 matching lines...) Expand all
34 #endif 33 #endif
35 #if !defined(OS_CHROMEOS) 34 #if !defined(OS_CHROMEOS)
36 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 35 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
37 #endif 36 #endif
38 #endif // defined(USE_AURA) 37 #endif // defined(USE_AURA)
39 38
40 namespace app_list { 39 namespace app_list {
41 40
42 namespace { 41 namespace {
43 42
44 base::Closure g_next_paint_callback; 43 void (*g_next_paint_callback)();
45 44
46 // The distance between the arrow tip and edge of the anchor view. 45 // The distance between the arrow tip and edge of the anchor view.
47 const int kArrowOffset = 10; 46 const int kArrowOffset = 10;
48 47
49 // Determines whether the current environment supports shadows bubble borders. 48 // Determines whether the current environment supports shadows bubble borders.
50 bool SupportsShadow() { 49 bool SupportsShadow() {
51 #if defined(USE_AURA) && defined(OS_WIN) 50 #if defined(USE_AURA) && defined(OS_WIN)
52 // Shadows are not supported on Windows Aura without Aero Glass. 51 // Shadows are not supported on Windows Aura without Aero Glass.
53 if (!ui::win::IsAeroGlassEnabled() || 52 if (!ui::win::IsAeroGlassEnabled() ||
54 CommandLine::ForCurrentProcess()->HasSwitch( 53 CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void AppListView::UpdateBounds() { 137 void AppListView::UpdateBounds() {
139 SizeToContents(); 138 SizeToContents();
140 } 139 }
141 140
142 gfx::Size AppListView::GetPreferredSize() { 141 gfx::Size AppListView::GetPreferredSize() {
143 return app_list_main_view_->GetPreferredSize(); 142 return app_list_main_view_->GetPreferredSize();
144 } 143 }
145 144
146 void AppListView::Paint(gfx::Canvas* canvas) { 145 void AppListView::Paint(gfx::Canvas* canvas) {
147 views::BubbleDelegateView::Paint(canvas); 146 views::BubbleDelegateView::Paint(canvas);
148 if (!g_next_paint_callback.is_null()) { 147 if (g_next_paint_callback) {
149 g_next_paint_callback.Run(); 148 g_next_paint_callback();
150 g_next_paint_callback.Reset(); 149 g_next_paint_callback = NULL;
151 } 150 }
152 } 151 }
153 152
154 bool AppListView::ShouldHandleSystemCommands() const { 153 bool AppListView::ShouldHandleSystemCommands() const {
155 return true; 154 return true;
156 } 155 }
157 156
158 void AppListView::Prerender() { 157 void AppListView::Prerender() {
159 app_list_main_view_->Prerender(); 158 app_list_main_view_->Prerender();
160 } 159 }
(...skipping 10 matching lines...) Expand all
171 170
172 void AppListView::AddObserver(Observer* observer) { 171 void AppListView::AddObserver(Observer* observer) {
173 observers_.AddObserver(observer); 172 observers_.AddObserver(observer);
174 } 173 }
175 174
176 void AppListView::RemoveObserver(Observer* observer) { 175 void AppListView::RemoveObserver(Observer* observer) {
177 observers_.RemoveObserver(observer); 176 observers_.RemoveObserver(observer);
178 } 177 }
179 178
180 // static 179 // static
181 void AppListView::SetNextPaintCallback(const base::Closure& callback) { 180 void AppListView::SetNextPaintCallback(void (*callback)()) {
182 g_next_paint_callback = callback; 181 g_next_paint_callback = callback;
183 } 182 }
184 183
185 #if defined(OS_WIN) 184 #if defined(OS_WIN)
186 HWND AppListView::GetHWND() const { 185 HWND AppListView::GetHWND() const {
187 #if defined(USE_AURA) 186 #if defined(USE_AURA)
188 gfx::NativeWindow window = 187 gfx::NativeWindow window =
189 GetWidget()->GetTopLevelWidget()->GetNativeWindow(); 188 GetWidget()->GetTopLevelWidget()->GetNativeWindow();
190 return window->GetDispatcher()->host()->GetAcceleratedWidget(); 189 return window->GetDispatcher()->host()->GetAcceleratedWidget();
191 #else 190 #else
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // Whether we need to signin or not may have changed since last time we were 333 // Whether we need to signin or not may have changed since last time we were
335 // shown. 334 // shown.
336 Layout(); 335 Layout();
337 } 336 }
338 337
339 void AppListView::OnAppListModelSigninStatusChanged() { 338 void AppListView::OnAppListModelSigninStatusChanged() {
340 OnSigninStatusChanged(); 339 OnSigninStatusChanged();
341 } 340 }
342 341
343 } // namespace app_list 342 } // namespace app_list
OLDNEW
« no previous file with comments | « 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