1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
ash / webui / personalization_app / search / search.mojom [blame]
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ash.personalization_app.mojom;
import "mojo/public/mojom/base/string16.mojom";
// Enum of available concepts to search for in personalization app. This is used
// in metrics, do not re-use any values. If any value is added, please update
// enums.xml PersonalizationSearchConceptId.
enum SearchConceptId {
kPersonalization = 0,
kChangeWallpaper = 100,
kTimeOfDayWallpaper = 101,
kChangeDeviceAccountImage = 200,
kAmbientMode = 300,
kAmbientModeChooseSource = 301,
kAmbientModeTurnOff = 302,
kAmbientModeGooglePhotos = 303,
kAmbientModeArtGallery = 304,
kAmbientModeTurnOn = 305,
kAmbientModeTimeOfDay = 306,
kDarkMode = 400,
kDarkModeSchedule = 401,
kDarkModeTurnOff = 402,
kDarkModeTurnOn = 403,
kDynamicColor = 404,
kKeyboardBacklight = 500,
};
// A result to display in launcher search that represents a personalization
// feature or page.
struct SearchResult {
// The id of the search concept that generated this search result. Note that
// multiple results with a different |text| can have the same
// |search_concept_id|, as some SearchResults can be found with alternate
// search text (eg "Dark Mode" and "Dark Theme").
SearchConceptId search_concept_id;
// The display text of the search result.
mojo_base.mojom.String16 text;
// The relative url, including query parameters, to open when the search
// result is selected.
string relative_url;
// The score of the search result for ranking purposes.
double relevance_score;
};
// Used to observe changes to search results.
interface SearchResultsObserver {
// Called when one or more search results has changed.
// This may happen when certain preferences are set by sync or schedule, ie
// search results for dark mode may change if dark mode is changed in the
// background due to auto dark mode schedule.
OnSearchResultsChanged();
};
// Handles search queries and may respond with Personalization results.
interface SearchHandler {
// Run a search from user input and reply with a list of results. Returns
// empty list on error or no relevant results.
Search(mojo_base.mojom.String16 query, uint32 max_num_results) => (
array<SearchResult> results);
// Set an observer for search results. To stop observing, close the
// connection.
AddObserver(pending_remote<SearchResultsObserver> observer);
};