diff options
author | jochen <jochen@chromium.org> | 2015-11-09 13:32:01 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-09 21:33:07 +0000 |
commit | 6a829bc9cff3097089e1e0c05538aeabaf881caf (patch) | |
tree | e75b53793e7f3610d8cda0a6d3cfc59db688170e | |
parent | cc2f340f060472f8598079eef75c35c60c04ef1f (diff) | |
download | chromium_src-6a829bc9cff3097089e1e0c05538aeabaf881caf.zip chromium_src-6a829bc9cff3097089e1e0c05538aeabaf881caf.tar.gz chromium_src-6a829bc9cff3097089e1e0c05538aeabaf881caf.tar.bz2 |
Report what kind of profiles are opened via "Open link as User"
BUG=552051
R=asvitkine@chromium.org
Review URL: https://codereview.chromium.org/1412423012
Cr-Commit-Position: refs/heads/master@{#358659}
3 files changed, 44 insertions, 0 deletions
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index 2b16ce3..b5a5755 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc @@ -159,6 +159,14 @@ using extensions::MenuManager; namespace { +// State of the profile that is activated via "Open Link as User". +enum UmaEnumOpenLinkAsUser { + OPEN_LINK_AS_USER_ACTIVE_PROFILE_ENUM_ID, + OPEN_LINK_AS_USER_INACTIVE_PROFILE_MULTI_PROFILE_SESSION_ENUM_ID, + OPEN_LINK_AS_USER_INACTIVE_PROFILE_SINGLE_PROFILE_SESSION_ENUM_ID, + OPEN_LINK_AS_USER_LAST_ENUM_ID, +}; + // Whether to return the general enum_id or context_specific_enum_id // in the FindUMAEnumValueForCommand lookup function. enum UmaEnumIdLookupType { @@ -465,6 +473,7 @@ RenderViewContextMenu::RenderViewContextMenu( &menu_model_, base::Bind(MenuItemMatchesParams, params_)), profile_link_submenu_model_(this), + multiple_profiles_open_(false), protocol_handler_submenu_model_(this), protocol_handler_registry_( ProtocolHandlerRegistryFactory::GetForBrowserContext(GetProfile())), @@ -879,6 +888,9 @@ void RenderViewContextMenu::AppendLinkItems() { ProfileManager* profile_manager = g_browser_process->profile_manager(); const ProfileInfoCache& profile_info_cache = profile_manager->GetProfileInfoCache(); + chrome::HostDesktopType desktop_type = + chrome::GetHostDesktopTypeForNativeView( + source_web_contents_->GetNativeView()); // Find all regular profiles other than the current one which have at // least one open window. @@ -893,6 +905,8 @@ void RenderViewContextMenu::AppendLinkItems() { !profile_info_cache.IsOmittedProfileAtIndex(profile_index) && !profile_info_cache.ProfileIsSigninRequiredAtIndex(profile_index)) { target_profiles.push_back(profile_index); + if (chrome::FindLastActiveWithProfile(profile, desktop_type)) + multiple_profiles_open_ = true; } } @@ -1631,6 +1645,20 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { chrome::GetHostDesktopTypeForNativeView( source_web_contents_->GetNativeView()); + Profile* profile = profile_manager->GetProfileByPath(profile_path); + UmaEnumOpenLinkAsUser profile_state; + if (chrome::FindLastActiveWithProfile(profile, desktop_type)) { + profile_state = OPEN_LINK_AS_USER_ACTIVE_PROFILE_ENUM_ID; + } else if (multiple_profiles_open_) { + profile_state = + OPEN_LINK_AS_USER_INACTIVE_PROFILE_MULTI_PROFILE_SESSION_ENUM_ID; + } else { + profile_state = + OPEN_LINK_AS_USER_INACTIVE_PROFILE_SINGLE_PROFILE_SESSION_ENUM_ID; + } + UMA_HISTOGRAM_ENUMERATION("RenderViewContextMenu.OpenLinkAsUser", + profile_state, OPEN_LINK_AS_USER_LAST_ENUM_ID); + profiles::SwitchToProfile( profile_path, desktop_type, false, base::Bind(OnProfileCreated, desktop_type, params_.link_url, diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.h b/chrome/browser/renderer_context_menu/render_view_context_menu.h index 8312397..89669ff 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.h +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.h @@ -169,6 +169,7 @@ class RenderViewContextMenu : public RenderViewContextMenuBase { GURL selection_navigation_url_; ui::SimpleMenuModel profile_link_submenu_model_; + bool multiple_profiles_open_; ui::SimpleMenuModel protocol_handler_submenu_model_; ProtocolHandlerRegistry* protocol_handler_registry_; diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 9e8272d..f65d038 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -37962,6 +37962,15 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. </summary> </histogram> +<histogram name="RenderViewContextMenu.OpenLinkAsUser" enum="OpenLinkAsUser"> + <owner>jochen@chromium.org</owner> + <summary> + State of the profile that is activated via the "Open Link as User" + menu. Logged when one of the "Open Link as User" context menu + options is selected. + </summary> +</histogram> + <histogram name="RenderViewContextMenu.Shown" enum="RenderViewContextMenuItem"> <owner>vitalybuka@chromium.org</owner> <summary>Count of renderer view context menu items shown.</summary> @@ -68454,6 +68463,12 @@ To add a new entry, add it with any value and run test to compute valid value. <int value="3" label="Failed to create directory."/> </enum> +<enum name="OpenLinkAsUser" type="int"> + <int value="0" label="Active profile."/> + <int value="1" label="Inactive, multi-profile."/> + <int value="2" label="Inactive, single-profile."/> +</enum> + <enum name="OSAgnosticErrno" type="int"> <summary>Errno values with the same meanings on Mac/Win/Linux.</summary> <int value="0" label="0">No error</int> |