Commit 8a512a25 authored by Charlene Yan's avatar Charlene Yan Committed by Commit Bot

[Tab Groups] Add user action metrics for when a group is renamed through

the editor bubble.

Bug: 1040657
Change-Id: I532ffcc9257e038292f7a3d2d33ae31a50744558
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2028161Reviewed-by: default avatarConnie Wan <connily@chromium.org>
Reviewed-by: default avatarJesse Doherty <jwd@chromium.org>
Commit-Queue: Charlene Yan <cyan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737477}
parent f8f0b4e2
...@@ -80,8 +80,12 @@ TabGroupEditorBubbleView::TabGroupEditorBubbleView( ...@@ -80,8 +80,12 @@ TabGroupEditorBubbleView::TabGroupEditorBubbleView(
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE); DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
const auto* layout_provider = ChromeLayoutProvider::Get();
const base::string16 title = tab_controller_->GetGroupTitle(group_); const base::string16 title = tab_controller_->GetGroupTitle(group_);
title_at_opening_ = title;
DialogDelegate::set_close_callback(base::BindOnce(
&TabGroupEditorBubbleView::OnBubbleClose, base::Unretained(this)));
const auto* layout_provider = ChromeLayoutProvider::Get();
const int horizontal_spacing = layout_provider->GetDistanceMetric( const int horizontal_spacing = layout_provider->GetDistanceMetric(
views::DISTANCE_RELATED_CONTROL_HORIZONTAL); views::DISTANCE_RELATED_CONTROL_HORIZONTAL);
const int vertical_menu_spacing = layout_provider->GetDistanceMetric( const int vertical_menu_spacing = layout_provider->GetDistanceMetric(
...@@ -233,6 +237,13 @@ void TabGroupEditorBubbleView::UpdateGroup() { ...@@ -233,6 +237,13 @@ void TabGroupEditorBubbleView::UpdateGroup() {
tab_controller_->SetVisualDataForGroup(group_, new_data); tab_controller_->SetVisualDataForGroup(group_, new_data);
} }
void TabGroupEditorBubbleView::OnBubbleClose() {
if (title_at_opening_ != title_field_->GetText()) {
base::RecordAction(
base::UserMetricsAction("TabGroups_TabGroupBubble_NameChanged"));
}
}
void TabGroupEditorBubbleView::TitleFieldController::ContentsChanged( void TabGroupEditorBubbleView::TitleFieldController::ContentsChanged(
views::Textfield* sender, views::Textfield* sender,
const base::string16& new_contents) { const base::string16& new_contents) {
......
...@@ -55,6 +55,8 @@ class TabGroupEditorBubbleView : public views::BubbleDialogDelegateView { ...@@ -55,6 +55,8 @@ class TabGroupEditorBubbleView : public views::BubbleDialogDelegateView {
SkColor background_color() const { return color(); } SkColor background_color() const { return color(); }
void OnBubbleClose();
TabController* const tab_controller_; TabController* const tab_controller_;
const tab_groups::TabGroupId group_; const tab_groups::TabGroupId group_;
...@@ -102,6 +104,8 @@ class TabGroupEditorBubbleView : public views::BubbleDialogDelegateView { ...@@ -102,6 +104,8 @@ class TabGroupEditorBubbleView : public views::BubbleDialogDelegateView {
// Creates the set of tab group colors to display and returns the color that // Creates the set of tab group colors to display and returns the color that
// is initially selected. // is initially selected.
SkColor InitColorSet(); SkColor InitColorSet();
base::string16 title_at_opening_;
}; };
#endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_GROUP_EDITOR_BUBBLE_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_GROUP_EDITOR_BUBBLE_VIEW_H_
...@@ -22330,6 +22330,15 @@ should be able to be added at any place in this file. ...@@ -22330,6 +22330,15 @@ should be able to be added at any place in this file.
</description> </description>
</action> </action>
<action name="TabGroups_TabGroupBubble_NameChanged">
<owner>connily@chromium.org</owner>
<owner>cyan@chromium.org</owner>
<owner>chrome-desktop-ui-sea@google.com</owner>
<description>
User changed the name of a group through the editor bubble.
</description>
</action>
<action name="TabGroups_TabGroupBubble_NewTabInGroup"> <action name="TabGroups_TabGroupBubble_NewTabInGroup">
<owner>connily@chromium.org</owner> <owner>connily@chromium.org</owner>
<owner>cyan@chromium.org</owner> <owner>cyan@chromium.org</owner>
......
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