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

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 2866613003: Solve ProfileIOData, Extension, HostContentSettingsMap ordering issue. (Closed)
Patch Set: Uninteresting merge, add TODO Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/profiles/profile_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 profiles::ProfileStatisticsCallback()); 1198 profiles::ProfileStatisticsCallback());
1199 } 1199 }
1200 #endif 1200 #endif
1201 } 1201 }
1202 1202
1203 void ProfileManager::DoFinalInitForServices(Profile* profile, 1203 void ProfileManager::DoFinalInitForServices(Profile* profile,
1204 bool go_off_the_record) { 1204 bool go_off_the_record) {
1205 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices"); 1205 TRACE_EVENT0("browser", "ProfileManager::DoFinalInitForServices");
1206 1206
1207 #if BUILDFLAG(ENABLE_EXTENSIONS) 1207 #if BUILDFLAG(ENABLE_EXTENSIONS)
1208 // Ensure that the HostContentSettingsMap has been created before the
1209 // ExtensionSystem is initialized otherwise the ExtensionSystem will be
1210 // registered twice
1211 HostContentSettingsMap* content_settings_map =
1212 HostContentSettingsMapFactory::GetForProfile(profile);
1213
1214 bool extensions_enabled = !go_off_the_record; 1208 bool extensions_enabled = !go_off_the_record;
1215 #if defined(OS_CHROMEOS) 1209 #if defined(OS_CHROMEOS)
1216 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 1210 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1217 switches::kDisableLoginScreenApps) && 1211 switches::kDisableLoginScreenApps) &&
1218 chromeos::ProfileHelper::IsSigninProfile(profile)) { 1212 chromeos::ProfileHelper::IsSigninProfile(profile)) {
1219 extensions_enabled = true; 1213 extensions_enabled = true;
1220 } 1214 }
1221 #endif 1215 #endif
1222 extensions::ExtensionSystem::Get(profile)->InitForRegularProfile( 1216 extensions::ExtensionSystem::Get(profile)->InitForRegularProfile(
1223 extensions_enabled); 1217 extensions_enabled);
1224 // During tests, when |profile| is an instance of TestingProfile, 1218
1225 // ExtensionSystem might not create an ExtensionService.
1226 // This block is duplicated in the HostContentSettingsMapFactory
1227 // ::BuildServiceInstanceFor method, it should be called once when both the
1228 // HostContentSettingsMap and the extension_service are set up.
1229 if (extensions::ExtensionSystem::Get(profile)->extension_service()) {
1230 extensions::ExtensionSystem::Get(profile)->extension_service()->
1231 RegisterContentSettings(content_settings_map);
1232 }
1233 // Set the block extensions bit on the ExtensionService. There likely are no 1219 // Set the block extensions bit on the ExtensionService. There likely are no
1234 // blockable extensions to block. 1220 // blockable extensions to block.
1235 ProfileAttributesEntry* entry; 1221 ProfileAttributesEntry* entry;
1236 bool has_entry = GetProfileAttributesStorage(). 1222 bool has_entry = GetProfileAttributesStorage().
1237 GetProfileAttributesWithPath(profile->GetPath(), &entry); 1223 GetProfileAttributesWithPath(profile->GetPath(), &entry);
1238 if (has_entry && entry->IsSigninRequired()) { 1224 if (has_entry && entry->IsSigninRequired()) {
1239 extensions::ExtensionSystem::Get(profile) 1225 extensions::ExtensionSystem::Get(profile)
1240 ->extension_service() 1226 ->extension_service()
1241 ->BlockAllExtensions(); 1227 ->BlockAllExtensions();
1242 } 1228 }
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 1780
1795 const base::FilePath new_active_profile_dir = 1781 const base::FilePath new_active_profile_dir =
1796 found_entry ? found_entry->GetPath() : GenerateNextProfileDirectoryPath(); 1782 found_entry ? found_entry->GetPath() : GenerateNextProfileDirectoryPath();
1797 FinishDeletingProfile(profile_dir, new_active_profile_dir); 1783 FinishDeletingProfile(profile_dir, new_active_profile_dir);
1798 } 1784 }
1799 #endif // !defined(OS_ANDROID) 1785 #endif // !defined(OS_ANDROID)
1800 1786
1801 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1787 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1802 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1788 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1803 } 1789 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698