OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import "chrome/browser/ui/cocoa/font_language_settings_controller.h" | 5 #import "chrome/browser/ui/cocoa/font_language_settings_controller.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #import "base/mac_util.h" | 8 #import "base/mac/mac_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/character_encoding.h" | 10 #include "chrome/browser/character_encoding.h" |
11 #include "chrome/browser/fonts_languages_window.h" | 11 #include "chrome/browser/fonts_languages_window.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 | 15 |
16 NSString* const kCharacterInfoEncoding = @"encoding"; | 16 NSString* const kCharacterInfoEncoding = @"encoding"; |
17 NSString* const kCharacterInfoName = @"name"; | 17 NSString* const kCharacterInfoName = @"name"; |
18 NSString* const kCharacterInfoID = @"id"; | 18 NSString* const kCharacterInfoID = @"id"; |
19 | 19 |
20 void ShowFontsLanguagesWindow(gfx::NativeWindow window, | 20 void ShowFontsLanguagesWindow(gfx::NativeWindow window, |
21 FontsLanguagesPage page, | 21 FontsLanguagesPage page, |
22 Profile* profile) { | 22 Profile* profile) { |
23 NOTIMPLEMENTED(); | 23 NOTIMPLEMENTED(); |
24 } | 24 } |
25 | 25 |
26 @interface FontLanguageSettingsController (Private) | 26 @interface FontLanguageSettingsController (Private) |
27 - (void)updateDisplayField:(NSTextField*)field | 27 - (void)updateDisplayField:(NSTextField*)field |
28 withFont:(NSFont*)font | 28 withFont:(NSFont*)font |
29 withLabel:(NSTextField*)label; | 29 withLabel:(NSTextField*)label; |
30 @end | 30 @end |
31 | 31 |
32 @implementation FontLanguageSettingsController | 32 @implementation FontLanguageSettingsController |
33 | 33 |
34 - (id)initWithProfile:(Profile*)profile { | 34 - (id)initWithProfile:(Profile*)profile { |
35 DCHECK(profile); | 35 DCHECK(profile); |
36 NSString* nibpath = [mac_util::MainAppBundle() | 36 NSString* nibpath = [base::mac::MainAppBundle() |
37 pathForResource:@"FontLanguageSettings" | 37 pathForResource:@"FontLanguageSettings" |
38 ofType:@"nib"]; | 38 ofType:@"nib"]; |
39 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { | 39 if ((self = [super initWithWindowNibPath:nibpath owner:self])) { |
40 profile_ = profile; | 40 profile_ = profile; |
41 | 41 |
42 // Convert the name/size preference values to NSFont objects. | 42 // Convert the name/size preference values to NSFont objects. |
43 serifName_.Init(prefs::kWebKitSerifFontFamily, profile->GetPrefs(), NULL); | 43 serifName_.Init(prefs::kWebKitSerifFontFamily, profile->GetPrefs(), NULL); |
44 serifSize_.Init(prefs::kWebKitDefaultFontSize, profile->GetPrefs(), NULL); | 44 serifSize_.Init(prefs::kWebKitDefaultFontSize, profile->GetPrefs(), NULL); |
45 NSString* serif = base::SysUTF8ToNSString(serifName_.GetValue()); | 45 NSString* serif = base::SysUTF8ToNSString(serifName_.GetValue()); |
46 serifFont_.reset( | 46 serifFont_.reset( |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 return; | 271 return; |
272 } | 272 } |
273 [field setFont:font]; | 273 [field setFont:font]; |
274 NSString* value = | 274 NSString* value = |
275 [NSString stringWithFormat:@"%@, %g", [font fontName], [font pointSize]]; | 275 [NSString stringWithFormat:@"%@, %g", [font fontName], [font pointSize]]; |
276 [field setStringValue:value]; | 276 [field setStringValue:value]; |
277 [field setFrameOrigin:[self getFontFieldOrigin:field forLabel:label]]; | 277 [field setFrameOrigin:[self getFontFieldOrigin:field forLabel:label]]; |
278 } | 278 } |
279 | 279 |
280 @end | 280 @end |
OLD | NEW |