Upload upstream chromium 114.0.5735.31
[platform/framework/web/chromium-efl.git] / components / search_engines / template_url_data_util.h
1 // Copyright 2016 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_DATA_UTIL_H_
6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_UTIL_H_
7
8 #include <memory>
9
10 #include <base/values.h>
11
12 namespace TemplateURLPrepopulateData {
13 struct PrepopulatedEngine;
14 }
15 namespace TemplateURLStarterPackData {
16 struct StarterPackEngine;
17 }
18
19 struct TemplateURLData;
20
21 // Deserializes a TemplateURLData from |dict|.
22 std::unique_ptr<TemplateURLData> TemplateURLDataFromDictionary(
23     const base::Value::Dict& dict);
24
25 // Serializes a TemplateURLData to |dict|.
26 base::Value::Dict TemplateURLDataToDictionary(const TemplateURLData& turl_data);
27
28 // Create TemplateURLData structure from PrepopulatedEngine structure.
29 std::unique_ptr<TemplateURLData> TemplateURLDataFromPrepopulatedEngine(
30     const TemplateURLPrepopulateData::PrepopulatedEngine& engine);
31
32 // Deserializes a TemplateURLData from |dict| as stored in
33 // kSearchProviderOverrides pref. The field names in |dict| differ from those
34 // used in the To/FromDictionary functions above for historical reasons.
35 // TODO(a-v-y) Migrate to single TemplateURLData serialization format.
36 std::unique_ptr<TemplateURLData> TemplateURLDataFromOverrideDictionary(
37     const base::Value::Dict& engine);
38
39 // Creates a TemplateURLData structure from a StarterPackEngine struct.
40 std::unique_ptr<TemplateURLData> TemplateURLDataFromStarterPackEngine(
41     const TemplateURLStarterPackData::StarterPackEngine& engine);
42
43 #endif  // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_UTIL_H_