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

Side by Side Diff: content/common/font_list_win.cc

Issue 102593002: Convert string16 to base::string16 in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « content/common/font_list_mac.mm ('k') | content/common/handle_enumerator_win.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 "content/common/font_list.h" 5 #include "content/common/font_list.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <set> 9 #include <set>
10 10
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXW* logical_font, 16 static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXW* logical_font,
17 NEWTEXTMETRICEXW* physical_font, 17 NEWTEXTMETRICEXW* physical_font,
18 DWORD font_type, 18 DWORD font_type,
19 LPARAM lparam) { 19 LPARAM lparam) {
20 std::set<string16>* font_names = 20 std::set<base::string16>* font_names =
21 reinterpret_cast<std::set<string16>*>(lparam); 21 reinterpret_cast<std::set<base::string16>*>(lparam);
22 if (font_names) { 22 if (font_names) {
23 const LOGFONTW& lf = logical_font->elfLogFont; 23 const LOGFONTW& lf = logical_font->elfLogFont;
24 if (lf.lfFaceName[0] && lf.lfFaceName[0] != '@') { 24 if (lf.lfFaceName[0] && lf.lfFaceName[0] != '@') {
25 string16 face_name(lf.lfFaceName); 25 base::string16 face_name(lf.lfFaceName);
26 font_names->insert(face_name); 26 font_names->insert(face_name);
27 } 27 }
28 } 28 }
29 return 1; 29 return 1;
30 } 30 }
31 31
32 scoped_ptr<base::ListValue> GetFontList_SlowBlocking() { 32 scoped_ptr<base::ListValue> GetFontList_SlowBlocking() {
33 std::set<string16> font_names; 33 std::set<base::string16> font_names;
34 34
35 LOGFONTW logfont; 35 LOGFONTW logfont;
36 memset(&logfont, 0, sizeof(logfont)); 36 memset(&logfont, 0, sizeof(logfont));
37 logfont.lfCharSet = DEFAULT_CHARSET; 37 logfont.lfCharSet = DEFAULT_CHARSET;
38 38
39 HDC hdc = ::GetDC(NULL); 39 HDC hdc = ::GetDC(NULL);
40 ::EnumFontFamiliesExW(hdc, &logfont, (FONTENUMPROCW)&EnumFontFamExProc, 40 ::EnumFontFamiliesExW(hdc, &logfont, (FONTENUMPROCW)&EnumFontFamExProc,
41 (LPARAM)&font_names, 0); 41 (LPARAM)&font_names, 0);
42 ::ReleaseDC(NULL, hdc); 42 ::ReleaseDC(NULL, hdc);
43 43
44 scoped_ptr<base::ListValue> font_list(new base::ListValue); 44 scoped_ptr<base::ListValue> font_list(new base::ListValue);
45 std::set<string16>::iterator iter; 45 std::set<base::string16>::iterator iter;
46 for (iter = font_names.begin(); iter != font_names.end(); ++iter) { 46 for (iter = font_names.begin(); iter != font_names.end(); ++iter) {
47 base::ListValue* font_item = new base::ListValue(); 47 base::ListValue* font_item = new base::ListValue();
48 font_item->Append(new base::StringValue(*iter)); 48 font_item->Append(new base::StringValue(*iter));
49 font_item->Append(new base::StringValue(*iter)); 49 font_item->Append(new base::StringValue(*iter));
50 font_list->Append(font_item); 50 font_list->Append(font_item);
51 } 51 }
52 return font_list.Pass(); 52 return font_list.Pass();
53 } 53 }
54 54
55 } // namespace content 55 } // namespace content
OLDNEW
« no previous file with comments | « content/common/font_list_mac.mm ('k') | content/common/handle_enumerator_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698