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

Side by Side Diff: chrome/browser/extensions/extension_prefs.cc

Issue 5633005: fix extension_prefs.cc compilation for gcc 4.5 (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 10 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 | « no previous file | no next file » | 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) 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 #include "chrome/browser/extensions/extension_prefs.h" 5 #include "chrome/browser/extensions/extension_prefs.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/prefs/pref_notifier.h" 10 #include "chrome/browser/prefs/pref_notifier.h"
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 1118
1119 base::Time ExtensionPrefs::GetCurrentTime() const { 1119 base::Time ExtensionPrefs::GetCurrentTime() const {
1120 return base::Time::Now(); 1120 return base::Time::Now();
1121 } 1121 }
1122 1122
1123 base::Time ExtensionPrefs::GetInstallTime( 1123 base::Time ExtensionPrefs::GetInstallTime(
1124 const std::string& extension_id) const { 1124 const std::string& extension_id) const {
1125 const DictionaryValue* extension = GetExtensionPref(extension_id); 1125 const DictionaryValue* extension = GetExtensionPref(extension_id);
1126 if (!extension) { 1126 if (!extension) {
1127 NOTREACHED(); 1127 NOTREACHED();
1128 return base::Time::Time(); 1128 return base::Time();
1129 } 1129 }
1130 std::string install_time_str("0"); 1130 std::string install_time_str("0");
1131 extension->GetString(kPrefInstallTime, &install_time_str); 1131 extension->GetString(kPrefInstallTime, &install_time_str);
1132 int64 install_time_i64 = 0; 1132 int64 install_time_i64 = 0;
1133 base::StringToInt64(install_time_str, &install_time_i64); 1133 base::StringToInt64(install_time_str, &install_time_i64);
1134 LOG_IF(ERROR, install_time_i64 == 0) 1134 LOG_IF(ERROR, install_time_i64 == 0)
1135 << "Error parsing installation time of an extension."; 1135 << "Error parsing installation time of an extension.";
1136 return base::Time::FromInternalValue(install_time_i64); 1136 return base::Time::FromInternalValue(install_time_i64);
1137 } 1137 }
1138 1138
(...skipping 12 matching lines...) Expand all
1151 1151
1152 void ExtensionPrefs::FixMissingPrefs(const ExtensionIdSet& extension_ids) { 1152 void ExtensionPrefs::FixMissingPrefs(const ExtensionIdSet& extension_ids) {
1153 // Fix old entries that did not get an installation time entry when they 1153 // Fix old entries that did not get an installation time entry when they
1154 // were installed or don't have a preferences field. 1154 // were installed or don't have a preferences field.
1155 bool persist_required = false; 1155 bool persist_required = false;
1156 for (ExtensionIdSet::const_iterator ext_id = extension_ids.begin(); 1156 for (ExtensionIdSet::const_iterator ext_id = extension_ids.begin();
1157 ext_id != extension_ids.end(); ++ext_id) { 1157 ext_id != extension_ids.end(); ++ext_id) {
1158 DictionaryValue* extension = GetExtensionPref(*ext_id); 1158 DictionaryValue* extension = GetExtensionPref(*ext_id);
1159 CHECK(extension); 1159 CHECK(extension);
1160 1160
1161 if (GetInstallTime(*ext_id) == base::Time::Time()) { 1161 if (GetInstallTime(*ext_id) == base::Time()) {
1162 const base::Time install_time = GetCurrentTime(); 1162 const base::Time install_time = GetCurrentTime();
1163 extension->Set(kPrefInstallTime, 1163 extension->Set(kPrefInstallTime,
1164 Value::CreateStringValue( 1164 Value::CreateStringValue(
1165 base::Int64ToString(install_time.ToInternalValue()))); 1165 base::Int64ToString(install_time.ToInternalValue())));
1166 persist_required = true; 1166 persist_required = true;
1167 } 1167 }
1168 } 1168 }
1169 if (persist_required) 1169 if (persist_required)
1170 SavePrefsAndNotify(); 1170 SavePrefsAndNotify();
1171 } 1171 }
(...skipping 12 matching lines...) Expand all
1184 GetExtensionControlledPrefKeys(*ext_id, &ext_controlled_prefs); 1184 GetExtensionControlledPrefKeys(*ext_id, &ext_controlled_prefs);
1185 } 1185 }
1186 1186
1187 // Store winning preference for each extension controlled preference. 1187 // Store winning preference for each extension controlled preference.
1188 UpdatePrefStore(ext_controlled_prefs); 1188 UpdatePrefStore(ext_controlled_prefs);
1189 } 1189 }
1190 1190
1191 const Value* ExtensionPrefs::GetWinningExtensionControlledPrefValue( 1191 const Value* ExtensionPrefs::GetWinningExtensionControlledPrefValue(
1192 const std::string& key) const { 1192 const std::string& key) const {
1193 Value *winner = NULL; 1193 Value *winner = NULL;
1194 base::Time winners_install_time = base::Time::Time(); 1194 base::Time winners_install_time = base::Time();
1195 1195
1196 ExtensionIdSet extension_ids; 1196 ExtensionIdSet extension_ids;
1197 GetEnabledExtensions(&extension_ids); 1197 GetEnabledExtensions(&extension_ids);
1198 for (ExtensionIdSet::iterator ext_id = extension_ids.begin(); 1198 for (ExtensionIdSet::iterator ext_id = extension_ids.begin();
1199 ext_id != extension_ids.end(); ++ext_id) { 1199 ext_id != extension_ids.end(); ++ext_id) {
1200 base::Time extension_install_time = GetInstallTime(*ext_id); 1200 base::Time extension_install_time = GetInstallTime(*ext_id);
1201 1201
1202 // We do not need to consider extensions that were installed before the 1202 // We do not need to consider extensions that were installed before the
1203 // most recent extension found that provides the requested preference. 1203 // most recent extension found that provides the requested preference.
1204 if (extension_install_time < winners_install_time) 1204 if (extension_install_time < winners_install_time)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { 1298 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) {
1299 prefs->RegisterDictionaryPref(kExtensionsPref); 1299 prefs->RegisterDictionaryPref(kExtensionsPref);
1300 prefs->RegisterListPref(kExtensionToolbar); 1300 prefs->RegisterListPref(kExtensionToolbar);
1301 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); 1301 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1);
1302 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); 1302 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate);
1303 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); 1303 prefs->RegisterListPref(prefs::kExtensionInstallAllowList);
1304 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); 1304 prefs->RegisterListPref(prefs::kExtensionInstallDenyList);
1305 prefs->RegisterListPref(prefs::kExtensionInstallForceList); 1305 prefs->RegisterListPref(prefs::kExtensionInstallForceList);
1306 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); 1306 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */);
1307 } 1307 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698