| 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/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/content_settings/host_content_settings_map.h" | 18 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 19 #include "chrome/browser/managed_mode/managed_mode.h" | 19 #include "chrome/browser/managed_mode/managed_mode.h" |
| 20 #include "chrome/browser/prefs/pref_registrar_simple.h" |
| 20 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 21 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 22 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 22 #include "chrome/browser/profiles/profile_destroyer.h" | 23 #include "chrome/browser/profiles/profile_destroyer.h" |
| 23 #include "chrome/browser/profiles/profile_info_cache.h" | 24 #include "chrome/browser/profiles/profile_info_cache.h" |
| 24 #include "chrome/browser/profiles/profile_metrics.h" | 25 #include "chrome/browser/profiles/profile_metrics.h" |
| 25 #include "chrome/browser/sync/profile_sync_service.h" | 26 #include "chrome/browser/sync/profile_sync_service.h" |
| 26 #include "chrome/browser/sync/profile_sync_service_factory.h" | 27 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 27 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 29 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| 29 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 52 #include "chrome/browser/ui/browser_window.h" | 53 #include "chrome/browser/ui/browser_window.h" |
| 53 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 54 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 54 #endif // !defined (OS_IOS) | 55 #endif // !defined (OS_IOS) |
| 55 | 56 |
| 56 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
| 57 #include "base/win/metro.h" | 58 #include "base/win/metro.h" |
| 58 #include "chrome/installer/util/browser_distribution.h" | 59 #include "chrome/installer/util/browser_distribution.h" |
| 59 #endif | 60 #endif |
| 60 | 61 |
| 61 #if defined(OS_CHROMEOS) | 62 #if defined(OS_CHROMEOS) |
| 63 #include "chrome/browser/chromeos/login/user_manager.h" |
| 62 #include "chromeos/dbus/cryptohome_client.h" | 64 #include "chromeos/dbus/cryptohome_client.h" |
| 63 #include "chromeos/dbus/dbus_thread_manager.h" | 65 #include "chromeos/dbus/dbus_thread_manager.h" |
| 64 #include "chrome/browser/chromeos/login/user_manager.h" | |
| 65 #endif | 66 #endif |
| 66 | 67 |
| 67 using content::BrowserThread; | 68 using content::BrowserThread; |
| 68 using content::UserMetricsAction; | 69 using content::UserMetricsAction; |
| 69 | 70 |
| 70 namespace { | 71 namespace { |
| 71 | 72 |
| 72 static bool did_perform_profile_import = false; | 73 static bool did_perform_profile_import = false; |
| 73 | 74 |
| 74 // Profiles that should be deleted on shutdown. | 75 // Profiles that should be deleted on shutdown. |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 profile_manager->CreateProfileAsync(new_path, | 823 profile_manager->CreateProfileAsync(new_path, |
| 823 base::Bind(&OnOpenWindowForNewProfile, | 824 base::Bind(&OnOpenWindowForNewProfile, |
| 824 desktop_type, | 825 desktop_type, |
| 825 callback), | 826 callback), |
| 826 name, | 827 name, |
| 827 icon_url, | 828 icon_url, |
| 828 is_managed); | 829 is_managed); |
| 829 } | 830 } |
| 830 | 831 |
| 831 // static | 832 // static |
| 832 void ProfileManager::RegisterPrefs(PrefServiceSimple* prefs) { | 833 void ProfileManager::RegisterPrefs(PrefRegistrarSimple* prefs) { |
| 833 prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); | 834 prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); |
| 834 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); | 835 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); |
| 835 prefs->RegisterListPref(prefs::kProfilesLastActive); | 836 prefs->RegisterListPref(prefs::kProfilesLastActive); |
| 836 } | 837 } |
| 837 | 838 |
| 838 size_t ProfileManager::GetNumberOfProfiles() { | 839 size_t ProfileManager::GetNumberOfProfiles() { |
| 839 return GetProfileInfoCache().GetNumberOfProfiles(); | 840 return GetProfileInfoCache().GetNumberOfProfiles(); |
| 840 } | 841 } |
| 841 | 842 |
| 842 bool ProfileManager::CompareProfilePathAndName( | 843 bool ProfileManager::CompareProfilePathAndName( |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 ProfileManager::ProfileInfo::ProfileInfo( | 1062 ProfileManager::ProfileInfo::ProfileInfo( |
| 1062 Profile* profile, | 1063 Profile* profile, |
| 1063 bool created) | 1064 bool created) |
| 1064 : profile(profile), | 1065 : profile(profile), |
| 1065 created(created) { | 1066 created(created) { |
| 1066 } | 1067 } |
| 1067 | 1068 |
| 1068 ProfileManager::ProfileInfo::~ProfileInfo() { | 1069 ProfileManager::ProfileInfo::~ProfileInfo() { |
| 1069 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1070 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
| 1070 } | 1071 } |
| OLD | NEW |