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/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_dialogs.h" | 17 #include "chrome/browser/ui/browser_dialogs.h" |
16 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
17 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
18 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/user_metrics.h" | 21 #include "content/public/browser/user_metrics.h" |
20 | 22 |
21 #if !defined(OS_IOS) | 23 #if !defined(OS_IOS) |
22 #include "chrome/browser/ui/browser_finder.h" | 24 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 desktop_type), | 215 desktop_type), |
214 base::string16(), | 216 base::string16(), |
215 base::string16(), | 217 base::string16(), |
216 std::string()); | 218 std::string()); |
217 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_GUEST); | 219 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_GUEST); |
218 } | 220 } |
219 | 221 |
220 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, | 222 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, |
221 ProfileSwitchingDoneCallback callback, | 223 ProfileSwitchingDoneCallback callback, |
222 ProfileMetrics::ProfileAdd metric) { | 224 ProfileMetrics::ProfileAdd metric) { |
| 225 ProfileInfoCache& cache = |
| 226 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 227 |
| 228 int placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex(); |
223 ProfileManager::CreateMultiProfileAsync( | 229 ProfileManager::CreateMultiProfileAsync( |
224 base::string16(), | 230 cache.ChooseNameForNewProfile(placeholder_avatar_index), |
225 base::string16(), | 231 base::UTF8ToUTF16(profiles::GetDefaultAvatarIconUrl( |
| 232 placeholder_avatar_index)), |
226 base::Bind(&OpenBrowserWindowForProfile, | 233 base::Bind(&OpenBrowserWindowForProfile, |
227 callback, | 234 callback, |
228 true, | 235 true, |
229 true, | 236 true, |
230 desktop_type), | 237 desktop_type), |
231 std::string()); | 238 std::string()); |
232 ProfileMetrics::LogProfileAddNewUser(metric); | 239 ProfileMetrics::LogProfileAddNewUser(metric); |
233 } | 240 } |
234 | 241 |
235 void CloseGuestProfileWindows() { | 242 void CloseGuestProfileWindows() { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 292 |
286 if (tutorial_shown) { | 293 if (tutorial_shown) { |
287 chrome::ShowUserManager(profile->GetPath()); | 294 chrome::ShowUserManager(profile->GetPath()); |
288 } else { | 295 } else { |
289 chrome::ShowUserManagerWithTutorial( | 296 chrome::ShowUserManagerWithTutorial( |
290 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); | 297 profiles::USER_MANAGER_TUTORIAL_OVERVIEW); |
291 } | 298 } |
292 } | 299 } |
293 | 300 |
294 } // namespace profiles | 301 } // namespace profiles |
OLD | NEW |