Upload upstream chromium 114.0.5735.31
[platform/framework/web/chromium-efl.git] / components / search_engines / template_url_starter_pack_data.h
1 // Copyright 2022 The Chromium Authors
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
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "components/search_engines/search_engine_type.h"
13
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
24 typedef enum {
25   kBookmarks = 1,
26   kHistory = 2,
27   kTabs = 3,
28
29   kMaxStarterPackID
30 } StarterPackID;
31
32 struct StarterPackEngine {
33   int name_message_id;
34   int keyword_message_id;
35   const char* const favicon_url;
36   const char* const search_url;
37   const char* const destination_url;
38   const StarterPackID id;
39   const SearchEngineType type;
40 };
41
42 extern const int kCurrentDataVersion;
43 extern const int kFirstCompatibleDataVersion;
44
45 // Exposed for testing purposes
46 extern const StarterPackEngine bookmarks;
47 extern const StarterPackEngine history;
48 extern const StarterPackEngine tabs;
49
50 // Returns the current version of the starterpack data, so callers can know when
51 // they need to re-merge.
52 int GetDataVersion();
53
54 // 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.
56 int GetFirstCompatibleDataVersion();
57
58 // Returns a vector of all starter pack engines, in TemplateURLData format.
59 std::vector<std::unique_ptr<TemplateURLData>> GetStarterPackEngines();
60
61 // Returns the destination url for the starter pack engine associated with a
62 // given starter pack id.
63 std::u16string GetDestinationUrlForStarterPackID(int id);
64
65 }  // namespace TemplateURLStarterPackData
66
67 #endif  // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_STARTER_PACK_DATA_H_