| OLD | NEW |
| 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/extensions/default_apps_trial.h" | 19 #include "chrome/browser/extensions/default_apps_trial.h" |
| 20 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
| 21 #include "chrome/browser/extensions/extension_system.h" |
| 22 #include "chrome/browser/extensions/extension_system_factory.h" |
| 21 #include "chrome/browser/managed_mode.h" | 23 #include "chrome/browser/managed_mode.h" |
| 22 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
| 23 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 25 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 24 #include "chrome/browser/profiles/profile_info_cache.h" | 26 #include "chrome/browser/profiles/profile_info_cache.h" |
| 25 #include "chrome/browser/profiles/profile_metrics.h" | 27 #include "chrome/browser/profiles/profile_metrics.h" |
| 26 #include "chrome/browser/sessions/session_service_factory.h" | 28 #include "chrome/browser/sessions/session_service_factory.h" |
| 27 #include "chrome/browser/sync/profile_sync_service.h" | 29 #include "chrome/browser/sync/profile_sync_service.h" |
| 28 #include "chrome/browser/sync/profile_sync_service_factory.h" | 30 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 29 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
| 30 #include "chrome/browser/ui/browser_window.h" | 32 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 605 |
| 604 ProfileMetrics::LogNumberOfProfiles(this, ProfileMetrics::ADD_PROFILE_EVENT); | 606 ProfileMetrics::LogNumberOfProfiles(this, ProfileMetrics::ADD_PROFILE_EVENT); |
| 605 content::NotificationService::current()->Notify( | 607 content::NotificationService::current()->Notify( |
| 606 chrome::NOTIFICATION_PROFILE_ADDED, | 608 chrome::NOTIFICATION_PROFILE_ADDED, |
| 607 content::Source<Profile>(profile), | 609 content::Source<Profile>(profile), |
| 608 content::NotificationService::NoDetails()); | 610 content::NotificationService::NoDetails()); |
| 609 | 611 |
| 610 } | 612 } |
| 611 | 613 |
| 612 void ProfileManager::DoFinalInitForServices(Profile* profile, | 614 void ProfileManager::DoFinalInitForServices(Profile* profile, |
| 613 bool go_off_the_record) { | 615 bool go_off_the_record) { |
| 614 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 616 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 615 profile->InitExtensions(!go_off_the_record); | 617 ExtensionSystemFactory::GetForProfile(profile)->Init(!go_off_the_record); |
| 616 if (!command_line.HasSwitch(switches::kDisableWebResources)) | 618 if (!command_line.HasSwitch(switches::kDisableWebResources)) |
| 617 profile->InitPromoResources(); | 619 profile->InitPromoResources(); |
| 618 } | 620 } |
| 619 | 621 |
| 620 void ProfileManager::DoFinalInitLogging(Profile* profile) { | 622 void ProfileManager::DoFinalInitLogging(Profile* profile) { |
| 621 // Count number of extensions in this profile. | 623 // Count number of extensions in this profile. |
| 622 int extension_count = -1; | 624 int extension_count = -1; |
| 623 ExtensionService* extension_service = profile->GetExtensionService(); | 625 ExtensionService* extension_service = profile->GetExtensionService(); |
| 624 if (extension_service) | 626 if (extension_service) |
| 625 extension_count = extension_service->GetAppIds().size(); | 627 extension_count = extension_service->GetAppIds().size(); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 AddProfileToCache(profile); | 931 AddProfileToCache(profile); |
| 930 } | 932 } |
| 931 } | 933 } |
| 932 | 934 |
| 933 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 935 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
| 934 Profile* profile, | 936 Profile* profile, |
| 935 Profile::CreateStatus status) { | 937 Profile::CreateStatus status) { |
| 936 for (size_t i = 0; i < callbacks.size(); ++i) | 938 for (size_t i = 0; i < callbacks.size(); ++i) |
| 937 callbacks[i].Run(profile, status); | 939 callbacks[i].Run(profile, status); |
| 938 } | 940 } |
| OLD | NEW |