OLD | NEW |
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_win.h" | 5 #include "ui/gfx/native_theme_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <uxtheme.h> | 8 #include <uxtheme.h> |
9 #include <vsstyle.h> | 9 #include <vsstyle.h> |
10 #include <vssym32.h> | 10 #include <vssym32.h> |
11 | 11 |
| 12 #include "base/lazy_instance.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/memory/scoped_handle.h" | 14 #include "base/memory/scoped_handle.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/win/scoped_gdi_object.h" | 16 #include "base/win/scoped_gdi_object.h" |
16 #include "base/win/scoped_hdc.h" | 17 #include "base/win/scoped_hdc.h" |
17 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
18 #include "skia/ext/platform_canvas.h" | 19 #include "skia/ext/platform_canvas.h" |
19 #include "skia/ext/skia_utils_win.h" | 20 #include "skia/ext/skia_utils_win.h" |
20 #include "third_party/skia/include/core/SkCanvas.h" | 21 #include "third_party/skia/include/core/SkCanvas.h" |
21 #include "third_party/skia/include/core/SkColorPriv.h" | 22 #include "third_party/skia/include/core/SkColorPriv.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 56 |
56 } // namespace | 57 } // namespace |
57 | 58 |
58 namespace gfx { | 59 namespace gfx { |
59 | 60 |
60 // static | 61 // static |
61 const NativeTheme* NativeTheme::instance() { | 62 const NativeTheme* NativeTheme::instance() { |
62 return NativeThemeWin::instance(); | 63 return NativeThemeWin::instance(); |
63 } | 64 } |
64 | 65 |
| 66 static base::LazyInstance<NativeThemeWin> g_native_theme( |
| 67 base::LINKER_INITIALIZED); |
| 68 |
65 // static | 69 // static |
66 const NativeThemeWin* NativeThemeWin::instance() { | 70 const NativeThemeWin* NativeThemeWin::instance() { |
67 // The global NativeThemeWin instance. | 71 return g_native_theme.Pointer(); |
68 static const NativeThemeWin s_native_theme; | |
69 return &s_native_theme; | |
70 } | 72 } |
71 | 73 |
72 NativeThemeWin::NativeThemeWin() | 74 NativeThemeWin::NativeThemeWin() |
73 : theme_dll_(LoadLibrary(L"uxtheme.dll")), | 75 : theme_dll_(LoadLibrary(L"uxtheme.dll")), |
74 draw_theme_(NULL), | 76 draw_theme_(NULL), |
75 draw_theme_ex_(NULL), | 77 draw_theme_ex_(NULL), |
76 get_theme_color_(NULL), | 78 get_theme_color_(NULL), |
77 get_theme_content_rect_(NULL), | 79 get_theme_content_rect_(NULL), |
78 get_theme_part_size_(NULL), | 80 get_theme_part_size_(NULL), |
79 open_theme_(NULL), | 81 open_theme_(NULL), |
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 } | 1655 } |
1654 break; | 1656 break; |
1655 default: | 1657 default: |
1656 NOTREACHED() << "Invalid part: " << part; | 1658 NOTREACHED() << "Invalid part: " << part; |
1657 break; | 1659 break; |
1658 } | 1660 } |
1659 return state_id; | 1661 return state_id; |
1660 } | 1662 } |
1661 | 1663 |
1662 } // namespace gfx | 1664 } // namespace gfx |
OLD | NEW |