blob: 6bf1eb274227de2c76189b6728cb788ae5d08f82 [file] [log] [blame]
Angela Yoeurng24006262022-04-12 19:40:091// Copyright 2022 The Chromium Authors. All rights reserved.
2// 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 Yoeurng638e2402022-05-18 00:25:0728
29 kMaxStarterPackID
30} StarterPackID;
31
Angela Yoeurng24006262022-04-12 19:40:0932struct StarterPackEngine {
33 int name_message_id;
34 int keyword_message_id;
35 const char* const favicon_url;
36 const char* const search_url;
Angela Yoeurng3fad1852022-06-02 00:30:2637 const char* const destination_url;
Angela Yoeurng638e2402022-05-18 00:25:0738 const StarterPackID id;
Angela Yoeurng75ef8182022-04-18 23:39:2239 const SearchEngineType type;
Angela Yoeurng24006262022-04-12 19:40:0940};
41
Angela Yoeurng24006262022-04-12 19:40:0942extern const int kCurrentDataVersion;
Angela Yoeurngd164d89d2022-07-27 01:25:4343extern const int kFirstCompatibleDataVersion;
Angela Yoeurng24006262022-04-12 19:40:0944
Angela Yoeurngd164d89d2022-07-27 01:25:4345// Exposed for testing purposes
Angela Yoeurng10424ca2022-05-19 01:46:4646extern const StarterPackEngine bookmarks;
47extern const StarterPackEngine history;
Angela Yoeurng19a6afa2022-06-09 16:32:4448extern const StarterPackEngine tabs;
Angela Yoeurng10424ca2022-05-19 01:46:4649
Angela Yoeurng24006262022-04-12 19:40:0950// Returns the current version of the starterpack data, so callers can know when
51// they need to re-merge.
52int GetDataVersion();
53
Angela Yoeurngd164d89d2022-07-27 01:25:4354// Returns the first compatible data version to the current data. Any starter
55// pack data version before this will be force updated regardless of user edits.
56int GetFirstCompatibleDataVersion();
57
Angela Yoeurng24006262022-04-12 19:40:0958// Returns a vector of all starter pack engines, in TemplateURLData format.
59std::vector<std::unique_ptr<TemplateURLData>> GetStarterPackEngines();
60
Angela Yoeurng3fad1852022-06-02 00:30:2661// Returns the destination url for the starter pack engine associated with a
62// given starter pack id.
63std::u16string GetDestinationUrlForStarterPackID(int id);
64
Angela Yoeurng24006262022-04-12 19:40:0965} // namespace TemplateURLStarterPackData
66
67#endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_STARTER_PACK_DATA_H_