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

Side by Side Diff: ui/gfx/native_theme_chromeos.cc

Issue 7778036: ui/gfx: Get rid of a few static variables from NativeTheme* type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use base::LazyInstance Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/native_theme_chromeos.h ('k') | ui/gfx/native_theme_linux.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gfx/native_theme_chromeos.h" 5 #include "ui/gfx/native_theme_chromeos.h"
6 6
7 #include "base/lazy_instance.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "grit/gfx_resources.h" 9 #include "grit/gfx_resources.h"
9 #include "third_party/skia/include/effects/SkGradientShader.h"
10 #include "third_party/skia/include/core/SkPaint.h" 10 #include "third_party/skia/include/core/SkPaint.h"
11 #include "third_party/skia/include/core/SkPath.h" 11 #include "third_party/skia/include/core/SkPath.h"
12 #include "third_party/skia/include/core/SkShader.h" 12 #include "third_party/skia/include/core/SkShader.h"
13 #include "third_party/skia/include/effects/SkGradientShader.h"
13 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/insets.h" 15 #include "ui/gfx/insets.h"
15 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
16 #include "ui/gfx/size.h" 17 #include "ui/gfx/size.h"
17 #include "ui/gfx/skbitmap_operations.h" 18 #include "ui/gfx/skbitmap_operations.h"
18 19
19 namespace { 20 namespace {
20 21
21 // Color constants. See theme_draw for details. 22 // Color constants. See theme_draw for details.
22 23
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 }; 224 };
224 225
225 GetGradientPaintForRect(bounds, 226 GetGradientPaintForRect(bounds,
226 kGradientColors, kGradientPoints, arraysize(kGradientPoints), 227 kGradientColors, kGradientPoints, arraysize(kGradientPoints),
227 paint); 228 paint);
228 } 229 }
229 } 230 }
230 231
231 } // namespace 232 } // namespace
232 233
233 /* static */ 234 base::LazyInstance<gfx::NativeThemeLinux> g_native_theme(
235 base::LINKER_INITIALIZED);
236
237 // static
234 const gfx::NativeThemeLinux* gfx::NativeThemeLinux::instance() { 238 const gfx::NativeThemeLinux* gfx::NativeThemeLinux::instance() {
235 // The global NativeThemeChromeos instance. 239 return g_native_theme.Pointer();
236 static NativeThemeChromeos s_native_theme;
237 return &s_native_theme;
238 } 240 }
239 241
240 NativeThemeChromeos::NativeThemeChromeos() { 242 NativeThemeChromeos::NativeThemeChromeos() {
241 } 243 }
242 244
243 NativeThemeChromeos::~NativeThemeChromeos() { 245 NativeThemeChromeos::~NativeThemeChromeos() {
244 } 246 }
245 247
246 gfx::Size NativeThemeChromeos::GetPartSize(Part part, 248 gfx::Size NativeThemeChromeos::GetPartSize(Part part,
247 State state, 249 State state,
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 SkPaint fill_paint; 712 SkPaint fill_paint;
711 GetButtonGradientPaint(rect, state, &fill_paint); 713 GetButtonGradientPaint(rect, state, &fill_paint);
712 canvas->drawPath(border, fill_paint); 714 canvas->drawPath(border, fill_paint);
713 715
714 if (stroke_border) { 716 if (stroke_border) {
715 SkPaint stroke_paint; 717 SkPaint stroke_paint;
716 GetStrokePaint(state, &stroke_paint); 718 GetStrokePaint(state, &stroke_paint);
717 canvas->drawPath(border, stroke_paint); 719 canvas->drawPath(border, stroke_paint);
718 } 720 }
719 } 721 }
OLDNEW
« no previous file with comments | « ui/gfx/native_theme_chromeos.h ('k') | ui/gfx/native_theme_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698