Commit cbf4cfa9 authored by tby's avatar tby Committed by Commit Bot

[Hashed logging] Replace LaunchType with enum from the UMA proto.

The hashed logging launch recorder uses an enum to describe which UI
component a launch happened from. This is duplicated between
AppListLaunchRecorder and the new ChromeOSAppListLaunchEvent proto. This
CL deletes the enum in AppListLaunchRecorder and uses the one in
ChromeOSAppListLaunchEvent instead.

Bug: 951287
Change-Id: Ia156370360ae44d66c7ab22314374e71c4213dcf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1614639Reviewed-by: default avatarJia Meng <jiameng@chromium.org>
Reviewed-by: default avatarJenny Zhang <jennyz@chromium.org>
Commit-Queue: Tony Yeoman <tby@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660640}
parent 4b2dc4cb
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include "chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.h" #include "chrome/browser/ui/app_list/search/search_result_ranker/recurrence_ranker.h"
#include "chrome/browser/ui/app_list/search/search_result_ranker/search_result_ranker.h" #include "chrome/browser/ui/app_list/search/search_result_ranker/search_result_ranker.h"
#include "chrome/browser/ui/ash/tablet_mode_client.h" #include "chrome/browser/ui/ash/tablet_mode_client.h"
#include "third_party/metrics_proto/chrome_os_app_list_launch_event.pb.h"
using metrics::ChromeOSAppListLaunchEventProto;
namespace app_list { namespace app_list {
...@@ -163,12 +166,12 @@ SearchResultRanker* SearchController::GetNonAppSearchResultRanker() { ...@@ -163,12 +166,12 @@ SearchResultRanker* SearchController::GetNonAppSearchResultRanker() {
void SearchController::Train(const std::string& id, RankingItemType type) { void SearchController::Train(const std::string& id, RankingItemType type) {
if (app_list_features::IsAppListLaunchRecordingEnabled()) { if (app_list_features::IsAppListLaunchRecordingEnabled()) {
AppListLaunchRecorder::LaunchType launch_type; ChromeOSAppListLaunchEventProto::LaunchType launch_type;
if (type == RankingItemType::kApp || if (type == RankingItemType::kApp ||
type == RankingItemType::kArcAppShortcut) { type == RankingItemType::kArcAppShortcut) {
launch_type = AppListLaunchRecorder::APP_TILES; launch_type = ChromeOSAppListLaunchEventProto::APP_TILES;
} else { } else {
launch_type = AppListLaunchRecorder::RESULTS_LIST; launch_type = ChromeOSAppListLaunchEventProto::RESULTS_LIST;
} }
// TODO(951287): Record the last-used domain and app. // TODO(951287): Record the last-used domain and app.
......
...@@ -11,7 +11,7 @@ namespace app_list { ...@@ -11,7 +11,7 @@ namespace app_list {
using LaunchInfo = AppListLaunchRecorder::LaunchInfo; using LaunchInfo = AppListLaunchRecorder::LaunchInfo;
AppListLaunchRecorder::LaunchInfo::LaunchInfo( AppListLaunchRecorder::LaunchInfo::LaunchInfo(
AppListLaunchRecorder::LaunchType launch_type, metrics::ChromeOSAppListLaunchEventProto::LaunchType launch_type,
const std::string& target, const std::string& target,
const std::string& query, const std::string& query,
const std::string& domain, const std::string& domain,
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/sequence_checker.h" #include "base/sequence_checker.h"
#include "third_party/metrics_proto/chrome_os_app_list_launch_event.pb.h"
namespace app_list { namespace app_list {
...@@ -25,14 +26,10 @@ class SearchController; ...@@ -25,14 +26,10 @@ class SearchController;
// This should only be called from the browser UI thread. // This should only be called from the browser UI thread.
class AppListLaunchRecorder { class AppListLaunchRecorder {
public: public:
// TODO(951287): Replace this with the relevant enum from the proto to be
// added to ChromeUserMetricsExtension.
enum LaunchType { APP_TILES, RESULTS_LIST };
// Stores information about a single launch event to be logged by a call to // Stores information about a single launch event to be logged by a call to
// Record. // Record.
struct LaunchInfo { struct LaunchInfo {
LaunchInfo(LaunchType launch_type, LaunchInfo(metrics::ChromeOSAppListLaunchEventProto::LaunchType launch_type,
const std::string& target, const std::string& target,
const std::string& query, const std::string& query,
const std::string& domain, const std::string& domain,
...@@ -40,7 +37,8 @@ class AppListLaunchRecorder { ...@@ -40,7 +37,8 @@ class AppListLaunchRecorder {
LaunchInfo(const LaunchInfo& other); LaunchInfo(const LaunchInfo& other);
~LaunchInfo(); ~LaunchInfo();
LaunchType launch_type; // Specifies which UI component this event was launched from.
metrics::ChromeOSAppListLaunchEventProto::LaunchType launch_type;
// A string identifier of the item being launched, eg. an app ID or // A string identifier of the item being launched, eg. an app ID or
// filepath. // filepath.
std::string target; std::string target;
......
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