| 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/prefs/pref_registry_simple.h" |
| 19 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
| 20 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 21 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 21 #include "chrome/browser/profiles/profile_destroyer.h" | 22 #include "chrome/browser/profiles/profile_destroyer.h" |
| 22 #include "chrome/browser/profiles/profile_info_cache.h" | 23 #include "chrome/browser/profiles/profile_info_cache.h" |
| 23 #include "chrome/browser/profiles/profile_metrics.h" | 24 #include "chrome/browser/profiles/profile_metrics.h" |
| 24 #include "chrome/browser/sync/profile_sync_service.h" | 25 #include "chrome/browser/sync/profile_sync_service.h" |
| 25 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 26 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
| 27 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 28 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| 28 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 57 #include "chrome/browser/ui/browser_window.h" | 58 #include "chrome/browser/ui/browser_window.h" |
| 58 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 59 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 59 #endif // !defined (OS_IOS) | 60 #endif // !defined (OS_IOS) |
| 60 | 61 |
| 61 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
| 62 #include "base/win/metro.h" | 63 #include "base/win/metro.h" |
| 63 #include "chrome/installer/util/browser_distribution.h" | 64 #include "chrome/installer/util/browser_distribution.h" |
| 64 #endif | 65 #endif |
| 65 | 66 |
| 66 #if defined(OS_CHROMEOS) | 67 #if defined(OS_CHROMEOS) |
| 68 #include "chrome/browser/chromeos/login/user_manager.h" |
| 67 #include "chromeos/dbus/cryptohome_client.h" | 69 #include "chromeos/dbus/cryptohome_client.h" |
| 68 #include "chromeos/dbus/dbus_thread_manager.h" | 70 #include "chromeos/dbus/dbus_thread_manager.h" |
| 69 #include "chrome/browser/chromeos/login/user_manager.h" | |
| 70 #endif | 71 #endif |
| 71 | 72 |
| 72 using content::BrowserThread; | 73 using content::BrowserThread; |
| 73 using content::UserMetricsAction; | 74 using content::UserMetricsAction; |
| 74 | 75 |
| 75 namespace { | 76 namespace { |
| 76 | 77 |
| 77 static bool did_perform_profile_import = false; | 78 static bool did_perform_profile_import = false; |
| 78 | 79 |
| 79 // Profiles that should be deleted on shutdown. | 80 // Profiles that should be deleted on shutdown. |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 profile_manager->CreateProfileAsync(new_path, | 842 profile_manager->CreateProfileAsync(new_path, |
| 842 base::Bind(&OnOpenWindowForNewProfile, | 843 base::Bind(&OnOpenWindowForNewProfile, |
| 843 desktop_type, | 844 desktop_type, |
| 844 callback), | 845 callback), |
| 845 name, | 846 name, |
| 846 icon_url, | 847 icon_url, |
| 847 is_managed); | 848 is_managed); |
| 848 } | 849 } |
| 849 | 850 |
| 850 // static | 851 // static |
| 851 void ProfileManager::RegisterPrefs(PrefServiceSimple* prefs) { | 852 void ProfileManager::RegisterPrefs(PrefRegistrySimple* registry) { |
| 852 prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); | 853 registry->RegisterStringPref(prefs::kProfileLastUsed, ""); |
| 853 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); | 854 registry->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); |
| 854 prefs->RegisterListPref(prefs::kProfilesLastActive); | 855 registry->RegisterListPref(prefs::kProfilesLastActive); |
| 855 } | 856 } |
| 856 | 857 |
| 857 size_t ProfileManager::GetNumberOfProfiles() { | 858 size_t ProfileManager::GetNumberOfProfiles() { |
| 858 return GetProfileInfoCache().GetNumberOfProfiles(); | 859 return GetProfileInfoCache().GetNumberOfProfiles(); |
| 859 } | 860 } |
| 860 | 861 |
| 861 bool ProfileManager::CompareProfilePathAndName( | 862 bool ProfileManager::CompareProfilePathAndName( |
| 862 const ProfileManager::ProfilePathAndName& pair1, | 863 const ProfileManager::ProfilePathAndName& pair1, |
| 863 const ProfileManager::ProfilePathAndName& pair2) { | 864 const ProfileManager::ProfilePathAndName& pair2) { |
| 864 int name_compare = pair1.second.compare(pair2.second); | 865 int name_compare = pair1.second.compare(pair2.second); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 ProfileManager::ProfileInfo::ProfileInfo( | 1092 ProfileManager::ProfileInfo::ProfileInfo( |
| 1092 Profile* profile, | 1093 Profile* profile, |
| 1093 bool created) | 1094 bool created) |
| 1094 : profile(profile), | 1095 : profile(profile), |
| 1095 created(created) { | 1096 created(created) { |
| 1096 } | 1097 } |
| 1097 | 1098 |
| 1098 ProfileManager::ProfileInfo::~ProfileInfo() { | 1099 ProfileManager::ProfileInfo::~ProfileInfo() { |
| 1099 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1100 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
| 1100 } | 1101 } |
| OLD | NEW |