blob: db019de189eb6a1d0328e1f0f0d3231c366f4a02 [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,
27
28 kMaxStarterPackID
29} StarterPackID;
30
Angela Yoeurng24006262022-04-12 19:40:0931struct StarterPackEngine {
32 int name_message_id;
33 int keyword_message_id;
34 const char* const favicon_url;
35 const char* const search_url;
Angela Yoeurng3fad1852022-06-02 00:30:2636 const char* const destination_url;
Angela Yoeurng638e2402022-05-18 00:25:0737 const StarterPackID id;
Angela Yoeurng75ef8182022-04-18 23:39:2238 const SearchEngineType type;
Angela Yoeurng24006262022-04-12 19:40:0939};
40
Angela Yoeurng24006262022-04-12 19:40:0941extern const int kCurrentDataVersion;
42
Angela Yoeurng10424ca2022-05-19 01:46:4643/* Exposed for testing purposes */
44extern const StarterPackEngine bookmarks;
45extern const StarterPackEngine history;
46
Angela Yoeurng24006262022-04-12 19:40:0947// Returns the current version of the starterpack data, so callers can know when
48// they need to re-merge.
49int GetDataVersion();
50
51// Returns a vector of all starter pack engines, in TemplateURLData format.
52std::vector<std::unique_ptr<TemplateURLData>> GetStarterPackEngines();
53
Angela Yoeurng3fad1852022-06-02 00:30:2654// Returns the destination url for the starter pack engine associated with a
55// given starter pack id.
56std::u16string GetDestinationUrlForStarterPackID(int id);
57
Angela Yoeurng24006262022-04-12 19:40:0958} // namespace TemplateURLStarterPackData
59
60#endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_STARTER_PACK_DATA_H_