| Index: chrome/browser/extensions/extension_prefs.cc
|
| diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
|
| index c7f5bbf4d2b3581bad5d0e1015f644c8f0408f4e..9fe9d3d12a5706c6466a49dda49db60a57bd5d3d 100644
|
| --- a/chrome/browser/extensions/extension_prefs.cc
|
| +++ b/chrome/browser/extensions/extension_prefs.cc
|
| @@ -121,6 +121,9 @@ const char kExtensionsBlacklistUpdate[] = "extensions.blacklistupdate";
|
| // updates that were waiting for idle.
|
| const char kDelayedInstallInfo[] = "idle_install_info";
|
|
|
| +// Reason why the extension's install was delayed.
|
| +const char kDelayedInstallReason[] = "delay_install_reason";
|
| +
|
| // Path for the suggested page ordinal of a delayed extension install.
|
| const char kPrefSuggestedPageOrdinal[] = "suggested_page_ordinal";
|
|
|
| @@ -1328,6 +1331,7 @@ ExtensionPrefs::GetInstalledExtensionsInfo() const {
|
| void ExtensionPrefs::SetDelayedInstallInfo(
|
| const Extension* extension,
|
| Extension::State initial_state,
|
| + DelayReason delay_reason,
|
| const syncer::StringOrdinal& page_ordinal) {
|
| DictionaryValue* extension_dict = new DictionaryValue();
|
| PopulateExtensionInfoPrefs(extension, time_provider_->GetCurrentTime(),
|
| @@ -1342,6 +1346,8 @@ void ExtensionPrefs::SetDelayedInstallInfo(
|
| page_ordinal.IsValid() ? page_ordinal.ToInternalValue()
|
| : std::string());
|
| }
|
| + extension_dict->SetInteger(kDelayedInstallReason,
|
| + static_cast<int>(delay_reason));
|
|
|
| UpdateExtensionPref(extension->id(), kDelayedInstallInfo, extension_dict);
|
| }
|
| @@ -1377,6 +1383,7 @@ bool ExtensionPrefs::FinishDelayedInstallInfo(
|
| needs_sort_ordinal = true;
|
| pending_install_dict->Remove(kPrefSuggestedPageOrdinal, NULL);
|
| }
|
| + pending_install_dict->Remove(kDelayedInstallReason, NULL);
|
|
|
| const base::Time install_time = time_provider_->GetCurrentTime();
|
| pending_install_dict->Set(
|
| @@ -1405,6 +1412,24 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetDelayedInstallInfo(
|
| return GetInstalledInfoHelper(extension_id, ext);
|
| }
|
|
|
| +ExtensionPrefs::DelayReason ExtensionPrefs::GetDelayedInstallReason(
|
| + const std::string& extension_id) const {
|
| + const DictionaryValue* extension_prefs =
|
| + GetExtensionPref(extension_id);
|
| + if (!extension_prefs)
|
| + return DELAY_REASON_NONE;
|
| +
|
| + const DictionaryValue* ext = NULL;
|
| + if (!extension_prefs->GetDictionary(kDelayedInstallInfo, &ext))
|
| + return DELAY_REASON_NONE;
|
| +
|
| + int delay_reason;
|
| + if (!ext->GetInteger(kDelayedInstallReason, &delay_reason))
|
| + return DELAY_REASON_NONE;
|
| +
|
| + return static_cast<DelayReason>(delay_reason);
|
| +}
|
| +
|
| scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs::
|
| GetAllDelayedInstallInfo() const {
|
| scoped_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo);
|
| @@ -1465,6 +1490,16 @@ int ExtensionPrefs::GetCreationFlags(const std::string& extension_id) const {
|
| return creation_flags;
|
| }
|
|
|
| +int ExtensionPrefs::GetDelayedInstallCreationFlags(
|
| + const std::string& extension_id) const {
|
| + int creation_flags = Extension::NO_FLAGS;
|
| + const DictionaryValue* delayed_info = NULL;
|
| + if (ReadPrefAsDictionary(extension_id, kDelayedInstallInfo, &delayed_info)) {
|
| + delayed_info->GetInteger(kPrefCreationFlags, &creation_flags);
|
| + }
|
| + return creation_flags;
|
| +}
|
| +
|
| bool ExtensionPrefs::WasInstalledByDefault(
|
| const std::string& extension_id) const {
|
| const DictionaryValue* dictionary = GetExtensionPref(extension_id);
|
|
|