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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 profile_manager->CreateProfileAsync(new_path, | 838 profile_manager->CreateProfileAsync(new_path, |
838 base::Bind(&OnOpenWindowForNewProfile, | 839 base::Bind(&OnOpenWindowForNewProfile, |
839 desktop_type, | 840 desktop_type, |
840 callback), | 841 callback), |
841 name, | 842 name, |
842 icon_url, | 843 icon_url, |
843 is_managed); | 844 is_managed); |
844 } | 845 } |
845 | 846 |
846 // static | 847 // static |
847 void ProfileManager::RegisterPrefs(PrefServiceSimple* prefs) { | 848 void ProfileManager::RegisterPrefs(PrefRegistrySimple* prefs) { |
848 prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); | 849 prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); |
849 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); | 850 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); |
850 prefs->RegisterListPref(prefs::kProfilesLastActive); | 851 prefs->RegisterListPref(prefs::kProfilesLastActive); |
851 } | 852 } |
852 | 853 |
853 size_t ProfileManager::GetNumberOfProfiles() { | 854 size_t ProfileManager::GetNumberOfProfiles() { |
854 return GetProfileInfoCache().GetNumberOfProfiles(); | 855 return GetProfileInfoCache().GetNumberOfProfiles(); |
855 } | 856 } |
856 | 857 |
857 bool ProfileManager::CompareProfilePathAndName( | 858 bool ProfileManager::CompareProfilePathAndName( |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 ProfileManager::ProfileInfo::ProfileInfo( | 1088 ProfileManager::ProfileInfo::ProfileInfo( |
1088 Profile* profile, | 1089 Profile* profile, |
1089 bool created) | 1090 bool created) |
1090 : profile(profile), | 1091 : profile(profile), |
1091 created(created) { | 1092 created(created) { |
1092 } | 1093 } |
1093 | 1094 |
1094 ProfileManager::ProfileInfo::~ProfileInfo() { | 1095 ProfileManager::ProfileInfo::~ProfileInfo() { |
1095 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1096 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
1096 } | 1097 } |
OLD | NEW |