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 "chrome/browser/profiles/profile_manager.h" | 5 #include "chrome/browser/profiles/profile_manager.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" | 31 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" |
32 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 32 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
33 #include "chrome/browser/profiles/profile_destroyer.h" | 33 #include "chrome/browser/profiles/profile_destroyer.h" |
34 #include "chrome/browser/profiles/profile_info_cache.h" | 34 #include "chrome/browser/profiles/profile_info_cache.h" |
35 #include "chrome/browser/profiles/profile_metrics.h" | 35 #include "chrome/browser/profiles/profile_metrics.h" |
36 #include "chrome/browser/profiles/profiles_state.h" | 36 #include "chrome/browser/profiles/profiles_state.h" |
37 #include "chrome/browser/profiles/startup_task_runner_service.h" | 37 #include "chrome/browser/profiles/startup_task_runner_service.h" |
38 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" | 38 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" |
39 #include "chrome/browser/signin/account_reconcilor_factory.h" | 39 #include "chrome/browser/signin/account_reconcilor_factory.h" |
40 #include "chrome/browser/signin/account_tracker_service_factory.h" | 40 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 41 #include "chrome/browser/signin/signin_manager_factory.h" |
41 #include "chrome/browser/sync/profile_sync_service.h" | 42 #include "chrome/browser/sync/profile_sync_service.h" |
42 #include "chrome/browser/sync/profile_sync_service_factory.h" | 43 #include "chrome/browser/sync/profile_sync_service_factory.h" |
43 #include "chrome/browser/ui/browser.h" | 44 #include "chrome/browser/ui/browser.h" |
44 #include "chrome/browser/ui/browser_iterator.h" | 45 #include "chrome/browser/ui/browser_iterator.h" |
45 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 46 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
46 #include "chrome/common/chrome_constants.h" | 47 #include "chrome/common/chrome_constants.h" |
47 #include "chrome/common/chrome_paths_internal.h" | 48 #include "chrome/common/chrome_paths_internal.h" |
48 #include "chrome/common/chrome_switches.h" | 49 #include "chrome/common/chrome_switches.h" |
49 #include "chrome/common/logging_chrome.h" | 50 #include "chrome/common/logging_chrome.h" |
50 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
51 #include "chrome/common/url_constants.h" | 52 #include "chrome/common/url_constants.h" |
52 #include "chrome/grit/generated_resources.h" | 53 #include "chrome/grit/generated_resources.h" |
53 #include "components/bookmarks/browser/bookmark_model.h" | 54 #include "components/bookmarks/browser/bookmark_model.h" |
54 #include "components/content_settings/core/browser/host_content_settings_map.h" | 55 #include "components/content_settings/core/browser/host_content_settings_map.h" |
55 #include "components/password_manager/core/browser/password_store.h" | 56 #include "components/password_manager/core/browser/password_store.h" |
| 57 #include "components/signin/core/browser/signin_manager.h" |
56 #include "components/signin/core/common/profile_management_switches.h" | 58 #include "components/signin/core/common/profile_management_switches.h" |
57 #include "content/public/browser/browser_thread.h" | 59 #include "content/public/browser/browser_thread.h" |
58 #include "content/public/browser/notification_service.h" | 60 #include "content/public/browser/notification_service.h" |
59 #include "content/public/browser/user_metrics.h" | 61 #include "content/public/browser/user_metrics.h" |
60 #include "net/http/http_transaction_factory.h" | 62 #include "net/http/http_transaction_factory.h" |
61 #include "net/url_request/url_request_context.h" | 63 #include "net/url_request/url_request_context.h" |
62 #include "net/url_request/url_request_context_getter.h" | 64 #include "net/url_request/url_request_context_getter.h" |
63 #include "net/url_request/url_request_job.h" | 65 #include "net/url_request/url_request_job.h" |
64 #include "ui/base/l10n/l10n_util.h" | 66 #include "ui/base/l10n/l10n_util.h" |
65 | 67 |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 void ProfileManager::AddProfileToCache(Profile* profile) { | 1177 void ProfileManager::AddProfileToCache(Profile* profile) { |
1176 if (profile->IsGuestSession()) | 1178 if (profile->IsGuestSession()) |
1177 return; | 1179 return; |
1178 ProfileInfoCache& cache = GetProfileInfoCache(); | 1180 ProfileInfoCache& cache = GetProfileInfoCache(); |
1179 if (profile->GetPath().DirName() != cache.GetUserDataDir()) | 1181 if (profile->GetPath().DirName() != cache.GetUserDataDir()) |
1180 return; | 1182 return; |
1181 | 1183 |
1182 if (cache.GetIndexOfProfileWithPath(profile->GetPath()) != std::string::npos) | 1184 if (cache.GetIndexOfProfileWithPath(profile->GetPath()) != std::string::npos) |
1183 return; | 1185 return; |
1184 | 1186 |
1185 base::string16 username = base::UTF8ToUTF16(profile->GetPrefs()->GetString( | 1187 SigninManagerBase* signin_manager = |
1186 prefs::kGoogleServicesUsername)); | 1188 SigninManagerFactory::GetForProfile(profile); |
| 1189 base::string16 username = base::UTF8ToUTF16( |
| 1190 signin_manager->GetAuthenticatedUsername()); |
1187 | 1191 |
1188 // Profile name and avatar are set by InitProfileUserPrefs and stored in the | 1192 // Profile name and avatar are set by InitProfileUserPrefs and stored in the |
1189 // profile. Use those values to setup the cache entry. | 1193 // profile. Use those values to setup the cache entry. |
1190 base::string16 profile_name = | 1194 base::string16 profile_name = |
1191 base::UTF8ToUTF16(profile->GetPrefs()->GetString(prefs::kProfileName)); | 1195 base::UTF8ToUTF16(profile->GetPrefs()->GetString(prefs::kProfileName)); |
1192 | 1196 |
1193 size_t icon_index = profile->GetPrefs()->GetInteger( | 1197 size_t icon_index = profile->GetPrefs()->GetInteger( |
1194 prefs::kProfileAvatarIndex); | 1198 prefs::kProfileAvatarIndex); |
1195 | 1199 |
1196 std::string supervised_user_id = | 1200 std::string supervised_user_id = |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); | 1344 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); |
1341 FinishDeletingProfile(profile_to_delete_path); | 1345 FinishDeletingProfile(profile_to_delete_path); |
1342 } | 1346 } |
1343 } | 1347 } |
1344 } | 1348 } |
1345 #endif | 1349 #endif |
1346 | 1350 |
1347 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1351 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1348 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1352 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1349 } | 1353 } |
OLD | NEW |