| 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" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 base::DictionaryValue* DictionarySpecificsToValue( | 329 base::DictionaryValue* DictionarySpecificsToValue( |
| 330 const sync_pb::DictionarySpecifics& proto) { | 330 const sync_pb::DictionarySpecifics& proto) { |
| 331 base::DictionaryValue* value = new base::DictionaryValue(); | 331 base::DictionaryValue* value = new base::DictionaryValue(); |
| 332 SET_STR(word); | 332 SET_STR(word); |
| 333 return value; | 333 return value; |
| 334 } | 334 } |
| 335 | 335 |
| 336 namespace { | 336 namespace { |
| 337 | 337 |
| 338 DictionaryValue* FaviconSyncFlagsToValue( | 338 base::DictionaryValue* FaviconSyncFlagsToValue( |
| 339 const sync_pb::FaviconSyncFlags& proto) { | 339 const sync_pb::FaviconSyncFlags& proto) { |
| 340 base::DictionaryValue* value = new base::DictionaryValue(); | 340 base::DictionaryValue* value = new base::DictionaryValue(); |
| 341 SET_BOOL(enabled); | 341 SET_BOOL(enabled); |
| 342 SET_INT32(favicon_sync_limit); | 342 SET_INT32(favicon_sync_limit); |
| 343 return value; | 343 return value; |
| 344 } | 344 } |
| 345 | 345 |
| 346 } | 346 } |
| 347 | 347 |
| 348 base::DictionaryValue* ExperimentsSpecificsToValue( | 348 base::DictionaryValue* ExperimentsSpecificsToValue( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 371 SET_STR(id); | 371 SET_STR(id); |
| 372 SET_STR(version); | 372 SET_STR(version); |
| 373 SET_STR(update_url); | 373 SET_STR(update_url); |
| 374 SET_BOOL(enabled); | 374 SET_BOOL(enabled); |
| 375 SET_BOOL(incognito_enabled); | 375 SET_BOOL(incognito_enabled); |
| 376 SET_STR(name); | 376 SET_STR(name); |
| 377 return value; | 377 return value; |
| 378 } | 378 } |
| 379 | 379 |
| 380 namespace { | 380 namespace { |
| 381 DictionaryValue* FaviconDataToValue( | 381 base::DictionaryValue* FaviconDataToValue( |
| 382 const sync_pb::FaviconData& proto) { | 382 const sync_pb::FaviconData& proto) { |
| 383 DictionaryValue* value = new DictionaryValue(); | 383 base::DictionaryValue* value = new base::DictionaryValue(); |
| 384 SET_BYTES(favicon); | 384 SET_BYTES(favicon); |
| 385 SET_INT32(width); | 385 SET_INT32(width); |
| 386 SET_INT32(height); | 386 SET_INT32(height); |
| 387 return value; | 387 return value; |
| 388 } | 388 } |
| 389 } // namespace | 389 } // namespace |
| 390 | 390 |
| 391 DictionaryValue* FaviconImageSpecificsToValue( | 391 base::DictionaryValue* FaviconImageSpecificsToValue( |
| 392 const sync_pb::FaviconImageSpecifics& proto) { | 392 const sync_pb::FaviconImageSpecifics& proto) { |
| 393 DictionaryValue* value = new DictionaryValue(); | 393 base::DictionaryValue* value = new base::DictionaryValue(); |
| 394 SET_STR(favicon_url); | 394 SET_STR(favicon_url); |
| 395 SET(favicon_web, FaviconDataToValue); | 395 SET(favicon_web, FaviconDataToValue); |
| 396 SET(favicon_web_32, FaviconDataToValue); | 396 SET(favicon_web_32, FaviconDataToValue); |
| 397 SET(favicon_touch_64, FaviconDataToValue); | 397 SET(favicon_touch_64, FaviconDataToValue); |
| 398 SET(favicon_touch_precomposed_64, FaviconDataToValue); | 398 SET(favicon_touch_precomposed_64, FaviconDataToValue); |
| 399 return value; | 399 return value; |
| 400 } | 400 } |
| 401 | 401 |
| 402 DictionaryValue* FaviconTrackingSpecificsToValue( | 402 base::DictionaryValue* FaviconTrackingSpecificsToValue( |
| 403 const sync_pb::FaviconTrackingSpecifics& proto) { | 403 const sync_pb::FaviconTrackingSpecifics& proto) { |
| 404 DictionaryValue* value = new DictionaryValue(); | 404 base::DictionaryValue* value = new base::DictionaryValue(); |
| 405 SET_STR(favicon_url); | 405 SET_STR(favicon_url); |
| 406 SET_INT64(last_visit_time_ms) | 406 SET_INT64(last_visit_time_ms) |
| 407 SET_BOOL(is_bookmarked); | 407 SET_BOOL(is_bookmarked); |
| 408 return value; | 408 return value; |
| 409 } | 409 } |
| 410 | 410 |
| 411 base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue( | 411 base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue( |
| 412 const sync_pb::HistoryDeleteDirectiveSpecifics& proto) { | 412 const sync_pb::HistoryDeleteDirectiveSpecifics& proto) { |
| 413 base::DictionaryValue* value = new base::DictionaryValue(); | 413 base::DictionaryValue* value = new base::DictionaryValue(); |
| 414 SET(global_id_directive, GlobalIdDirectiveToValue); | 414 SET(global_id_directive, GlobalIdDirectiveToValue); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 SET_FIELD(search_engine, SearchEngineSpecificsToValue); | 570 SET_FIELD(search_engine, SearchEngineSpecificsToValue); |
| 571 SET_FIELD(session, SessionSpecificsToValue); | 571 SET_FIELD(session, SessionSpecificsToValue); |
| 572 SET_FIELD(synced_notification, SyncedNotificationSpecificsToValue); | 572 SET_FIELD(synced_notification, SyncedNotificationSpecificsToValue); |
| 573 SET_FIELD(theme, ThemeSpecificsToValue); | 573 SET_FIELD(theme, ThemeSpecificsToValue); |
| 574 SET_FIELD(typed_url, TypedUrlSpecificsToValue); | 574 SET_FIELD(typed_url, TypedUrlSpecificsToValue); |
| 575 return value; | 575 return value; |
| 576 } | 576 } |
| 577 | 577 |
| 578 namespace { | 578 namespace { |
| 579 | 579 |
| 580 StringValue* UniquePositionToStringValue( | 580 base::StringValue* UniquePositionToStringValue( |
| 581 const sync_pb::UniquePosition& proto) { | 581 const sync_pb::UniquePosition& proto) { |
| 582 UniquePosition pos = UniquePosition::FromProto(proto); | 582 UniquePosition pos = UniquePosition::FromProto(proto); |
| 583 return new StringValue(pos.ToDebugString()); | 583 return new base::StringValue(pos.ToDebugString()); |
| 584 } | 584 } |
| 585 | 585 |
| 586 base::DictionaryValue* SyncEntityToValue(const sync_pb::SyncEntity& proto, | 586 base::DictionaryValue* SyncEntityToValue(const sync_pb::SyncEntity& proto, |
| 587 bool include_specifics) { | 587 bool include_specifics) { |
| 588 base::DictionaryValue* value = new base::DictionaryValue(); | 588 base::DictionaryValue* value = new base::DictionaryValue(); |
| 589 SET_STR(id_string); | 589 SET_STR(id_string); |
| 590 SET_STR(parent_id_string); | 590 SET_STR(parent_id_string); |
| 591 SET_STR(old_parent_id); | 591 SET_STR(old_parent_id); |
| 592 SET_INT64(version); | 592 SET_INT64(version); |
| 593 SET_INT64(mtime); | 593 SET_INT64(mtime); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 #undef SET_BYTES | 856 #undef SET_BYTES |
| 857 #undef SET_INT32 | 857 #undef SET_INT32 |
| 858 #undef SET_INT64 | 858 #undef SET_INT64 |
| 859 #undef SET_INT64_REP | 859 #undef SET_INT64_REP |
| 860 #undef SET_STR | 860 #undef SET_STR |
| 861 #undef SET_STR_REP | 861 #undef SET_STR_REP |
| 862 | 862 |
| 863 #undef SET_FIELD | 863 #undef SET_FIELD |
| 864 | 864 |
| 865 } // namespace syncer | 865 } // namespace syncer |
| OLD | NEW |