Commit 57cd92bc authored by Charlene Yan's avatar Charlene Yan Committed by Commit Bot

[Tab Groups] Add user action metrics as defined in the metrics document.

This includes switching into a grouped tab and tab creation.

Bug: 1040657
Change-Id: I48aa185a8be5a383bb4253061b5860d1cd73b022
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1995955Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Reviewed-by: default avatarJesse Doherty <jwd@chromium.org>
Reviewed-by: default avatarConnie Wan <connily@chromium.org>
Commit-Queue: Charlene Yan <cyan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732579}
parent 8d583620
......@@ -4,6 +4,8 @@
#include "chrome/browser/ui/tabs/existing_tab_group_sub_menu_model.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "chrome/browser/ui/tabs/tab_group.h"
#include "chrome/browser/ui/tabs/tab_group_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
......@@ -123,6 +125,7 @@ void ExistingTabGroupSubMenuModel::ExecuteCommand(int command_id,
int event_flags) {
const int group_index = command_id - kFirstCommandIndex;
DCHECK_LT(size_t{group_index}, model_->group_model()->ListTabGroups().size());
base::RecordAction(base::UserMetricsAction("TabContextMenu_NewTabInGroup"));
model_->ExecuteAddToExistingGroupCommand(context_index_,
GetOrderedTabGroups()[group_index]);
}
......
......@@ -14,6 +14,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/feature_list.h"
#include "base/i18n/rtl.h"
#include "base/location.h"
#include "base/macros.h"
......@@ -2992,10 +2993,19 @@ void BrowserView::UpdateAcceleratorMetrics(const ui::Accelerator& accelerator,
if (command_id == IDC_HELP_PAGE_VIA_KEYBOARD && key_code == ui::VKEY_F1)
base::RecordAction(UserMetricsAction("ShowHelpTabViaF1"));
if (command_id == IDC_BOOKMARK_THIS_TAB)
if (command_id == IDC_BOOKMARK_THIS_TAB) {
UMA_HISTOGRAM_ENUMERATION("Bookmarks.EntryPoint",
BOOKMARK_ENTRY_POINT_ACCELERATOR,
BOOKMARK_ENTRY_POINT_LIMIT);
}
if (base::FeatureList::IsEnabled(features::kTabGroups) &&
command_id == IDC_NEW_TAB &&
browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP)) {
TabStripModel* const model = browser_->tab_strip_model();
const auto group_id = model->GetTabGroupForTab(model->active_index());
if (group_id.has_value())
base::RecordAction(base::UserMetricsAction("Accel_NewTabInGroup"));
}
#if defined(OS_CHROMEOS)
// Collect information about the relative popularity of various accelerators
......
......@@ -12,6 +12,8 @@
#include "base/containers/flat_map.h"
#include "base/containers/span.h"
#include "base/logging.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "base/no_destructor.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
......@@ -256,6 +258,8 @@ void TabGroupEditorBubbleView::ButtonListener::ButtonPressed(
const ui::Event& event) {
switch (sender->GetID()) {
case TAB_GROUP_HEADER_CXMENU_NEW_TAB_IN_GROUP:
base::RecordAction(
base::UserMetricsAction("TabGroups_TabGroupBubble_NewTabInGroup"));
tab_controller_->AddNewTabInGroup(group_);
break;
case TAB_GROUP_HEADER_CXMENU_UNGROUP:
......
......@@ -1513,12 +1513,16 @@ bool TabStrip::ShouldHideCloseButtonForTab(Tab* tab) const {
void TabStrip::SelectTab(Tab* tab, const ui::Event& event) {
int model_index = GetModelIndexOf(tab);
if (IsValidModelIndex(model_index)) {
if (tab->group().has_value())
base::RecordAction(base::UserMetricsAction("TabGroups_SwitchGroupedTab"));
// Report histogram metrics for the number of tab hover cards seen before
// a tab is selected by mouse press.
if (base::FeatureList::IsEnabled(features::kTabHoverCards) && hover_card_ &&
event.type() == ui::ET_MOUSE_PRESSED && !tab->IsActive()) {
hover_card_->RecordHoverCardsSeenRatioMetric();
}
controller_->SelectTab(model_index, event);
}
}
......
......@@ -819,6 +819,15 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description>
</action>
<action name="Accel_NewTabInGroup">
<owner>connily@chromium.org</owner>
<owner>cyan@chromium.org</owner>
<owner>chrome-desktop-ui-sea@google.com</owner>
<description>
User added a new tab to the existing group by keyboard shortcut Ctrl-T.
</description>
</action>
<action name="Accel_Next_Ime">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description>
......@@ -22091,6 +22100,16 @@ should be able to be added at any place in this file.
</description>
</action>
<action name="TabContextMenu_NewTabInGroup">
<owner>connily@chromium.org</owner>
<owner>cyan@chromium.org</owner>
<owner>chrome-desktop-ui-sea@google.com</owner>
<description>
User added a tab to an existing group by choosing 'Add to existing group'
from the tabstrip context menu.
</description>
</action>
<action name="TabContextMenu_OpenTabsLeftToRight">
<obsolete>Could not find traces of this used in code.</obsolete>
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
......@@ -22261,6 +22280,23 @@ should be able to be added at any place in this file.
</description>
</action>
<action name="TabGroups_SwitchGroupedTab">
<owner>connily@chromium.org</owner>
<owner>cyan@chromium.org</owner>
<owner>chrome-desktop-ui-sea@google.com</owner>
<description>User switched to a tab that belongs in a group.</description>
</action>
<action name="TabGroups_TabGroupBubble_NewTabInGroup">
<owner>connily@chromium.org</owner>
<owner>cyan@chromium.org</owner>
<owner>chrome-desktop-ui-sea@google.com</owner>
<description>
User added a new tab to an existing group by choosing 'New tab in group'
from the tab group editor bubble.
</description>
</action>
<action name="Tablet.WindowDrag.OpenedOverview">
<owner>minch@chromium.org</owner>
<description>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment