Chromium Code Reviews| Index: chrome/browser/extensions/extension_prefs.cc |
| diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc |
| index 2c5dc80dedba1f11412b7935529e3c7af619c25d..4feb89f163bd2cbc46a2bbf2cf5f1522c11c3775 100644 |
| --- a/chrome/browser/extensions/extension_prefs.cc |
| +++ b/chrome/browser/extensions/extension_prefs.cc |
| @@ -57,6 +57,9 @@ const char kPrefOrphanAcknowledged[] = "ack_orphan"; |
| // Indicates whether to show an install warning when the user enables. |
| const char kExtensionDidEscalatePermissions[] = "install_warning_on_enable"; |
| +// Indicates whether the extension was updated while it was disabled. |
| +const char kPrefDisableReason[] = "disable_reason"; |
| + |
| // A preference that tracks browser action toolbar configuration. This is a list |
| // object stored in the Preferences file. The extensions are stored by ID. |
| const char kExtensionToolbar[] = "extensions.toolbar"; |
| @@ -673,6 +676,25 @@ void ExtensionPrefs::SetDidExtensionEscalatePermissions( |
| Value::CreateBooleanValue(did_escalate)); |
| } |
| +ExtensionPrefs::DisableReason ExtensionPrefs::GetDisableReason( |
| + const std::string& extension_id) { |
| + int value = -1; |
| + if (ReadExtensionPrefInteger(extension_id, kPrefDisableReason, &value) && |
| + (value == DISABLE_UNKNOWN || |
| + value == DISABLE_USER_ACTION || |
| + value == DISABLE_PERMISSIONS_INCREASE || |
| + value == DISABLE_RELOAD)) |
|
Aaron Boodman
2012/04/09 20:30:48
You could add a DISABLE_LAST to simplify this.
Yoyo Zhou
2012/04/10 01:57:36
I guess so.
|
| + return static_cast<DisableReason>(value); |
| + return DISABLE_UNKNOWN; |
| +} |
| + |
| +void ExtensionPrefs::SetDisableReason(const std::string& extension_id, |
| + DisableReason disable_reason) { |
| + UpdateExtensionPref( |
|
Aaron Boodman
2012/04/09 20:30:48
Consider removing the key in the case of UNKNOWN t
Yoyo Zhou
2012/04/10 01:57:36
Added a Remove* function.
|
| + extension_id, kPrefDisableReason, |
| + Value::CreateIntegerValue(static_cast<int>(disable_reason))); |
| +} |
| + |
| void ExtensionPrefs::UpdateBlacklist( |
| const std::set<std::string>& blacklist_set) { |
| std::vector<std::string> remove_pref_ids; |