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