blob: 6b393b719064fd52349c1efecbb5222bd3b3b0c0 [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
22namespace TemplateURLStarterPackData {
23
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,
Angela Yoeurng638e2402022-05-18 00:25:0730
31 kMaxStarterPackID
32} StarterPackID;
33
Angela Yoeurng24006262022-04-12 19:40:0934struct StarterPackEngine {
35 int name_message_id;
36 int keyword_message_id;
37 const char* const favicon_url;
38 const char* const search_url;
Angela Yoeurng3fad1852022-06-02 00:30:2639 const char* const destination_url;
Angela Yoeurng638e2402022-05-18 00:25:0740 const StarterPackID id;
Angela Yoeurng75ef8182022-04-18 23:39:2241 const SearchEngineType type;
Angela Yoeurng24006262022-04-12 19:40:0942};
43
Angela Yoeurng24006262022-04-12 19:40:0944extern const int kCurrentDataVersion;
Angela Yoeurngd164d89d2022-07-27 01:25:4345extern const int kFirstCompatibleDataVersion;
Angela Yoeurng24006262022-04-12 19:40:0946
Angela Yoeurngd164d89d2022-07-27 01:25:4347// Exposed for testing purposes
Angela Yoeurng10424ca2022-05-19 01:46:4648extern const StarterPackEngine bookmarks;
49extern const StarterPackEngine history;
Angela Yoeurng19a6afa2022-06-09 16:32:4450extern const StarterPackEngine tabs;
Angela Yoeurnge6c2ed3d2024-08-29 22:26:2151extern const StarterPackEngine Gemini;
Orin Jaworski769e4e92025-03-04 17:11:0452extern const StarterPackEngine page;
Angela Yoeurng10424ca2022-05-19 01:46:4653
Angela Yoeurng24006262022-04-12 19:40:0954// Returns the current version of the starterpack data, so callers can know when
55// they need to re-merge.
56int GetDataVersion();
57
Angela Yoeurngd164d89d2022-07-27 01:25:4358// Returns the first compatible data version to the current data. Any starter
59// pack data version before this will be force updated regardless of user edits.
60int GetFirstCompatibleDataVersion();
61
Angela Yoeurng24006262022-04-12 19:40:0962// Returns a vector of all starter pack engines, in TemplateURLData format.
63std::vector<std::unique_ptr<TemplateURLData>> GetStarterPackEngines();
64
Angela Yoeurng3fad1852022-06-02 00:30:2665// Returns the destination url for the starter pack engine associated with a
66// given starter pack id.
67std::u16string GetDestinationUrlForStarterPackID(int id);
68
Angela Yoeurng24006262022-04-12 19:40:0969} // namespace TemplateURLStarterPackData
70
71#endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_STARTER_PACK_DATA_H_