OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_window.h" | 5 #include "chrome/browser/profiles/profile_window.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/about_flags.h" | 12 #include "chrome/browser/about_flags.h" |
12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/pref_service_flags_storage.h" | 14 #include "chrome/browser/pref_service_flags_storage.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_dialogs.h" | 19 #include "chrome/browser/ui/browser_dialogs.h" |
18 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
20 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
21 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/user_metrics.h" | 24 #include "content/public/browser/user_metrics.h" |
23 | 25 |
24 #if !defined(OS_IOS) | 26 #if !defined(OS_IOS) |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 desktop_type), | 218 desktop_type), |
217 base::string16(), | 219 base::string16(), |
218 base::string16(), | 220 base::string16(), |
219 std::string()); | 221 std::string()); |
220 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_GUEST); | 222 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_GUEST); |
221 } | 223 } |
222 | 224 |
223 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, | 225 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, |
224 ProfileSwitchingDoneCallback callback, | 226 ProfileSwitchingDoneCallback callback, |
225 ProfileMetrics::ProfileAdd metric) { | 227 ProfileMetrics::ProfileAdd metric) { |
| 228 ProfileInfoCache& cache = |
| 229 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 230 |
| 231 int placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex(); |
226 ProfileManager::CreateMultiProfileAsync( | 232 ProfileManager::CreateMultiProfileAsync( |
227 base::string16(), | 233 cache.ChooseNameForNewProfile(placeholder_avatar_index), |
228 base::string16(), | 234 base::UTF8ToUTF16(profiles::GetDefaultAvatarIconUrl( |
| 235 placeholder_avatar_index)), |
229 base::Bind(&OpenBrowserWindowForProfile, | 236 base::Bind(&OpenBrowserWindowForProfile, |
230 callback, | 237 callback, |
231 true, | 238 true, |
232 true, | 239 true, |
233 desktop_type), | 240 desktop_type), |
234 std::string()); | 241 std::string()); |
235 ProfileMetrics::LogProfileAddNewUser(metric); | 242 ProfileMetrics::LogProfileAddNewUser(metric); |
236 } | 243 } |
237 | 244 |
238 void CloseGuestProfileWindows() { | 245 void CloseGuestProfileWindows() { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 &flags_storage, | 310 &flags_storage, |
304 kNewProfileManagementExperimentInternalName, | 311 kNewProfileManagementExperimentInternalName, |
305 true); | 312 true); |
306 | 313 |
307 CommandLine::ForCurrentProcess()->AppendSwitch( | 314 CommandLine::ForCurrentProcess()->AppendSwitch( |
308 switches::kNewProfileManagement); | 315 switches::kNewProfileManagement); |
309 chrome::ShowUserManagerWithTutorial(profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 316 chrome::ShowUserManagerWithTutorial(profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
310 } | 317 } |
311 | 318 |
312 } // namespace profiles | 319 } // namespace profiles |
OLD | NEW |