summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extension_prefs.cc14
-rw-r--r--chrome/browser/extensions/extension_prefs.h2
2 files changed, 11 insertions, 5 deletions
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index 1f128ab..da1bd25 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -1135,12 +1135,12 @@ base::Time ExtensionPrefs::GetInstallTime(
NOTREACHED();
return base::Time();
}
- std::string install_time_str("0");
- extension->GetString(kPrefInstallTime, &install_time_str);
+ std::string install_time_str;
+ if (!extension->GetString(kPrefInstallTime, &install_time_str))
+ return base::Time();
int64 install_time_i64 = 0;
- base::StringToInt64(install_time_str, &install_time_i64);
- LOG_IF(ERROR, install_time_i64 == 0)
- << "Error parsing installation time of an extension.";
+ if (!base::StringToInt64(install_time_str, &install_time_i64))
+ return base::Time();
return base::Time::FromInternalValue(install_time_i64);
}
@@ -1167,6 +1167,10 @@ void ExtensionPrefs::FixMissingPrefs(const ExtensionIdSet& extension_ids) {
CHECK(extension);
if (GetInstallTime(*ext_id) == base::Time()) {
+ LOG(INFO) << "Could not parse installation time of extension "
+ << *ext_id << ". It was probably installed before setting "
+ << kPrefInstallTime << " was introduced. Updating "
+ << kPrefInstallTime << " to the current time.";
const base::Time install_time = GetCurrentTime();
extension->Set(kPrefInstallTime,
Value::CreateStringValue(
diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h
index 8c8be82..f02f6ec 100644
--- a/chrome/browser/extensions/extension_prefs.h
+++ b/chrome/browser/extensions/extension_prefs.h
@@ -357,6 +357,8 @@ class ExtensionPrefs {
void SetLastPingDayImpl(const base::Time& time, DictionaryValue* dictionary);
// Helper method to acquire the installation time of an extension.
+ // Returns base::Time() if the installation time could not be parsed or
+ // found.
base::Time GetInstallTime(const std::string& extension_id) const;
// Fix missing preference entries in the extensions that are were introduced