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

Side by Side Diff: content/common/font_list_mac.mm

Issue 9500008: Move font_list_async.h to content/public. Switch to Pass() goodness to simplify code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix clang Created 8 years, 9 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 | « content/common/font_list_android.cc ('k') | content/common/font_list_win.cc » ('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 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/mac/scoped_nsautorelease_pool.h" 9 #include "base/mac/scoped_nsautorelease_pool.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 ListValue* GetFontList_SlowBlocking() { 15 scoped_ptr<ListValue> GetFontList_SlowBlocking() {
16 base::mac::ScopedNSAutoreleasePool autorelease_pool; 16 base::mac::ScopedNSAutoreleasePool autorelease_pool;
17 ListValue* font_list = new ListValue; 17 scoped_ptr<ListValue> font_list(new ListValue);
18 NSFontManager* fontManager = [[[NSFontManager alloc] init] autorelease]; 18 NSFontManager* fontManager = [[[NSFontManager alloc] init] autorelease];
19 NSArray* fonts = [fontManager availableFontFamilies]; 19 NSArray* fonts = [fontManager availableFontFamilies];
20 for (NSString* family_name in fonts) { 20 for (NSString* family_name in fonts) {
21 NSString* localized_family_name = 21 NSString* localized_family_name =
22 [fontManager localizedNameForFamily:family_name face:nil]; 22 [fontManager localizedNameForFamily:family_name face:nil];
23 ListValue* font_item = new ListValue(); 23 ListValue* font_item = new ListValue();
24 string16 family = base::SysNSStringToUTF16(family_name); 24 string16 family = base::SysNSStringToUTF16(family_name);
25 font_item->Append(Value::CreateStringValue(family)); 25 font_item->Append(Value::CreateStringValue(family));
26 string16 loc_family = base::SysNSStringToUTF16(localized_family_name); 26 string16 loc_family = base::SysNSStringToUTF16(localized_family_name);
27 font_item->Append(Value::CreateStringValue(loc_family)); 27 font_item->Append(Value::CreateStringValue(loc_family));
28 font_list->Append(font_item); 28 font_list->Append(font_item);
29 } 29 }
30 return font_list; 30 return font_list.Pass();
31 } 31 }
32 32
33 } // namespace content 33 } // namespace content
OLDNEW
« no previous file with comments | « content/common/font_list_android.cc ('k') | content/common/font_list_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698