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

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: 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 bool already_opened =
274 g_browser_process->profile_manager()->GetProfileByPath(path) != NULL;
Mike Lerman 2015/01/21 20:58:03 Once a profile has been opened by the ProfileManag
anthonyvd 2015/01/23 16:01:31 Done.
275 ProfileMetrics::LogProfileSwitch(metric, already_opened);
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 base::FilePath path = ProfileManager::GetGuestProfilePath();
Mike Lerman 2015/01/21 20:58:03 const base::FilePath&
anthonyvd 2015/01/23 16:01:31 Done.
291 bool already_opened =
292 g_browser_process->profile_manager()->GetProfileByPath(path) != NULL;
Mike Lerman 2015/01/21 20:58:03 (Same as above)
anthonyvd 2015/01/23 16:01:31 Done.
293
294 ProfileMetrics::LogProfileSwitch(ProfileMetrics::SWITCH_PROFILE_GUEST,
295 already_opened);
288 g_browser_process->profile_manager()->CreateProfileAsync( 296 g_browser_process->profile_manager()->CreateProfileAsync(
289 ProfileManager::GetGuestProfilePath(), 297 path,
290 base::Bind(&OpenBrowserWindowForProfile, 298 base::Bind(&OpenBrowserWindowForProfile,
291 callback, 299 callback,
292 false, 300 false,
293 false, 301 false,
294 desktop_type), 302 desktop_type),
295 base::string16(), 303 base::string16(),
296 base::string16(), 304 base::string16(),
297 std::string()); 305 std::string());
298 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_GUEST);
299 } 306 }
300 307
301 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type, 308 void CreateAndSwitchToNewProfile(chrome::HostDesktopType desktop_type,
302 ProfileManager::CreateCallback callback, 309 ProfileManager::CreateCallback callback,
303 ProfileMetrics::ProfileAdd metric) { 310 ProfileMetrics::ProfileAdd metric) {
304 ProfileInfoCache& cache = 311 ProfileInfoCache& cache =
305 g_browser_process->profile_manager()->GetProfileInfoCache(); 312 g_browser_process->profile_manager()->GetProfileInfoCache();
306 313
307 int placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex(); 314 int placeholder_avatar_index = profiles::GetPlaceholderAvatarIndex();
308 ProfileManager::CreateMultiProfileAsync( 315 ProfileManager::CreateMultiProfileAsync(
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: 506 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR:
500 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; 507 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER;
501 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; 508 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR;
502 return; 509 return;
503 default: 510 default:
504 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; 511 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER;
505 } 512 }
506 } 513 }
507 514
508 } // namespace profiles 515 } // namespace profiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698