Skip to content

Commit

Permalink
shortcuts: Add Shortcuts app to the Local Search Service index enums …
Browse files Browse the repository at this point in the history
…and metrics

This CL follows the implementation patterns set by the Help app
and Personalization app. This CL https://crrev.com/c/2280766 in
particular has served as a guide.

Essentially, this CL registers the Shortcuts app with the Local Search
Service (LSS) and creates a new IndexId. This IndexId will be used
by the Shortcuts app to populate the LSS index with data and then query
it for data.

See the design docs in the linked bugs for additional context.

Note that our search implementation will be behind a flag.

Bug: b:266085562
Change-Id: I5a1f971a7d730656c68152326082d88b8617d0f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4245503
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Reviewed-by: Jimmy Gong <jimmyxgong@chromium.org>
Commit-Queue: Camden Bickel <cambickel@google.com>
Reviewed-by: Tony Yeoman <tby@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1106025}
  • Loading branch information
Cam Bickel authored and Chromium LUCI CQ committed Feb 16, 2023
1 parent 870b2bd commit 1f0402f
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions chromeos/ash/components/local_search_service/index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ std::string IndexIdBasedHistogramPrefix(IndexId index_id) {
return prefix + "HelpAppLauncher";
case IndexId::kPersonalization:
return prefix + "Personalization";
case IndexId::kShortcutsApp:
return prefix + "ShortcutsApp";
}
}

Expand Down
2 changes: 2 additions & 0 deletions chromeos/ash/components/local_search_service/pref_names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ const char kLocalSearchServiceMetricsHelpAppLauncherCount[] =
"local_search_service.metrics.help_app_launcher_count";
const char kLocalSearchServiceMetricsPersonalizationCount[] =
"local_search_service.metrics.personalization_count";
const char kLocalSearchServiceMetricsShortcutsAppCount[] =
"local_search_service.metrics.shortcuts_app_count";

} // namespace ash::local_search_service::prefs
1 change: 1 addition & 0 deletions chromeos/ash/components/local_search_service/pref_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extern const char kLocalSearchServiceMetricsCrosSettingsCount[];
extern const char kLocalSearchServiceMetricsHelpAppCount[];
extern const char kLocalSearchServiceMetricsHelpAppLauncherCount[];
extern const char kLocalSearchServiceMetricsPersonalizationCount[];
extern const char kLocalSearchServiceMetricsShortcutsAppCount[];
// TODO(thanhdng): clean this up after LSS is sandboxed.
extern const char kLocalSearchServiceSyncMetricsCrosSettingsCount[];
extern const char kLocalSearchServiceSyncMetricsHelpAppCount[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ enum IndexId {
kCrosSettings = 0,
kHelpApp = 1,
kHelpAppLauncher = 2,
kPersonalization = 3
kPersonalization = 3,
kShortcutsApp = 4
// Add new client IDs here.
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ EnumTraits<ash::local_search_service::mojom::IndexId,
return ash::local_search_service::mojom::IndexId::kHelpAppLauncher;
case ash::local_search_service::IndexId::kPersonalization:
return ash::local_search_service::mojom::IndexId::kPersonalization;
case ash::local_search_service::IndexId::kShortcutsApp:
return ash::local_search_service::mojom::IndexId::kShortcutsApp;
}
NOTREACHED();
return ash::local_search_service::mojom::IndexId::kCrosSettings;
Expand All @@ -45,6 +47,9 @@ bool EnumTraits<ash::local_search_service::mojom::IndexId,
case ash::local_search_service::mojom::IndexId::kPersonalization:
*output = ash::local_search_service::IndexId::kPersonalization;
return true;
case ash::local_search_service::mojom::IndexId::kShortcutsApp:
*output = ash::local_search_service::IndexId::kShortcutsApp;
return true;
}
NOTREACHED();
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ constexpr std::array<const char*, SearchMetricsReporter::kNumberIndexIds>
prefs::kLocalSearchServiceMetricsHelpAppCount,
prefs::kLocalSearchServiceMetricsHelpAppLauncherCount,
prefs::kLocalSearchServiceMetricsPersonalizationCount,
prefs::kLocalSearchServiceMetricsShortcutsAppCount,
};

// Histograms corresponding to IndexId values.
Expand All @@ -34,6 +35,7 @@ constexpr std::array<const char*, SearchMetricsReporter::kNumberIndexIds>
SearchMetricsReporter::kHelpAppName,
SearchMetricsReporter::kHelpAppLauncherName,
SearchMetricsReporter::kPersonalizationName,
SearchMetricsReporter::kShortcutsAppName,
};

} // namespace
Expand All @@ -48,6 +50,8 @@ const char SearchMetricsReporter::kHelpAppLauncherName[] =
"LocalSearchService.HelpAppLauncher.DailySearch";
const char SearchMetricsReporter::kPersonalizationName[] =
"LocalSearchService.Personalization.DailySearch";
const char SearchMetricsReporter::kShortcutsAppName[] =
"LocalSearchService.ShortcutsApp.DailySearch";

constexpr int SearchMetricsReporter::kNumberIndexIds;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class SearchMetricsReporter : public mojom::SearchMetricsReporter {
static const char kHelpAppName[];
static const char kHelpAppLauncherName[];
static const char kPersonalizationName[];
static const char kShortcutsAppName[];

// Registers prefs used by SearchMetricsReporter in |registry|.
static void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ enum class IndexId {
kHelpApp = 1,
kHelpAppLauncher = 2,
kPersonalization = 3,
kMaxValue = kPersonalization,
kShortcutsApp = 4,
kMaxValue = kShortcutsApp,
};

// These values are persisted to logs. Entries should not be renumbered and
Expand Down
1 change: 1 addition & 0 deletions tools/metrics/histograms/metadata/local/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ chromium-metrics-reviews@google.com.
<variant name="HelpApp." summary="Help App"/>
<variant name="HelpAppLauncher." summary="Help App Launcher"/>
<variant name="Personalization." summary="Personalization App"/>
<variant name="ShortcutsApp." summary="Shortcuts App"/>
</variants>

<variants name="LocalStorageSizes">
Expand Down

0 comments on commit 1f0402f

Please sign in to comment.