Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(993)

Side by Side Diff: chrome/browser/profiles/profile_window.cc

Issue 844193005: Add UMA metrics for profile switching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use existing histogram and fix issues raised by mlerman@ Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(), 263 browser_creator.LaunchBrowser(command_line, profile, base::FilePath(),
264 process_startup, is_first_run, &return_code); 264 process_startup, is_first_run, &return_code);
265 #endif // defined(OS_IOS) 265 #endif // defined(OS_IOS)
266 } 266 }
267 267
268 void SwitchToProfile(const base::FilePath& path, 268 void SwitchToProfile(const base::FilePath& path,
269 chrome::HostDesktopType desktop_type, 269 chrome::HostDesktopType desktop_type,
270 bool always_create, 270 bool always_create,
271 ProfileManager::CreateCallback callback, 271 ProfileManager::CreateCallback callback,
272 ProfileMetrics::ProfileOpen metric) { 272 ProfileMetrics::ProfileOpen metric) {
273 ProfileMetrics::LogProfileSwitch(metric,
274 g_browser_process->profile_manager(),
275 path);
273 g_browser_process->profile_manager()->CreateProfileAsync( 276 g_browser_process->profile_manager()->CreateProfileAsync(
274 path, 277 path,
275 base::Bind(&OpenBrowserWindowForProfile, 278 base::Bind(&OpenBrowserWindowForProfile,
276 callback, 279 callback,
277 always_create, 280 always_create,
278 false, 281 false,
279 desktop_type), 282 desktop_type),
280 base::string16(), 283 base::string16(),
281 base::string16(), 284 base::string16(),
282 std::string()); 285 std::string());
283 ProfileMetrics::LogProfileSwitchUser(metric);
284 } 286 }
285 287
286 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type, 288 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type,
287 ProfileManager::CreateCallback callback) { 289 ProfileManager::CreateCallback callback) {
290 const base::FilePath& path = ProfileManager::GetGuestProfilePath();
291 ProfileMetrics::LogProfileSwitch(ProfileMetrics::SWITCH_PROFILE_GUEST,
292 g_browser_process->profile_manager(),
293 path);
288 g_browser_process->profile_manager()->CreateProfileAsync( 294 g_browser_process->profile_manager()->CreateProfileAsync(
289 ProfileManager::GetGuestProfilePath(), 295 path,
290 base::Bind(&OpenBrowserWindowForProfile, 296 base::Bind(&OpenBrowserWindowForProfile,
291 callback, 297 callback,
292 false, 298 false,
293 false, 299 false,
294 desktop_type), 300 desktop_type),
295 base::string16(), 301 base::string16(),
296 base::string16(), 302 base::string16(),
297 std::string()); 303 std::string());
298 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_GUEST);
299 } 304 }
300 305
301 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, 306 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type,
302 ProfileManager::CreateCallback callback, 307 ProfileManager::CreateCallback callback,
303 ProfileMetrics::ProfileAdd metric) { 308 ProfileMetrics::ProfileAdd metric) {
304 ProfileInfoCache& cache = 309 ProfileInfoCache& cache =
305 g_browser_process->profile_manager()->GetProfileInfoCache(); 310 g_browser_process->profile_manager()->GetProfileInfoCache();
306 311
307 int placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex(); 312 int placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex();
308 ProfileManager::CreateMultiProfileAsync( 313 ProfileManager::CreateMultiProfileAsync(
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: 504 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR:
500 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; 505 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER;
501 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; 506 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR;
502 return; 507 return;
503 default: 508 default:
504 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; 509 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER;
505 } 510 }
506 } 511 }
507 512
508 } // namespace profiles 513 } // namespace profiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698