diff options
author | tengs@chromium.org <tengs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-02 19:41:43 +0000 |
---|---|---|
committer | tengs@chromium.org <tengs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-02 19:41:43 +0000 |
commit | 377958792b16099c8087c2acc254f41bfacadcfc (patch) | |
tree | 5b1c34a0cbaefc6fae5d2696630f3f94567c9c29 | |
parent | 164e7a7f81a837e83900c465d00c2a8f9c33ee37 (diff) | |
download | chromium_src-377958792b16099c8087c2acc254f41bfacadcfc.zip chromium_src-377958792b16099c8087c2acc254f41bfacadcfc.tar.gz chromium_src-377958792b16099c8087c2acc254f41bfacadcfc.tar.bz2 |
Log UMA metrics for multiprofile actions.
BUG=297184
Review URL: https://codereview.chromium.org/25098009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226527 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 3 | ||||
-rw-r--r-- | ash/ash.gyp | 2 | ||||
-rw-r--r-- | ash/multi_profile_uma.cc | 25 | ||||
-rw-r--r-- | ash/multi_profile_uma.h | 43 | ||||
-rw-r--r-- | ash/system/user/tray_user.cc | 4 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/user_manager_impl.cc | 12 | ||||
-rw-r--r-- | chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc | 3 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 35 |
8 files changed, 124 insertions, 3 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 89aed5b..06a00c2 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -24,6 +24,7 @@ #include "ash/launcher/launcher_model.h" #include "ash/magnifier/magnification_controller.h" #include "ash/magnifier/partial_magnification_controller.h" +#include "ash/multi_profile_uma.h" #include "ash/root_window_controller.h" #include "ash/rotator/screen_rotation.h" #include "ash/screenshot_delegate.h" @@ -197,6 +198,8 @@ bool SwitchToNextUser() { ash::Shell::GetInstance()->session_state_delegate(); if (delegate->NumberOfLoggedInUsers() <= 1) return false; + MultiProfileUMA::RecordSwitchActiveUser( + MultiProfileUMA::SWITCH_ACTIVE_USER_BY_ACCELERATOR); delegate->SwitchActiveUserToNext(); return true; } diff --git a/ash/ash.gyp b/ash/ash.gyp index 1d677f5..13ea12f 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -167,6 +167,8 @@ 'magnifier/magnifier_constants.h', 'magnifier/partial_magnification_controller.cc', 'magnifier/partial_magnification_controller.h', + 'multi_profile_uma.cc', + 'multi_profile_uma.h', 'popup_message.cc', 'popup_message.h', 'root_window_controller.cc', diff --git a/ash/multi_profile_uma.cc b/ash/multi_profile_uma.cc new file mode 100644 index 0000000..b6383e4 --- /dev/null +++ b/ash/multi_profile_uma.cc @@ -0,0 +1,25 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/multi_profile_uma.h" + +#include "base/metrics/histogram.h" + +namespace ash { + +// static +void MultiProfileUMA::RecordSwitchActiveUser(SwitchActiveUserAction action) { + UMA_HISTOGRAM_ENUMERATION("MultiProfile.SwitchActiveUserUIPath", + action, + NUM_SWITCH_ACTIVE_USER_ACTIONS); +} + +// static +void MultiProfileUMA::RecordSigninUser(SigninUserAction action) { + UMA_HISTOGRAM_ENUMERATION("MultiProfile.SigninUserUIPath", + action, + NUM_SIGNIN_USER_ACTIONS); +} + +} // namespace ash diff --git a/ash/multi_profile_uma.h b/ash/multi_profile_uma.h new file mode 100644 index 0000000..ead66e8 --- /dev/null +++ b/ash/multi_profile_uma.h @@ -0,0 +1,43 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_MULTI_PROFILE_UMA_H_ +#define ASH_MULTI_PROFILE_UMA_H_ + +#include "ash/ash_export.h" +#include "base/basictypes.h" + +namespace ash { + +// Records UMA statistics for multiprofile actions. +// Note: There is also an action to switch profile windows from the +// browser frame that is recorded by the "Profile.OpenMethod" metric. +class ASH_EXPORT MultiProfileUMA { + public: + // Keep these enums up to date with tools/metrics/histograms/histograms.xml. + enum SwitchActiveUserAction { + SWITCH_ACTIVE_USER_BY_TRAY = 0, + SWITCH_ACTIVE_USER_BY_ACCELERATOR, + NUM_SWITCH_ACTIVE_USER_ACTIONS + }; + + enum SigninUserAction { + SIGNIN_USER_BY_TRAY = 0, + SIGNIN_USER_BY_BROWSER_FRAME, + NUM_SIGNIN_USER_ACTIONS + }; + + // Record switching the active user and what UI path was taken. + static void RecordSwitchActiveUser(SwitchActiveUserAction action); + + // Record signing in a new user and what UI path was taken. + static void RecordSigninUser(SigninUserAction action); + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(MultiProfileUMA); +}; + +} // namespace ash + +#endif // ASH_MULTI_PROFILE_UMA_H_ diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index e832727..c11890a 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc @@ -9,6 +9,7 @@ #include <vector> #include "ash/ash_switches.h" +#include "ash/multi_profile_uma.h" #include "ash/popup_message.h" #include "ash/root_window_controller.h" #include "ash/session_state_delegate.h" @@ -750,6 +751,8 @@ void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { } else { ash::SessionStateDelegate* delegate = ash::Shell::GetInstance()->session_state_delegate(); + MultiProfileUMA::RecordSwitchActiveUser( + MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY); delegate->SwitchActiveUser(delegate->GetUserEmail(multiprofile_index_)); // Since the user list is about to change the system menu should get // closed. @@ -758,6 +761,7 @@ void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { } else if (add_menu_option_.get() && sender == add_menu_option_->GetContentsView()) { // Let the user add another account to the session. + MultiProfileUMA::RecordSigninUser(MultiProfileUMA::SIGNIN_USER_BY_TRAY); ash::Shell::GetInstance()->system_tray_delegate()->ShowUserLogin(); } else { NOTREACHED(); diff --git a/chrome/browser/chromeos/login/user_manager_impl.cc b/chrome/browser/chromeos/login/user_manager_impl.cc index 702009a..c705639 100644 --- a/chrome/browser/chromeos/login/user_manager_impl.cc +++ b/chrome/browser/chromeos/login/user_manager_impl.cc @@ -405,14 +405,20 @@ void UserManagerImpl::UserLoggedIn(const std::string& email, logged_in_users_.insert(logged_in_users_.begin(), active_user_); SetLRUUser(active_user_); - if (!primary_user_) + if (!primary_user_) { primary_user_ = active_user_; + if (primary_user_->GetType() == User::USER_TYPE_REGULAR) + SendRegularUserLoginMetrics(email); + } UMA_HISTOGRAM_ENUMERATION("UserManager.LoginUserType", active_user_->GetType(), User::NUM_USER_TYPES); - if (active_user_->GetType() == User::USER_TYPE_REGULAR) - SendRegularUserLoginMetrics(email); + if (IsMultipleProfilesAllowed()) { + UMA_HISTOGRAM_COUNTS_100("MultiProfile.UserCount", + GetLoggedInUsers().size()); + } + g_browser_process->local_state()->SetString(kLastLoggedInRegularUser, (active_user_->GetType() == User::USER_TYPE_REGULAR) ? email : ""); diff --git a/chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc b/chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc index fd27cd4..79e3cc6 100644 --- a/chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc +++ b/chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.cc @@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/profiles/avatar_menu_actions_chromeos.h" +#include "ash/multi_profile_uma.h" #include "ash/shell.h" #include "ash/system/tray/system_tray_delegate.h" #include "chrome/browser/chromeos/login/user_manager.h" @@ -25,6 +26,8 @@ AvatarMenuActionsChromeOS::~AvatarMenuActionsChromeOS() { void AvatarMenuActionsChromeOS::AddNewProfile(ProfileMetrics::ProfileAdd type) { // Let the user add another account to the session. + ash::MultiProfileUMA::RecordSigninUser( + ash::MultiProfileUMA::SIGNIN_USER_BY_BROWSER_FRAME); ash::Shell::GetInstance()->system_tray_delegate()->ShowUserLogin(); } diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index c8be1c1..5cff06a 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -6582,6 +6582,31 @@ other types of suffix sets. </summary> </histogram> +<histogram name="MultiProfile.SigninUserUIPath" + enum="MultiProfileSigninUserAction"> + <summary> + Count the number of times each UI path is taken for signing into a new + account in a ChromeOS multiprofile session. UI paths include the system tray + and the user account switcher on the browser frame. + </summary> +</histogram> + +<histogram name="MultiProfile.SwitchActiveUserUIPath" + enum="MultiProfileSwitchActiveUserAction"> + <summary> + Count the number of times each UI path is taken for switching the active + account in a ChromeOS multiprofile session. UI paths include the system tray + and the keyboard shortcut. + </summary> +</histogram> + +<histogram name="Multiprofile.UserCount"> + <summary> + The number of users simultaneously signed into a multiprofile session on + ChromeOS. This is recorded whenever a new user logs in. + </summary> +</histogram> + <histogram name="Navigation.MainFrameScheme" enum="NavigationScheme"> <summary>The scheme of the URL for each main-frame navigation.</summary> </histogram> @@ -24009,6 +24034,16 @@ other types of suffix sets. <int value="9" label="OPUS"/> </enum> +<enum name="MultiProfileSigninUserAction" type="int"> + <int value="0" label="System tray"/> + <int value="1" label="Browser frame"/> +</enum> + +<enum name="MultiProfileSwitchActiveUserAction" type="int"> + <int value="0" label="System tray"/> + <int value="1" label="Keyboard accelerator"/> +</enum> + <enum name="NavigationScheme" type="int"> <int value="0" label="(Unknown)"/> <int value="1" label="http"/> |