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