Index: chrome/browser/extensions/component_migration_helper.cc |
diff --git a/chrome/browser/extensions/component_migration_helper.cc b/chrome/browser/extensions/component_migration_helper.cc |
index 7de2caa9773e3e49033483107317284b888d23b4..920fde44faa72d08503a7be4f18ffd193207bd7f 100644 |
--- a/chrome/browser/extensions/component_migration_helper.cc |
+++ b/chrome/browser/extensions/component_migration_helper.cc |
@@ -79,15 +79,10 @@ void ComponentMigrationHelper::OnFeatureEnabled( |
// true if we unloaded an extension. |
const base::DictionaryValue* migration_pref = pref_service_->GetDictionary( |
::prefs::kToolbarMigratedComponentActionStatus); |
- bool has_component_action_pref = migration_pref->HasKey(component_action_id); |
bool component_action_pref = false; |
- if (has_component_action_pref) { |
- bool success = |
- migration_pref->GetBoolean(component_action_id, &component_action_pref); |
- DCHECK(success); // Shouldn't fail, but can in case of pref corruption. |
- } |
- |
- if (!has_component_action_pref && extension_was_installed) { |
+ if (migration_pref->HasKey(component_action_id)) { |
+ component_action_pref = GetComponentActionPref(component_action_id); |
+ } else if (extension_was_installed) { |
Devlin
2016/09/15 21:08:41
Note: this is a behavior change, where previously
takumif
2016/09/16 21:04:05
I believe there's no behavior change. If the pref
|
SetComponentActionPref(component_action_id, true); |
component_action_pref = true; |
} |
@@ -139,6 +134,18 @@ void ComponentMigrationHelper::OnExtensionReady( |
} |
} |
+bool ComponentMigrationHelper::GetComponentActionPref( |
+ const std::string& component_action_id) const { |
+ const base::DictionaryValue* migration_pref = pref_service_->GetDictionary( |
+ ::prefs::kToolbarMigratedComponentActionStatus); |
+ bool component_action_pref = false; |
+ bool success = |
+ migration_pref->GetBoolean(component_action_id, &component_action_pref); |
+ |
+ DCHECK(success); |
+ return component_action_pref; |
+} |
+ |
void ComponentMigrationHelper::SetComponentActionPref( |
const std::string& component_action_id, |
bool enabled) { |