File: search_concept.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (71 lines) | stat: -rw-r--r-- 3,112 bytes parent folder | download | duplicates (6)
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
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_WEBUI_ASH_SETTINGS_SEARCH_SEARCH_CONCEPT_H_
#define CHROME_BROWSER_UI_WEBUI_ASH_SETTINGS_SEARCH_SEARCH_CONCEPT_H_

#include <array>

#include "ash/webui/settings/public/constants/routes.mojom.h"
#include "ash/webui/settings/public/constants/setting.mojom.h"
#include "chrome/browser/ui/webui/ash/settings/os_settings_identifier.h"
#include "chrome/browser/ui/webui/ash/settings/search/mojom/search.mojom.h"
#include "chrome/browser/ui/webui/ash/settings/search/mojom/search_result_icon.mojom.h"

namespace ash::settings {

// Represents a potential search result. In this context, "concept" refers to
// the fact that this search result represents an idea which may be described
// by more than just one phrase. For example, a concept of "Display settings"
// may also be described as "Monitor settings".
//
// Each concept has a canonical description search tag as well as up to
// |kMaxAltTagsPerConcept| alternate descriptions search tags.
struct SearchConcept {
  static constexpr size_t kMaxAltTagsPerConcept = 5;
  static constexpr int kAltTagEnd = 0;

  // Message ID (from os_settings_search_tag_strings.grdp) corresponding to the
  // canonical search tag for this concept.
  int canonical_message_id;

  // URL path corresponding to the settings subpage at which the user can
  // change a setting associated with the tag. This string can also contain
  // URL parameters.
  //
  // Example 1 - Display settings (chrome://os-settings/device/display):
  //             ==> "device/display".
  // Example 2 - Wi-Fi settings (chrome://os-settings/networks?type=WiFi):
  //             ==> "networks?type=WiFi"
  const char* url_path_with_parameters;

  // Icon to display for search results associated with this concept.
  mojom::SearchResultIcon icon;

  // Default ranking, which is used to break ties when searching for results.
  mojom::SearchResultDefaultRank default_rank;

  // The type and identifier for this search result. The value of the |type|
  // field indicates the union member used by |id|.
  mojom::SearchResultType type;
  OsSettingsIdentifier id;

  // Alternate message IDs (from os_settings_search_tag_strings.grdp)
  // corresponding to this concept. These IDs refer to messages which represent
  // an alternate way of describing the same concept (e.g., "Monitor settings"
  // is an alternate phrase for "Display settings").
  //
  // This field provides up to |kMaxAltTagsPerConcept| alternate tags, but not
  // all concepts will require this many. A value of kAltTagEnd is used to
  // indicate that there are no further tags.
  //
  // Example 1 - Five alternate tags: [1234, 1235, 1236, 1237, 1238]
  // Example 2 - Two alternate tags: [1234, 1235, kAltTagEnd, _, _]
  // Example 3 - Zero alternate tags: [kAltTagEnd, _, _, _, _]
  std::array<int, kMaxAltTagsPerConcept> alt_tag_ids{kAltTagEnd};
};

}  // namespace ash::settings

#endif  // CHROME_BROWSER_UI_WEBUI_ASH_SETTINGS_SEARCH_SEARCH_CONCEPT_H_