| 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/control_preference_specifics.pb.h" |
| 19 #include "sync/protocol/encryption.pb.h" | 20 #include "sync/protocol/encryption.pb.h" |
| 20 #include "sync/protocol/experiments_specifics.pb.h" | 21 #include "sync/protocol/experiments_specifics.pb.h" |
| 21 #include "sync/protocol/extension_setting_specifics.pb.h" | 22 #include "sync/protocol/extension_setting_specifics.pb.h" |
| 22 #include "sync/protocol/extension_specifics.pb.h" | 23 #include "sync/protocol/extension_specifics.pb.h" |
| 23 #include "sync/protocol/history_delete_directive_specifics.pb.h" | 24 #include "sync/protocol/history_delete_directive_specifics.pb.h" |
| 24 #include "sync/protocol/nigori_specifics.pb.h" | 25 #include "sync/protocol/nigori_specifics.pb.h" |
| 25 #include "sync/protocol/password_specifics.pb.h" | 26 #include "sync/protocol/password_specifics.pb.h" |
| 26 #include "sync/protocol/preference_specifics.pb.h" | 27 #include "sync/protocol/preference_specifics.pb.h" |
| 27 #include "sync/protocol/proto_enum_conversions.h" | 28 #include "sync/protocol/proto_enum_conversions.h" |
| 28 #include "sync/protocol/search_engine_specifics.pb.h" | 29 #include "sync/protocol/search_engine_specifics.pb.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 const sync_pb::BookmarkSpecifics& proto) { | 289 const sync_pb::BookmarkSpecifics& proto) { |
| 289 DictionaryValue* value = new DictionaryValue(); | 290 DictionaryValue* value = new DictionaryValue(); |
| 290 SET_STR(url); | 291 SET_STR(url); |
| 291 SET_BYTES(favicon); | 292 SET_BYTES(favicon); |
| 292 SET_STR(title); | 293 SET_STR(title); |
| 293 SET_INT64(creation_time_us); | 294 SET_INT64(creation_time_us); |
| 294 SET_STR(icon_url); | 295 SET_STR(icon_url); |
| 295 return value; | 296 return value; |
| 296 } | 297 } |
| 297 | 298 |
| 299 DictionaryValue* ControlPreferenceSpecificsToValue( |
| 300 const sync_pb::ControlPreferenceSpecifics& proto) { |
| 301 DictionaryValue* value = new DictionaryValue(); |
| 302 SET_STR(name); |
| 303 SET_STR(value); |
| 304 return value; |
| 305 } |
| 306 |
| 298 DictionaryValue* DeviceInfoSpecificsToValue( | 307 DictionaryValue* DeviceInfoSpecificsToValue( |
| 299 const sync_pb::DeviceInfoSpecifics& proto) { | 308 const sync_pb::DeviceInfoSpecifics& proto) { |
| 300 DictionaryValue* value = new DictionaryValue(); | 309 DictionaryValue* value = new DictionaryValue(); |
| 301 SET_STR(cache_guid); | 310 SET_STR(cache_guid); |
| 302 SET_STR(client_name); | 311 SET_STR(client_name); |
| 303 SET_ENUM(device_type, GetDeviceTypeString); | 312 SET_ENUM(device_type, GetDeviceTypeString); |
| 304 SET_STR(sync_user_agent); | 313 SET_STR(sync_user_agent); |
| 305 SET_STR(chrome_version); | 314 SET_STR(chrome_version); |
| 306 return value; | 315 return value; |
| 307 } | 316 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 448 |
| 440 DictionaryValue* EntitySpecificsToValue( | 449 DictionaryValue* EntitySpecificsToValue( |
| 441 const sync_pb::EntitySpecifics& specifics) { | 450 const sync_pb::EntitySpecifics& specifics) { |
| 442 DictionaryValue* value = new DictionaryValue(); | 451 DictionaryValue* value = new DictionaryValue(); |
| 443 SET_FIELD(app, AppSpecificsToValue); | 452 SET_FIELD(app, AppSpecificsToValue); |
| 444 SET_FIELD(app_notification, AppNotificationToValue); | 453 SET_FIELD(app_notification, AppNotificationToValue); |
| 445 SET_FIELD(app_setting, AppSettingSpecificsToValue); | 454 SET_FIELD(app_setting, AppSettingSpecificsToValue); |
| 446 SET_FIELD(autofill, AutofillSpecificsToValue); | 455 SET_FIELD(autofill, AutofillSpecificsToValue); |
| 447 SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); | 456 SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); |
| 448 SET_FIELD(bookmark, BookmarkSpecificsToValue); | 457 SET_FIELD(bookmark, BookmarkSpecificsToValue); |
| 458 SET_FIELD(control_preference, ControlPreferenceSpecificsToValue); |
| 449 SET_FIELD(device_info, DeviceInfoSpecificsToValue); | 459 SET_FIELD(device_info, DeviceInfoSpecificsToValue); |
| 450 SET_FIELD(experiments, ExperimentsSpecificsToValue); | 460 SET_FIELD(experiments, ExperimentsSpecificsToValue); |
| 451 SET_FIELD(extension, ExtensionSpecificsToValue); | 461 SET_FIELD(extension, ExtensionSpecificsToValue); |
| 452 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); | 462 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); |
| 453 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); | 463 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); |
| 454 SET_FIELD(nigori, NigoriSpecificsToValue); | 464 SET_FIELD(nigori, NigoriSpecificsToValue); |
| 455 SET_FIELD(password, PasswordSpecificsToValue); | 465 SET_FIELD(password, PasswordSpecificsToValue); |
| 456 SET_FIELD(preference, PreferenceSpecificsToValue); | 466 SET_FIELD(preference, PreferenceSpecificsToValue); |
| 457 SET_FIELD(search_engine, SearchEngineSpecificsToValue); | 467 SET_FIELD(search_engine, SearchEngineSpecificsToValue); |
| 458 SET_FIELD(session, SessionSpecificsToValue); | 468 SET_FIELD(session, SessionSpecificsToValue); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 #undef SET_BYTES | 715 #undef SET_BYTES |
| 706 #undef SET_INT32 | 716 #undef SET_INT32 |
| 707 #undef SET_INT64 | 717 #undef SET_INT64 |
| 708 #undef SET_INT64_REP | 718 #undef SET_INT64_REP |
| 709 #undef SET_STR | 719 #undef SET_STR |
| 710 #undef SET_STR_REP | 720 #undef SET_STR_REP |
| 711 | 721 |
| 712 #undef SET_FIELD | 722 #undef SET_FIELD |
| 713 | 723 |
| 714 } // namespace syncer | 724 } // namespace syncer |
| OLD | NEW |