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

Unified Diff: chrome/browser/content_settings/host_content_settings_map_factory.cc

Issue 2158743002: Register a pref to control migration status (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@change_scoping_type
Patch Set: add some comments Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/content_settings/host_content_settings_map_factory.cc
diff --git a/chrome/browser/content_settings/host_content_settings_map_factory.cc b/chrome/browser/content_settings/host_content_settings_map_factory.cc
index bbe6d4d6331ecc4918c39efa2620a76ff1be40a1..d6c9ff5403ed7289d712c92ab9078792d6a4af27 100644
--- a/chrome/browser/content_settings/host_content_settings_map_factory.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_factory.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/profiles/off_the_record_profile_impl.h"
#include "chrome/browser/profiles/profile.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
+#include "components/content_settings/core/common/pref_names.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/syncable_prefs/pref_service_syncable.h"
#include "content/public/browser/browser_thread.h"
@@ -74,12 +75,17 @@ scoped_refptr<RefcountedKeyedService>
profile->GetProfileType() == Profile::INCOGNITO_PROFILE,
profile->GetProfileType() == Profile::GUEST_PROFILE));
- syncable_prefs::PrefServiceSyncable* pref_service =
- PrefServiceSyncableFromProfile(profile);
- if (pref_service) {
- pref_service->RegisterMergeDataFinishedCallback(
- base::Bind(&HostContentSettingsMap::MigrateDomainScopedSettings,
- settings_map->GetWeakPtr()));
+ if (profile->GetPrefs()->GetInteger(prefs::kContentSettingsMigrationStatus) ==
+ content_settings::DONE_IN_HCSM) {
+ syncable_prefs::PrefServiceSyncable* pref_service =
+ PrefServiceSyncableFromProfile(profile);
+ if (pref_service) {
+ pref_service->RegisterMergeDataFinishedCallback(
+ base::Bind(&HostContentSettingsMap::MigrateDomainScopedSettings,
+ settings_map->GetWeakPtr()));
+ profile->GetPrefs()->SetInteger(prefs::kContentSettingsMigrationStatus,
+ content_settings::DONE_IN_HCSM_AND_SYNC);
raymes 2016/07/19 01:48:15 Instead of checking/modifying the pref here, I thi
lshang 2016/07/19 07:45:56 We all need to run the migration code either befor
lshang 2016/07/20 06:16:20 Done.
+ }
}
#if defined(ENABLE_EXTENSIONS)

Powered by Google App Engine
This is Rietveld 408576698