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

Side by Side Diff: chrome/browser/extensions/api/font_settings/font_settings_api.cc

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 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
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 // Font Settings Extension API implementation. 5 // Font Settings Extension API implementation.
6 6
7 #include "chrome/browser/extensions/api/font_settings/font_settings_api.h" 7 #include "chrome/browser/extensions/api/font_settings/font_settings_api.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 const char kWebKitFontPrefFormat[] = "webkit.webprefs.fonts.%s.%s"; 60 const char kWebKitFontPrefFormat[] = "webkit.webprefs.fonts.%s.%s";
61 61
62 // Gets the font name preference path for |generic_family| and |script|. If 62 // Gets the font name preference path for |generic_family| and |script|. If
63 // |script| is NULL, uses prefs::kWebKitCommonScript. 63 // |script| is NULL, uses prefs::kWebKitCommonScript.
64 std::string GetFontNamePrefPath(fonts::GenericFamily generic_family_enum, 64 std::string GetFontNamePrefPath(fonts::GenericFamily generic_family_enum,
65 fonts::ScriptCode script_enum) { 65 fonts::ScriptCode script_enum) {
66 std::string script = fonts::ToString(script_enum); 66 std::string script = fonts::ToString(script_enum);
67 if (script.empty()) 67 if (script.empty())
68 script = prefs::kWebKitCommonScript; 68 script = prefs::kWebKitCommonScript;
69 std::string generic_family = fonts::ToString(generic_family_enum); 69 std::string generic_family = fonts::ToString(generic_family_enum);
70 return StringPrintf(kWebKitFontPrefFormat, 70 return base::StringPrintf(kWebKitFontPrefFormat,
71 generic_family.c_str(), 71 generic_family.c_str(),
72 script.c_str()); 72 script.c_str());
73 } 73 }
74 74
75 // Returns the localized name of a font so that it can be matched within the 75 // Returns the localized name of a font so that it can be matched within the
76 // list of system fonts. On Windows, the list of system fonts has names only 76 // list of system fonts. On Windows, the list of system fonts has names only
77 // for the system locale, but the pref value may be in the English name. 77 // for the system locale, but the pref value may be in the English name.
78 std::string MaybeGetLocalizedFontName(const std::string& font_name) { 78 std::string MaybeGetLocalizedFontName(const std::string& font_name) {
79 #if defined(OS_WIN) 79 #if defined(OS_WIN)
80 if (!font_name.empty()) { 80 if (!font_name.empty()) {
81 gfx::Font font(font_name, 12); // dummy font size 81 gfx::Font font(font_name, 12); // dummy font size
82 return static_cast<gfx::PlatformFontWin*>(font.platform_font())-> 82 return static_cast<gfx::PlatformFontWin*>(font.platform_font())->
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 465
466 const char* FontSettingsSetMinimumFontSizeFunction::GetPrefName() { 466 const char* FontSettingsSetMinimumFontSizeFunction::GetPrefName() {
467 return prefs::kWebKitMinimumFontSize; 467 return prefs::kWebKitMinimumFontSize;
468 } 468 }
469 469
470 const char* FontSettingsSetMinimumFontSizeFunction::GetKey() { 470 const char* FontSettingsSetMinimumFontSizeFunction::GetKey() {
471 return kPixelSizeKey; 471 return kPixelSizeKey;
472 } 472 }
473 473
474 } // namespace extensions 474 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698