| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 5 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/feature_list.h" |
| 9 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 10 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 10 #include "chrome/browser/profiles/off_the_record_profile_impl.h" | 11 #include "chrome/browser/profiles/off_the_record_profile_impl.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/chrome_features.h" |
| 12 #include "components/content_settings/core/browser/host_content_settings_map.h" | 14 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 13 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 14 #include "components/sync_preferences/pref_service_syncable.h" | 16 #include "components/sync_preferences/pref_service_syncable.h" |
| 15 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 16 #include "extensions/features/features.h" | 18 #include "extensions/features/features.h" |
| 17 | 19 |
| 18 #if BUILDFLAG(ENABLE_EXTENSIONS) | 20 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 19 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "extensions/browser/extension_system.h" | 22 #include "extensions/browser/extension_system.h" |
| 21 #include "extensions/browser/extension_system_provider.h" | 23 #include "extensions/browser/extension_system_provider.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 69 |
| 68 // If off the record, retrieve the host content settings map of the parent | 70 // If off the record, retrieve the host content settings map of the parent |
| 69 // profile in order to ensure the preferences have been migrated. | 71 // profile in order to ensure the preferences have been migrated. |
| 70 // TODO(crbug.com/277296): Remove check that profile does not equal the | 72 // TODO(crbug.com/277296): Remove check that profile does not equal the |
| 71 // original profile once TestingProfile::ForceIncognito is gone. | 73 // original profile once TestingProfile::ForceIncognito is gone. |
| 72 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE && | 74 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE && |
| 73 profile != profile->GetOriginalProfile()) { | 75 profile != profile->GetOriginalProfile()) { |
| 74 GetForProfile(profile->GetOriginalProfile()); | 76 GetForProfile(profile->GetOriginalProfile()); |
| 75 } | 77 } |
| 76 | 78 |
| 79 bool store_last_modified = base::FeatureList::IsEnabled(features::kTabsInCbd); |
| 80 |
| 77 scoped_refptr<HostContentSettingsMap> settings_map(new HostContentSettingsMap( | 81 scoped_refptr<HostContentSettingsMap> settings_map(new HostContentSettingsMap( |
| 78 profile->GetPrefs(), | 82 profile->GetPrefs(), |
| 79 profile->GetProfileType() == Profile::INCOGNITO_PROFILE, | 83 profile->GetProfileType() == Profile::INCOGNITO_PROFILE, |
| 80 profile->GetProfileType() == Profile::GUEST_PROFILE)); | 84 profile->GetProfileType() == Profile::GUEST_PROFILE, |
| 85 store_last_modified)); |
| 81 | 86 |
| 82 sync_preferences::PrefServiceSyncable* pref_service = | 87 sync_preferences::PrefServiceSyncable* pref_service = |
| 83 PrefServiceSyncableFromProfile(profile); | 88 PrefServiceSyncableFromProfile(profile); |
| 84 if (pref_service) { | 89 if (pref_service) { |
| 85 pref_service->RegisterMergeDataFinishedCallback( | 90 pref_service->RegisterMergeDataFinishedCallback( |
| 86 base::Bind(&HostContentSettingsMap::MigrateDomainScopedSettings, | 91 base::Bind(&HostContentSettingsMap::MigrateDomainScopedSettings, |
| 87 settings_map->GetWeakPtr(), true /* after_sync */)); | 92 settings_map->GetWeakPtr(), true /* after_sync */)); |
| 88 } | 93 } |
| 89 | 94 |
| 90 #if BUILDFLAG(ENABLE_EXTENSIONS) | 95 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 107 } | 112 } |
| 108 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) | 113 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 109 | 114 |
| 110 return settings_map; | 115 return settings_map; |
| 111 } | 116 } |
| 112 | 117 |
| 113 content::BrowserContext* HostContentSettingsMapFactory::GetBrowserContextToUse( | 118 content::BrowserContext* HostContentSettingsMapFactory::GetBrowserContextToUse( |
| 114 content::BrowserContext* context) const { | 119 content::BrowserContext* context) const { |
| 115 return context; | 120 return context; |
| 116 } | 121 } |
| OLD | NEW |