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

Side by Side Diff: chrome/browser/ui/prefs/prefs_tab_helper.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 5 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/prefs/overlay_user_pref_store.h" 9 #include "base/prefs/overlay_user_pref_store.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 #undef EXPAND_SCRIPT_FONT 146 #undef EXPAND_SCRIPT_FONT
147 }; 147 };
148 148
149 for (size_t i = 0; i < arraysize(kFontFamilyMap); ++i) { 149 for (size_t i = 0; i < arraysize(kFontFamilyMap); ++i) {
150 const char* pref_name = kFontFamilyMap[i]; 150 const char* pref_name = kFontFamilyMap[i];
151 if (fonts_with_defaults.find(pref_name) == fonts_with_defaults.end()) { 151 if (fonts_with_defaults.find(pref_name) == fonts_with_defaults.end()) {
152 // We haven't already set a default value for this font preference, so set 152 // We haven't already set a default value for this font preference, so set
153 // an empty string as the default. 153 // an empty string as the default.
154 registry->RegisterStringPref( 154 registry->RegisterStringPref(
155 pref_name, "", PrefRegistrySyncable::UNSYNCABLE_PREF); 155 pref_name, std::string(), PrefRegistrySyncable::UNSYNCABLE_PREF);
156 } 156 }
157 } 157 }
158 } 158 }
159 159
160 #if !defined(OS_ANDROID) 160 #if !defined(OS_ANDROID)
161 // Registers |obs| to observe per-script font prefs under the path |map_name|. 161 // Registers |obs| to observe per-script font prefs under the path |map_name|.
162 // On android, there's no exposed way to change these prefs, so we can save 162 // On android, there's no exposed way to change these prefs, so we can save
163 // ~715KB of heap and some startup cycles by avoiding observing these prefs 163 // ~715KB of heap and some startup cycles by avoiding observing these prefs
164 // since they will never change. 164 // since they will never change.
165 void RegisterFontFamilyMapObserver( 165 void RegisterFontFamilyMapObserver(
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 prefs::kWebKitMinimumLogicalFontSize, 580 prefs::kWebKitMinimumLogicalFontSize,
581 IDS_MINIMUM_LOGICAL_FONT_SIZE, 581 IDS_MINIMUM_LOGICAL_FONT_SIZE,
582 PrefRegistrySyncable::UNSYNCABLE_PREF); 582 PrefRegistrySyncable::UNSYNCABLE_PREF);
583 registry->RegisterLocalizedBooleanPref(prefs::kWebKitUsesUniversalDetector, 583 registry->RegisterLocalizedBooleanPref(prefs::kWebKitUsesUniversalDetector,
584 IDS_USES_UNIVERSAL_DETECTOR, 584 IDS_USES_UNIVERSAL_DETECTOR,
585 PrefRegistrySyncable::SYNCABLE_PREF); 585 PrefRegistrySyncable::SYNCABLE_PREF);
586 registry->RegisterLocalizedStringPref(prefs::kStaticEncodings, 586 registry->RegisterLocalizedStringPref(prefs::kStaticEncodings,
587 IDS_STATIC_ENCODING_LIST, 587 IDS_STATIC_ENCODING_LIST,
588 PrefRegistrySyncable::UNSYNCABLE_PREF); 588 PrefRegistrySyncable::UNSYNCABLE_PREF);
589 registry->RegisterStringPref(prefs::kRecentlySelectedEncoding, 589 registry->RegisterStringPref(prefs::kRecentlySelectedEncoding,
590 "", 590 std::string(),
591 PrefRegistrySyncable::UNSYNCABLE_PREF); 591 PrefRegistrySyncable::UNSYNCABLE_PREF);
592 592
593 RegisterPrefsToMigrate(registry); 593 RegisterPrefsToMigrate(registry);
594 } 594 }
595 595
596 void PrefsTabHelper::MigrateUserPrefs(PrefService* prefs) { 596 void PrefsTabHelper::MigrateUserPrefs(PrefService* prefs) {
597 for (int i = 0; i < kPrefsToMigrateLength; ++i) { 597 for (int i = 0; i < kPrefsToMigrateLength; ++i) {
598 const PrefService::Preference* pref = 598 const PrefService::Preference* pref =
599 prefs->FindPreference(kPrefNamesToMigrate[i].from); 599 prefs->FindPreference(kPrefNamesToMigrate[i].from);
600 if (pref && !pref->IsDefaultValue()) { 600 if (pref && !pref->IsDefaultValue()) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 std::string generic_family; 659 std::string generic_family;
660 std::string script; 660 std::string script;
661 if (pref_names_util::ParseFontNamePrefPath(pref_name, 661 if (pref_names_util::ParseFontNamePrefPath(pref_name,
662 &generic_family, 662 &generic_family,
663 &script)) { 663 &script)) {
664 PrefService* prefs = GetProfile()->GetPrefs(); 664 PrefService* prefs = GetProfile()->GetPrefs();
665 std::string pref_value = prefs->GetString(pref_name.c_str()); 665 std::string pref_value = prefs->GetString(pref_name.c_str());
666 if (pref_value.empty()) { 666 if (pref_value.empty()) {
667 WebPreferences web_prefs = 667 WebPreferences web_prefs =
668 web_contents_->GetRenderViewHost()->GetWebkitPreferences(); 668 web_contents_->GetRenderViewHost()->GetWebkitPreferences();
669 OverrideFontFamily(&web_prefs, generic_family, script, ""); 669 OverrideFontFamily(&web_prefs, generic_family, script, std::string());
670 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs); 670 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs);
671 return; 671 return;
672 } 672 }
673 } 673 }
674 674
675 UpdateWebPreferences(); 675 UpdateWebPreferences();
676 } 676 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/ssl_client_certificate_selector.cc ('k') | chrome/browser/ui/search/instant_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698