Skip to content

Commit

Permalink
M66 merge: cros: Add user actions to KSV.
Browse files Browse the repository at this point in the history
This cl adds two user actions to Keyboard Shortcut Viewer (KSV):
1. The times user creates a new window of Keyboard Shortcut Viewer.
2. The times user enters search mode in Keyboard Shortcut Viewer.

[email protected],[email protected]

Bug: 768932
Test: can see the counts in chrome://user-actions.
Change-Id: Id04f20c755def88f6f360d3c66ac1417180d5a94
Reviewed-on: https://chromium-review.googlesource.com/938381
Reviewed-by: Ahmed Fakhry <[email protected]>
Reviewed-by: Steven Holte <[email protected]>
Commit-Queue: Tao Wu <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#540300}(cherry picked from commit fdbb173)
Reviewed-on: https://chromium-review.googlesource.com/953029
Reviewed-by: Tao Wu <[email protected]>
Cr-Commit-Position: refs/branch-heads/3359@{#62}
Cr-Branched-From: 66afc5e-refs/heads/master@{#540276}
  • Loading branch information
wutao committed Mar 7, 2018
1 parent 29c63f1 commit b253b2d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ash/components/shortcut_viewer/views/keyboard_shortcut_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "ash/public/cpp/shelf_item.h"
#include "ash/public/cpp/window_properties.h"
#include "base/i18n/string_search.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/base/default_style.h"
Expand Down Expand Up @@ -95,6 +97,9 @@ views::Widget* KeyboardShortcutView::Show(gfx::NativeWindow context) {
// it.
g_ksv_view->GetWidget()->Activate();
} else {
base::RecordAction(
base::UserMetricsAction("KeyboardShortcutViewer.CreateWindow"));

constexpr gfx::Size kKSVWindowSize(768, 512);
gfx::Rect window_bounds(kKSVWindowSize);
if (context) {
Expand Down Expand Up @@ -348,7 +353,10 @@ void KeyboardShortcutView::ActiveChanged(
sender->ShowBackOrGoogleIcon(is_active);
search_results_container_->SetVisible(is_active);
tabbed_pane_->SetVisible(!is_active);
if (!is_active) {
if (is_active) {
base::RecordAction(
base::UserMetricsAction("KeyboardShortcutViewer.Search"));
} else {
search_results_container_->RemoveAllChildViews(true);
RequestFocusForActiveTab();
}
Expand Down
14 changes: 14 additions & 0 deletions tools/metrics/actions/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8263,6 +8263,20 @@ 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="KeyboardShortcutViewer.CreateWindow">
<owner>[email protected]</owner>
<description>
Records when the user creates a new window of Keyboard Shortcut Viewer.
</description>
</action>

<action name="KeyboardShortcutViewer.Search">
<owner>[email protected]</owner>
<description>
Records when the user enters search mode in Keyboard Shortcut Viewer.
</description>
</action>

<action name="KeywordEditor_AddKeyword">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<description>Please enter the description of this user action.</description>
Expand Down

0 comments on commit b253b2d

Please sign in to comment.