blob: 1c6869a7bc4a5732aa37d7c210e1b3993cedbbb1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Keep this file in sync with the .proto files in this directory.
#ifndef CHROME_BROWSER_SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_
#define CHROME_BROWSER_SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_
#pragma once
class DictionaryValue;
namespace sync_pb {
class AppSpecifics;
class AutofillCreditCardSpecifics;
class AutofillProfileSpecifics;
class AutofillSpecifics;
class BookmarkSpecifics;
class EncryptedData;
class EntitySpecifics;
class ExtensionSpecifics;
class NigoriSpecifics;
class PasswordSpecifics;
class PasswordSpecificsData;
class PreferenceSpecifics;
class SearchEngineSpecifics;
class SessionHeader;
class SessionSpecifics;
class SessionTab;
class SessionWindow;
class TabNavigation;
class ThemeSpecifics;
class TypedUrlSpecifics;
} // namespace sync_pb
// Utility functions to convert sync protocol buffers to dictionaries.
// Each protocol field is mapped to a key of the same name. Repeated
// fields are mapped to array values and sub-messages are mapped to
// sub-dictionary values.
//
// TODO(akalin): Add has_* information.
//
// TODO(akalin): Improve enum support.
namespace browser_sync {
// Ownership of all returned DictionaryValues are transferred to the
// caller.
// TODO(akalin): Perhaps extend this to decrypt?
DictionaryValue* EncryptedDataToValue(
const sync_pb::EncryptedData& encrypted_data);
// Sub-protocols of SessionSpecifics.
DictionaryValue* SessionHeaderToValue(
const sync_pb::SessionHeader& session_header);
DictionaryValue* SessionTabToValue(
const sync_pb::SessionTab& session_tab);
DictionaryValue* SessionWindowToValue(
const sync_pb::SessionWindow& session_window);
DictionaryValue* TabNavigationToValue(
const sync_pb::TabNavigation& tab_navigation);
// Sub-protocol of PasswordSpecifics.
DictionaryValue* PasswordSpecificsDataToValue(
const sync_pb::PasswordSpecificsData& password_specifics_data);
// Main *SpecificsToValue functions.
DictionaryValue* AppSpecificsToValue(
const sync_pb::AppSpecifics& app_specifics);
DictionaryValue* AutofillSpecificsToValue(
const sync_pb::AutofillSpecifics& autofill_specifics);
DictionaryValue* AutofillCreditCardSpecificsToValue(
const sync_pb::AutofillCreditCardSpecifics&
autofill_credit_card_specifics);
DictionaryValue* AutofillProfileSpecificsToValue(
const sync_pb::AutofillProfileSpecifics& autofill_profile_specifics);
DictionaryValue* BookmarkSpecificsToValue(
const sync_pb::BookmarkSpecifics& bookmark_specifics);
DictionaryValue* ExtensionSpecificsToValue(
const sync_pb::ExtensionSpecifics& extension_specifics);
DictionaryValue* NigoriSpecificsToValue(
const sync_pb::NigoriSpecifics& nigori_specifics);
DictionaryValue* PasswordSpecificsToValue(
const sync_pb::PasswordSpecifics& password_specifics);
DictionaryValue* PreferenceSpecificsToValue(
const sync_pb::PreferenceSpecifics& password_specifics);
DictionaryValue* SearchEngineSpecificsToValue(
const sync_pb::SearchEngineSpecifics& search_engine_specifics);
DictionaryValue* SessionSpecificsToValue(
const sync_pb::SessionSpecifics& session_specifics);
DictionaryValue* ThemeSpecificsToValue(
const sync_pb::ThemeSpecifics& theme_specifics);
DictionaryValue* TypedUrlSpecificsToValue(
const sync_pb::TypedUrlSpecifics& typed_url_specifics);
// Any present extensions are mapped to sub-dictionary values with the
// key equal to the extension name.
DictionaryValue* EntitySpecificsToValue(
const sync_pb::EntitySpecifics& entity_specifics);
} // namespace browser_sync
#endif // CHROME_BROWSER_SYNC_PROTOCOL_PROTO_VALUE_CONVERSIONS_H_
|