| 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 "chrome/browser/prefs/pref_service_syncable_util.h" | 9 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 10 #include "chrome/browser/profiles/off_the_record_profile_impl.h" | 10 #include "chrome/browser/profiles/off_the_record_profile_impl.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 scoped_refptr<RefcountedKeyedService> | 60 scoped_refptr<RefcountedKeyedService> |
| 61 HostContentSettingsMapFactory::BuildServiceInstanceFor( | 61 HostContentSettingsMapFactory::BuildServiceInstanceFor( |
| 62 content::BrowserContext* context) const { | 62 content::BrowserContext* context) const { |
| 63 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 63 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 64 | 64 |
| 65 Profile* profile = static_cast<Profile*>(context); | 65 Profile* profile = static_cast<Profile*>(context); |
| 66 | 66 |
| 67 // If off the record, retrieve the host content settings map of the parent | 67 // If off the record, retrieve the host content settings map of the parent |
| 68 // profile in order to ensure the preferences have been migrated. | 68 // profile in order to ensure the preferences have been migrated. |
| 69 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) | 69 // TODO(crbug.com/277296): Remove check that profile does not equal the |
| 70 // original profile once TestingProfile::ForceIncognito is gone. |
| 71 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE && |
| 72 profile != profile->GetOriginalProfile()) { |
| 70 GetForProfile(profile->GetOriginalProfile()); | 73 GetForProfile(profile->GetOriginalProfile()); |
| 74 } |
| 71 | 75 |
| 72 scoped_refptr<HostContentSettingsMap> settings_map(new HostContentSettingsMap( | 76 scoped_refptr<HostContentSettingsMap> settings_map(new HostContentSettingsMap( |
| 73 profile->GetPrefs(), | 77 profile->GetPrefs(), |
| 74 profile->GetProfileType() == Profile::INCOGNITO_PROFILE, | 78 profile->GetProfileType() == Profile::INCOGNITO_PROFILE, |
| 75 profile->GetProfileType() == Profile::GUEST_PROFILE)); | 79 profile->GetProfileType() == Profile::GUEST_PROFILE)); |
| 76 | 80 |
| 77 syncable_prefs::PrefServiceSyncable* pref_service = | 81 syncable_prefs::PrefServiceSyncable* pref_service = |
| 78 PrefServiceSyncableFromProfile(profile); | 82 PrefServiceSyncableFromProfile(profile); |
| 79 if (pref_service) { | 83 if (pref_service) { |
| 80 pref_service->RegisterMergeDataFinishedCallback( | 84 pref_service->RegisterMergeDataFinishedCallback( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 102 } | 106 } |
| 103 #endif // defined(ENABLE_SUPERVISED_USERS) | 107 #endif // defined(ENABLE_SUPERVISED_USERS) |
| 104 | 108 |
| 105 return settings_map; | 109 return settings_map; |
| 106 } | 110 } |
| 107 | 111 |
| 108 content::BrowserContext* HostContentSettingsMapFactory::GetBrowserContextToUse( | 112 content::BrowserContext* HostContentSettingsMapFactory::GetBrowserContextToUse( |
| 109 content::BrowserContext* context) const { | 113 content::BrowserContext* context) const { |
| 110 return context; | 114 return context; |
| 111 } | 115 } |
| OLD | NEW |