-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metrics for ChromeOS touch selection dragging and menu actions.
Record types of touch selection drags that occur and menu actions that are requested. This is for some new CrOS touch text editing features, see design doc: go/cros-touch-text-editing#heading=h.nmwbq0ix2t8q We would also like to log some metrics to count the actions that occur within a touch selection "session", will try to do in a followup. Bug: b:264824468 Change-Id: Id887c72876104b8dc17c7f89855d28d9c2fe5a32 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4775944 Reviewed-by: Darren Shen <shend@chromium.org> Reviewed-by: Mitsuru Oshima <oshima@chromium.org> Commit-Queue: Michelle Chen <michellegc@google.com> Reviewed-by: Robert Flack <flackr@chromium.org> Cr-Commit-Position: refs/heads/main@{#1184456}
- Loading branch information
Michelle
authored and
Chromium LUCI CQ
committed
Aug 16, 2023
1 parent
954c1a9
commit 58ac847
Showing
17 changed files
with
405 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ui/touch_selection/touch_selection_metrics.h" | ||
|
||
#include "base/metrics/histogram_functions.h" | ||
#include "ui/base/pointer/touch_editing_controller.h" | ||
|
||
namespace ui { | ||
|
||
namespace { | ||
|
||
TouchSelectionMenuAction MapCommandIdToMenuAction(int command_id) { | ||
switch (command_id) { | ||
case ui::TouchEditable::kCut: | ||
return TouchSelectionMenuAction::kCut; | ||
case ui::TouchEditable::kCopy: | ||
return TouchSelectionMenuAction::kCopy; | ||
case ui::TouchEditable::kPaste: | ||
return TouchSelectionMenuAction::kPaste; | ||
case ui::TouchEditable::kSelectAll: | ||
return TouchSelectionMenuAction::kSelectAll; | ||
case ui::TouchEditable::kSelectWord: | ||
return TouchSelectionMenuAction::kSelectWord; | ||
default: | ||
NOTREACHED_NORETURN() << "Invalid command id: " << command_id; | ||
} | ||
} | ||
|
||
} // namespace | ||
|
||
void RecordTouchSelectionDrag(TouchSelectionDragType drag_type) { | ||
base::UmaHistogramEnumeration(kTouchSelectionDragTypeHistogramName, | ||
drag_type); | ||
} | ||
|
||
void RecordTouchSelectionMenuCommandAction(int command_id) { | ||
base::UmaHistogramEnumeration(kTouchSelectionMenuActionHistogramName, | ||
MapCommandIdToMenuAction(command_id)); | ||
} | ||
|
||
void RecordTouchSelectionMenuEllipsisAction() { | ||
base::UmaHistogramEnumeration(kTouchSelectionMenuActionHistogramName, | ||
TouchSelectionMenuAction::kEllipsis); | ||
} | ||
|
||
void RecordTouchSelectionMenuSmartAction() { | ||
base::UmaHistogramEnumeration(kTouchSelectionMenuActionHistogramName, | ||
TouchSelectionMenuAction::kSmartAction); | ||
} | ||
|
||
} // namespace ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef UI_TOUCH_SELECTION_TOUCH_SELECTION_METRICS_H_ | ||
#define UI_TOUCH_SELECTION_TOUCH_SELECTION_METRICS_H_ | ||
|
||
#include "ui/touch_selection/ui_touch_selection_export.h" | ||
|
||
namespace ui { | ||
|
||
inline constexpr char kTouchSelectionDragTypeHistogramName[] = | ||
"InputMethod.TouchSelection.DragType"; | ||
|
||
inline constexpr char kTouchSelectionMenuActionHistogramName[] = | ||
"InputMethod.TouchSelection.MenuAction"; | ||
|
||
// These values are persisted to logs. Entries should not be renumbered and | ||
// numeric values should never be reused. | ||
enum class TouchSelectionDragType { | ||
kCursorHandleDrag = 0, | ||
kSelectionHandleDrag = 1, | ||
kCursorDrag = 2, | ||
kLongPressDrag = 3, | ||
kDoublePressDrag = 4, | ||
kMaxValue = kDoublePressDrag | ||
}; | ||
|
||
// These values are persisted to logs. Entries should not be renumbered and | ||
// numeric values should never be reused. | ||
enum class TouchSelectionMenuAction { | ||
kCut = 0, | ||
kCopy = 1, | ||
kPaste = 2, | ||
kSelectAll = 3, | ||
kSelectWord = 4, | ||
kEllipsis = 5, | ||
kSmartAction = 6, | ||
kMaxValue = kSmartAction | ||
}; | ||
|
||
UI_TOUCH_SELECTION_EXPORT void RecordTouchSelectionDrag( | ||
TouchSelectionDragType drag_type); | ||
|
||
UI_TOUCH_SELECTION_EXPORT void RecordTouchSelectionMenuCommandAction( | ||
int command_id); | ||
UI_TOUCH_SELECTION_EXPORT void RecordTouchSelectionMenuEllipsisAction(); | ||
UI_TOUCH_SELECTION_EXPORT void RecordTouchSelectionMenuSmartAction(); | ||
|
||
} // namespace ui | ||
|
||
#endif // UI_TOUCH_SELECTION_TOUCH_SELECTION_METRICS_H_ |
Oops, something went wrong.