Angela Yoeurng | 2400626 | 2022-04-12 19:40:09 | [diff] [blame] | 1 | // 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 Hartmann | aca38ff | 2022-04-13 20:09:49 | [diff] [blame] | 8 | #include <memory> |
Angela Yoeurng | 3fad185 | 2022-06-02 00:30:26 | [diff] [blame^] | 9 | #include <string> |
Angela Yoeurng | 2400626 | 2022-04-12 19:40:09 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
Angela Yoeurng | 75ef818 | 2022-04-18 23:39:22 | [diff] [blame] | 12 | #include "components/search_engines/search_engine_type.h" |
| 13 | |
Angela Yoeurng | 2400626 | 2022-04-12 19:40:09 | [diff] [blame] | 14 | struct 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 | |
| 22 | namespace TemplateURLStarterPackData { |
| 23 | |
Angela Yoeurng | 638e240 | 2022-05-18 00:25:07 | [diff] [blame] | 24 | typedef enum { |
| 25 | kBookmarks = 1, |
| 26 | kHistory = 2, |
| 27 | |
| 28 | kMaxStarterPackID |
| 29 | } StarterPackID; |
| 30 | |
Angela Yoeurng | 2400626 | 2022-04-12 19:40:09 | [diff] [blame] | 31 | struct StarterPackEngine { |
| 32 | int name_message_id; |
| 33 | int keyword_message_id; |
| 34 | const char* const favicon_url; |
| 35 | const char* const search_url; |
Angela Yoeurng | 3fad185 | 2022-06-02 00:30:26 | [diff] [blame^] | 36 | const char* const destination_url; |
Angela Yoeurng | 638e240 | 2022-05-18 00:25:07 | [diff] [blame] | 37 | const StarterPackID id; |
Angela Yoeurng | 75ef818 | 2022-04-18 23:39:22 | [diff] [blame] | 38 | const SearchEngineType type; |
Angela Yoeurng | 2400626 | 2022-04-12 19:40:09 | [diff] [blame] | 39 | }; |
| 40 | |
Angela Yoeurng | 2400626 | 2022-04-12 19:40:09 | [diff] [blame] | 41 | extern const int kCurrentDataVersion; |
| 42 | |
Angela Yoeurng | 10424ca | 2022-05-19 01:46:46 | [diff] [blame] | 43 | /* Exposed for testing purposes */ |
| 44 | extern const StarterPackEngine bookmarks; |
| 45 | extern const StarterPackEngine history; |
| 46 | |
Angela Yoeurng | 2400626 | 2022-04-12 19:40:09 | [diff] [blame] | 47 | // Returns the current version of the starterpack data, so callers can know when |
| 48 | // they need to re-merge. |
| 49 | int GetDataVersion(); |
| 50 | |
| 51 | // Returns a vector of all starter pack engines, in TemplateURLData format. |
| 52 | std::vector<std::unique_ptr<TemplateURLData>> GetStarterPackEngines(); |
| 53 | |
Angela Yoeurng | 3fad185 | 2022-06-02 00:30:26 | [diff] [blame^] | 54 | // Returns the destination url for the starter pack engine associated with a |
| 55 | // given starter pack id. |
| 56 | std::u16string GetDestinationUrlForStarterPackID(int id); |
| 57 | |
Angela Yoeurng | 2400626 | 2022-04-12 19:40:09 | [diff] [blame] | 58 | } // namespace TemplateURLStarterPackData |
| 59 | |
| 60 | #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_STARTER_PACK_DATA_H_ |