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

Side by Side Diff: ui/views/controls/menu/menu_config_win.cc

Issue 1406403007: Eliminate HICON leaks caused by creating icons from bitmap image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ScopedHICON instead of HICON. Created 5 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/views/controls/menu/menu_config.h" 5 #include "ui/views/controls/menu/menu_config.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <uxtheme.h> 8 #include <uxtheme.h>
9 #include <Vssym32.h> 9 #include <Vssym32.h>
10 10
(...skipping 16 matching lines...) Expand all
27 return; 27 return;
28 } 28 }
29 29
30 arrow_color = color_utils::GetSysSkColor(COLOR_MENUTEXT); 30 arrow_color = color_utils::GetSysSkColor(COLOR_MENUTEXT);
31 31
32 NONCLIENTMETRICS_XP metrics; 32 NONCLIENTMETRICS_XP metrics;
33 base::win::GetNonClientMetrics(&metrics); 33 base::win::GetNonClientMetrics(&metrics);
34 l10n_util::AdjustUIFont(&(metrics.lfMenuFont)); 34 l10n_util::AdjustUIFont(&(metrics.lfMenuFont));
35 { 35 {
36 base::win::ScopedHFONT new_font(CreateFontIndirect(&metrics.lfMenuFont)); 36 base::win::ScopedHFONT new_font(CreateFontIndirect(&metrics.lfMenuFont));
37 DLOG_ASSERT(new_font.Get()); 37 DLOG_ASSERT(new_font.is_valid());
38 font_list = gfx::FontList(gfx::Font(new_font)); 38 font_list = gfx::FontList(gfx::Font(new_font.get()));
39 } 39 }
40 NativeTheme::ExtraParams extra; 40 NativeTheme::ExtraParams extra;
41 extra.menu_check.is_radio = false; 41 extra.menu_check.is_radio = false;
42 extra.menu_check.is_selected = false; 42 extra.menu_check.is_selected = false;
43 gfx::Size check_size = NativeThemeWin::instance()->GetPartSize( 43 gfx::Size check_size = NativeThemeWin::instance()->GetPartSize(
44 NativeTheme::kMenuCheck, NativeTheme::kNormal, extra); 44 NativeTheme::kMenuCheck, NativeTheme::kNormal, extra);
45 if (!check_size.IsEmpty()) { 45 if (!check_size.IsEmpty()) {
46 check_width = check_size.width(); 46 check_width = check_size.width();
47 check_height = check_size.height(); 47 check_height = check_size.height();
48 } else { 48 } else {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 win_instance = new MenuConfig(NativeThemeWin::instance()); 87 win_instance = new MenuConfig(NativeThemeWin::instance());
88 return *win_instance; 88 return *win_instance;
89 } 89 }
90 static MenuConfig* views_instance = NULL; 90 static MenuConfig* views_instance = NULL;
91 if (!views_instance) 91 if (!views_instance)
92 views_instance = new MenuConfig(theme); 92 views_instance = new MenuConfig(theme);
93 return *views_instance; 93 return *views_instance;
94 } 94 }
95 95
96 } // namespace views 96 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698