OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Keep this file in sync with the .proto files in this directory. | 5 // Keep this file in sync with the .proto files in this directory. |
6 | 6 |
7 #include "sync/protocol/proto_value_conversions.h" | 7 #include "sync/protocol/proto_value_conversions.h" |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "sync/protocol/app_notification_specifics.pb.h" | 14 #include "sync/protocol/app_notification_specifics.pb.h" |
15 #include "sync/protocol/app_setting_specifics.pb.h" | 15 #include "sync/protocol/app_setting_specifics.pb.h" |
16 #include "sync/protocol/app_specifics.pb.h" | 16 #include "sync/protocol/app_specifics.pb.h" |
17 #include "sync/protocol/autofill_specifics.pb.h" | 17 #include "sync/protocol/autofill_specifics.pb.h" |
18 #include "sync/protocol/bookmark_specifics.pb.h" | 18 #include "sync/protocol/bookmark_specifics.pb.h" |
19 #include "sync/protocol/encryption.pb.h" | 19 #include "sync/protocol/encryption.pb.h" |
20 #include "sync/protocol/extension_setting_specifics.pb.h" | 20 #include "sync/protocol/extension_setting_specifics.pb.h" |
21 #include "sync/protocol/extension_specifics.pb.h" | 21 #include "sync/protocol/extension_specifics.pb.h" |
| 22 #include "sync/protocol/history_delete_directive_specifics.pb.h" |
22 #include "sync/protocol/nigori_specifics.pb.h" | 23 #include "sync/protocol/nigori_specifics.pb.h" |
23 #include "sync/protocol/password_specifics.pb.h" | 24 #include "sync/protocol/password_specifics.pb.h" |
24 #include "sync/protocol/preference_specifics.pb.h" | 25 #include "sync/protocol/preference_specifics.pb.h" |
25 #include "sync/protocol/proto_enum_conversions.h" | 26 #include "sync/protocol/proto_enum_conversions.h" |
26 #include "sync/protocol/search_engine_specifics.pb.h" | 27 #include "sync/protocol/search_engine_specifics.pb.h" |
27 #include "sync/protocol/session_specifics.pb.h" | 28 #include "sync/protocol/session_specifics.pb.h" |
28 #include "sync/protocol/sync.pb.h" | 29 #include "sync/protocol/sync.pb.h" |
29 #include "sync/protocol/theme_specifics.pb.h" | 30 #include "sync/protocol/theme_specifics.pb.h" |
30 #include "sync/protocol/typed_url_specifics.pb.h" | 31 #include "sync/protocol/typed_url_specifics.pb.h" |
31 | 32 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 const sync_pb::DeviceInfoSpecifics& proto) { | 200 const sync_pb::DeviceInfoSpecifics& proto) { |
200 DictionaryValue* value = new DictionaryValue(); | 201 DictionaryValue* value = new DictionaryValue(); |
201 SET_STR(cache_guid); | 202 SET_STR(cache_guid); |
202 SET_STR(client_name); | 203 SET_STR(client_name); |
203 SET_ENUM(device_type, GetDeviceTypeString); | 204 SET_ENUM(device_type, GetDeviceTypeString); |
204 SET_STR(sync_user_agent); | 205 SET_STR(sync_user_agent); |
205 SET_STR(chrome_version); | 206 SET_STR(chrome_version); |
206 return value; | 207 return value; |
207 } | 208 } |
208 | 209 |
| 210 base::DictionaryValue* GlobalIdDirectiveToValue( |
| 211 const sync_pb::GlobalIdDirective& proto) { |
| 212 DictionaryValue* value = new DictionaryValue(); |
| 213 SET_INT64_REP(global_id); |
| 214 return value; |
| 215 } |
| 216 |
| 217 base::DictionaryValue* TimeRangeDirectiveToValue( |
| 218 const sync_pb::TimeRangeDirective& proto) { |
| 219 DictionaryValue* value = new DictionaryValue(); |
| 220 SET_INT64(start_time_usec); |
| 221 SET_INT64(end_time_usec); |
| 222 return value; |
| 223 } |
| 224 |
209 DictionaryValue* AppNotificationToValue( | 225 DictionaryValue* AppNotificationToValue( |
210 const sync_pb::AppNotification& proto) { | 226 const sync_pb::AppNotification& proto) { |
211 DictionaryValue* value = new DictionaryValue(); | 227 DictionaryValue* value = new DictionaryValue(); |
212 SET_STR(guid); | 228 SET_STR(guid); |
213 SET_STR(app_id); | 229 SET_STR(app_id); |
214 SET_INT64(creation_timestamp_ms); | 230 SET_INT64(creation_timestamp_ms); |
215 SET_STR(title); | 231 SET_STR(title); |
216 SET_STR(body_text); | 232 SET_STR(body_text); |
217 SET_STR(link_url); | 233 SET_STR(link_url); |
218 SET_STR(link_text); | 234 SET_STR(link_text); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 DictionaryValue* value = new DictionaryValue(); | 310 DictionaryValue* value = new DictionaryValue(); |
295 SET_STR(id); | 311 SET_STR(id); |
296 SET_STR(version); | 312 SET_STR(version); |
297 SET_STR(update_url); | 313 SET_STR(update_url); |
298 SET_BOOL(enabled); | 314 SET_BOOL(enabled); |
299 SET_BOOL(incognito_enabled); | 315 SET_BOOL(incognito_enabled); |
300 SET_STR(name); | 316 SET_STR(name); |
301 return value; | 317 return value; |
302 } | 318 } |
303 | 319 |
| 320 base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue( |
| 321 const sync_pb::HistoryDeleteDirectiveSpecifics& proto) { |
| 322 DictionaryValue* value = new DictionaryValue(); |
| 323 SET(global_id_directive, GlobalIdDirectiveToValue); |
| 324 SET(time_range_directive, TimeRangeDirectiveToValue); |
| 325 return value; |
| 326 } |
| 327 |
304 DictionaryValue* NigoriSpecificsToValue( | 328 DictionaryValue* NigoriSpecificsToValue( |
305 const sync_pb::NigoriSpecifics& proto) { | 329 const sync_pb::NigoriSpecifics& proto) { |
306 DictionaryValue* value = new DictionaryValue(); | 330 DictionaryValue* value = new DictionaryValue(); |
307 SET(encryption_keybag, EncryptedDataToValue); | 331 SET(encryption_keybag, EncryptedDataToValue); |
308 SET_BOOL(keybag_is_frozen); | 332 SET_BOOL(keybag_is_frozen); |
309 SET_BOOL(encrypt_bookmarks); | 333 SET_BOOL(encrypt_bookmarks); |
310 SET_BOOL(encrypt_preferences); | 334 SET_BOOL(encrypt_preferences); |
311 SET_BOOL(encrypt_autofill_profile); | 335 SET_BOOL(encrypt_autofill_profile); |
312 SET_BOOL(encrypt_autofill); | 336 SET_BOOL(encrypt_autofill); |
313 SET_BOOL(encrypt_themes); | 337 SET_BOOL(encrypt_themes); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 DictionaryValue* value = new DictionaryValue(); | 425 DictionaryValue* value = new DictionaryValue(); |
402 SET_FIELD(app, AppSpecificsToValue); | 426 SET_FIELD(app, AppSpecificsToValue); |
403 SET_FIELD(app_notification, AppNotificationToValue); | 427 SET_FIELD(app_notification, AppNotificationToValue); |
404 SET_FIELD(app_setting, AppSettingSpecificsToValue); | 428 SET_FIELD(app_setting, AppSettingSpecificsToValue); |
405 SET_FIELD(autofill, AutofillSpecificsToValue); | 429 SET_FIELD(autofill, AutofillSpecificsToValue); |
406 SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); | 430 SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); |
407 SET_FIELD(bookmark, BookmarkSpecificsToValue); | 431 SET_FIELD(bookmark, BookmarkSpecificsToValue); |
408 SET_FIELD(device_info, DeviceInfoSpecificsToValue); | 432 SET_FIELD(device_info, DeviceInfoSpecificsToValue); |
409 SET_FIELD(extension, ExtensionSpecificsToValue); | 433 SET_FIELD(extension, ExtensionSpecificsToValue); |
410 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); | 434 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); |
| 435 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); |
411 SET_FIELD(nigori, NigoriSpecificsToValue); | 436 SET_FIELD(nigori, NigoriSpecificsToValue); |
412 SET_FIELD(password, PasswordSpecificsToValue); | 437 SET_FIELD(password, PasswordSpecificsToValue); |
413 SET_FIELD(preference, PreferenceSpecificsToValue); | 438 SET_FIELD(preference, PreferenceSpecificsToValue); |
414 SET_FIELD(search_engine, SearchEngineSpecificsToValue); | 439 SET_FIELD(search_engine, SearchEngineSpecificsToValue); |
415 SET_FIELD(session, SessionSpecificsToValue); | 440 SET_FIELD(session, SessionSpecificsToValue); |
416 SET_FIELD(theme, ThemeSpecificsToValue); | 441 SET_FIELD(theme, ThemeSpecificsToValue); |
417 SET_FIELD(typed_url, TypedUrlSpecificsToValue); | 442 SET_FIELD(typed_url, TypedUrlSpecificsToValue); |
418 return value; | 443 return value; |
419 } | 444 } |
420 | 445 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 #undef SET_BYTES | 635 #undef SET_BYTES |
611 #undef SET_INT32 | 636 #undef SET_INT32 |
612 #undef SET_INT64 | 637 #undef SET_INT64 |
613 #undef SET_INT64_REP | 638 #undef SET_INT64_REP |
614 #undef SET_STR | 639 #undef SET_STR |
615 #undef SET_STR_REP | 640 #undef SET_STR_REP |
616 | 641 |
617 #undef SET_FIELD | 642 #undef SET_FIELD |
618 | 643 |
619 } // namespace syncer | 644 } // namespace syncer |
OLD | NEW |