blob: 86fbd587b65b194fdc528b6dbd51f020168eb50e [file] [log] [blame]
Avi Drissman8ba1bad2022-09-13 19:22:361// Copyright 2022 The Chromium Authors
Angela Yoeurng24006262022-04-12 19:40:092// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_STARTER_PACK_DATA_H_
6#define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_STARTER_PACK_DATA_H_
7
Stephan Hartmannaca38ff2022-04-13 20:09:498#include <memory>
Angela Yoeurng3fad1852022-06-02 00:30:269#include <string>
Angela Yoeurng24006262022-04-12 19:40:0910#include <vector>
11
Angela Yoeurng75ef8182022-04-18 23:39:2212#include "components/search_engines/search_engine_type.h"
13
Angela Yoeurng24006262022-04-12 19:40:0914struct TemplateURLData;
15
16// The Starter Pack is a set of built-in search engines that allow the user to
17// search various parts of Chrome from the Omnibox through keyword mode. Unlike
18// prepopulated engines, starter pack scopes are not "search engines" that
19// search the web. Instead, they use the built-in omnibox providers to provide
20// suggestions. This file defines those search engines and util functions.
21
manukhf627a8e2025-06-21 00:20:4622namespace template_url_starter_pack_data {
Angela Yoeurng24006262022-04-12 19:40:0923
Angela Yoeurng638e2402022-05-18 00:25:0724typedef enum {
25 kBookmarks = 1,
26 kHistory = 2,
Angela Yoeurng19a6afa2022-06-09 16:32:4427 kTabs = 3,
Angela Yoeurnge6c2ed3d2024-08-29 22:26:2128 kGemini = 4,
Orin Jaworski769e4e92025-03-04 17:11:0429 kPage = 5,
manukh44b7b1832025-06-24 00:26:2530 kAiMode = 6,
Angela Yoeurng638e2402022-05-18 00:25:0731
manukhf627a8e2025-06-21 00:20:4632 kMaxStarterPackId
33} StarterPackId;
Angela Yoeurng638e2402022-05-18 00:25:0734
Angela Yoeurng24006262022-04-12 19:40:0935struct StarterPackEngine {
36 int name_message_id;
37 int keyword_message_id;
38 const char* const favicon_url;
39 const char* const search_url;
Angela Yoeurng3fad1852022-06-02 00:30:2640 const char* const destination_url;
manukhf627a8e2025-06-21 00:20:4641 const StarterPackId id;
Angela Yoeurng75ef8182022-04-18 23:39:2242 const SearchEngineType type;
Angela Yoeurng24006262022-04-12 19:40:0943};
44
Angela Yoeurng24006262022-04-12 19:40:0945extern const int kCurrentDataVersion;
Angela Yoeurngd164d89d2022-07-27 01:25:4346extern const int kFirstCompatibleDataVersion;
Angela Yoeurng24006262022-04-12 19:40:0947
Angela Yoeurngd164d89d2022-07-27 01:25:4348// Exposed for testing purposes
Angela Yoeurng10424ca2022-05-19 01:46:4649extern const StarterPackEngine bookmarks;
50extern const StarterPackEngine history;
Angela Yoeurng19a6afa2022-06-09 16:32:4451extern const StarterPackEngine tabs;
manukhf627a8e2025-06-21 00:20:4652extern const StarterPackEngine gemini;
Orin Jaworski769e4e92025-03-04 17:11:0453extern const StarterPackEngine page;
manukh44b7b1832025-06-24 00:26:2554extern const StarterPackEngine ai_mode;
Angela Yoeurng10424ca2022-05-19 01:46:4655
Angela Yoeurng24006262022-04-12 19:40:0956// Returns the current version of the starterpack data, so callers can know when
57// they need to re-merge.
58int GetDataVersion();
59
Angela Yoeurngd164d89d2022-07-27 01:25:4360// Returns the first compatible data version to the current data. Any starter
61// pack data version before this will be force updated regardless of user edits.
62int GetFirstCompatibleDataVersion();
63
Angela Yoeurng24006262022-04-12 19:40:0964// Returns a vector of all starter pack engines, in TemplateURLData format.
65std::vector<std::unique_ptr<TemplateURLData>> GetStarterPackEngines();
66
Angela Yoeurng3fad1852022-06-02 00:30:2667// Returns the destination url for the starter pack engine associated with a
68// given starter pack id.
manukhf627a8e2025-06-21 00:20:4669std::u16string GetDestinationUrlForStarterPackId(int id);
Angela Yoeurng3fad1852022-06-02 00:30:2670
manukhf627a8e2025-06-21 00:20:4671} // namespace template_url_starter_pack_data
Angela Yoeurng24006262022-04-12 19:40:0972
73#endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_STARTER_PACK_DATA_H_