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" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(), | 267 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(), |
268 process_startup, is_first_run, &return_code); | 268 process_startup, is_first_run, &return_code); |
269 #endif // defined(OS_IOS) | 269 #endif // defined(OS_IOS) |
270 } | 270 } |
271 | 271 |
272 void SwitchToProfile(const base::FilePath& path, | 272 void SwitchToProfile(const base::FilePath& path, |
273 chrome::HostDesktopType desktop_type, | 273 chrome::HostDesktopType desktop_type, |
274 bool always_create, | 274 bool always_create, |
275 ProfileManager::CreateCallback callback, | 275 ProfileManager::CreateCallback callback, |
276 ProfileMetrics::ProfileOpen metric) { | 276 ProfileMetrics::ProfileOpen metric) { |
| 277 ProfileMetrics::LogProfileSwitch(metric, |
| 278 g_browser_process->profile_manager(), |
| 279 path); |
277 g_browser_process->profile_manager()->CreateProfileAsync( | 280 g_browser_process->profile_manager()->CreateProfileAsync( |
278 path, | 281 path, |
279 base::Bind(&OpenBrowserWindowForProfile, | 282 base::Bind(&OpenBrowserWindowForProfile, |
280 callback, | 283 callback, |
281 always_create, | 284 always_create, |
282 false, | 285 false, |
283 desktop_type), | 286 desktop_type), |
284 base::string16(), | 287 base::string16(), |
285 base::string16(), | 288 base::string16(), |
286 std::string()); | 289 std::string()); |
287 ProfileMetrics::LogProfileSwitchUser(metric); | |
288 } | 290 } |
289 | 291 |
290 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type, | 292 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type, |
291 ProfileManager::CreateCallback callback) { | 293 ProfileManager::CreateCallback callback) { |
| 294 const base::FilePath& path = ProfileManager::GetGuestProfilePath(); |
| 295 ProfileMetrics::LogProfileSwitch(ProfileMetrics::SWITCH_PROFILE_GUEST, |
| 296 g_browser_process->profile_manager(), |
| 297 path); |
292 g_browser_process->profile_manager()->CreateProfileAsync( | 298 g_browser_process->profile_manager()->CreateProfileAsync( |
293 ProfileManager::GetGuestProfilePath(), | 299 path, |
294 base::Bind(&OpenBrowserWindowForProfile, | 300 base::Bind(&OpenBrowserWindowForProfile, |
295 callback, | 301 callback, |
296 false, | 302 false, |
297 false, | 303 false, |
298 desktop_type), | 304 desktop_type), |
299 base::string16(), | 305 base::string16(), |
300 base::string16(), | 306 base::string16(), |
301 std::string()); | 307 std::string()); |
302 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_GUEST); | |
303 } | 308 } |
304 | 309 |
305 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, | 310 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, |
306 ProfileManager::CreateCallback callback, | 311 ProfileManager::CreateCallback callback, |
307 ProfileMetrics::ProfileAdd metric) { | 312 ProfileMetrics::ProfileAdd metric) { |
308 ProfileInfoCache& cache = | 313 ProfileInfoCache& cache = |
309 g_browser_process->profile_manager()->GetProfileInfoCache(); | 314 g_browser_process->profile_manager()->GetProfileInfoCache(); |
310 | 315 |
311 int placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex(); | 316 int placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex(); |
312 ProfileManager::CreateMultiProfileAsync( | 317 ProfileManager::CreateMultiProfileAsync( |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: | 508 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: |
504 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 509 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
505 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; | 510 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; |
506 return; | 511 return; |
507 default: | 512 default: |
508 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 513 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
509 } | 514 } |
510 } | 515 } |
511 | 516 |
512 } // namespace profiles | 517 } // namespace profiles |
OLD | NEW |