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_registry_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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 profile_manager->CreateProfileAsync(new_path, | 833 profile_manager->CreateProfileAsync(new_path, |
833 base::Bind(&OnOpenWindowForNewProfile, | 834 base::Bind(&OnOpenWindowForNewProfile, |
834 desktop_type, | 835 desktop_type, |
835 callback), | 836 callback), |
836 name, | 837 name, |
837 icon_url, | 838 icon_url, |
838 is_managed); | 839 is_managed); |
839 } | 840 } |
840 | 841 |
841 // static | 842 // static |
842 void ProfileManager::RegisterPrefs(PrefServiceSimple* prefs) { | 843 void ProfileManager::RegisterPrefs(PrefRegistrySimple* prefs) { |
843 prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); | 844 prefs->RegisterStringPref(prefs::kProfileLastUsed, ""); |
844 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); | 845 prefs->RegisterIntegerPref(prefs::kProfilesNumCreated, 1); |
845 prefs->RegisterListPref(prefs::kProfilesLastActive); | 846 prefs->RegisterListPref(prefs::kProfilesLastActive); |
846 } | 847 } |
847 | 848 |
848 size_t ProfileManager::GetNumberOfProfiles() { | 849 size_t ProfileManager::GetNumberOfProfiles() { |
849 return GetProfileInfoCache().GetNumberOfProfiles(); | 850 return GetProfileInfoCache().GetNumberOfProfiles(); |
850 } | 851 } |
851 | 852 |
852 bool ProfileManager::CompareProfilePathAndName( | 853 bool ProfileManager::CompareProfilePathAndName( |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 ProfileManager::ProfileInfo::ProfileInfo( | 1072 ProfileManager::ProfileInfo::ProfileInfo( |
1072 Profile* profile, | 1073 Profile* profile, |
1073 bool created) | 1074 bool created) |
1074 : profile(profile), | 1075 : profile(profile), |
1075 created(created) { | 1076 created(created) { |
1076 } | 1077 } |
1077 | 1078 |
1078 ProfileManager::ProfileInfo::~ProfileInfo() { | 1079 ProfileManager::ProfileInfo::~ProfileInfo() { |
1079 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1080 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
1080 } | 1081 } |
OLD | NEW |