Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: sync/protocol/proto_value_conversions.cc

Issue 12089103: [Sync] Add favicon datatype proto support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/dictionary_specifics.pb.h" 19 #include "sync/protocol/dictionary_specifics.pb.h"
20 #include "sync/protocol/encryption.pb.h" 20 #include "sync/protocol/encryption.pb.h"
21 #include "sync/protocol/experiments_specifics.pb.h" 21 #include "sync/protocol/experiments_specifics.pb.h"
22 #include "sync/protocol/extension_setting_specifics.pb.h" 22 #include "sync/protocol/extension_setting_specifics.pb.h"
23 #include "sync/protocol/extension_specifics.pb.h" 23 #include "sync/protocol/extension_specifics.pb.h"
24 #include "sync/protocol/favicon_image_specifics.pb.h"
25 #include "sync/protocol/favicon_tracking_specifics.pb.h"
24 #include "sync/protocol/history_delete_directive_specifics.pb.h" 26 #include "sync/protocol/history_delete_directive_specifics.pb.h"
25 #include "sync/protocol/nigori_specifics.pb.h" 27 #include "sync/protocol/nigori_specifics.pb.h"
26 #include "sync/protocol/password_specifics.pb.h" 28 #include "sync/protocol/password_specifics.pb.h"
27 #include "sync/protocol/preference_specifics.pb.h" 29 #include "sync/protocol/preference_specifics.pb.h"
28 #include "sync/protocol/priority_preference_specifics.pb.h" 30 #include "sync/protocol/priority_preference_specifics.pb.h"
29 #include "sync/protocol/proto_enum_conversions.h" 31 #include "sync/protocol/proto_enum_conversions.h"
30 #include "sync/protocol/search_engine_specifics.pb.h" 32 #include "sync/protocol/search_engine_specifics.pb.h"
31 #include "sync/protocol/session_specifics.pb.h" 33 #include "sync/protocol/session_specifics.pb.h"
32 #include "sync/protocol/sync.pb.h" 34 #include "sync/protocol/sync.pb.h"
33 #include "sync/protocol/synced_notification_specifics.pb.h" 35 #include "sync/protocol/synced_notification_specifics.pb.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 DictionaryValue* value = new DictionaryValue(); 352 DictionaryValue* value = new DictionaryValue();
351 SET_STR(id); 353 SET_STR(id);
352 SET_STR(version); 354 SET_STR(version);
353 SET_STR(update_url); 355 SET_STR(update_url);
354 SET_BOOL(enabled); 356 SET_BOOL(enabled);
355 SET_BOOL(incognito_enabled); 357 SET_BOOL(incognito_enabled);
356 SET_STR(name); 358 SET_STR(name);
357 return value; 359 return value;
358 } 360 }
359 361
362 namespace {
363 DictionaryValue* FaviconDataToValue(
364 const sync_pb::FaviconData& proto) {
365 DictionaryValue* value = new DictionaryValue();
366 SET_BYTES(favicon);
367 SET_INT32(width);
368 SET_INT32(height);
369 return value;
370 }
371 } // namespace
372
373 DictionaryValue* FaviconImageSpecificsToValue(
374 const sync_pb::FaviconImageSpecifics& proto) {
375 DictionaryValue* value = new DictionaryValue();
376 SET_STR(favicon_url);
377 SET(favicon_web, FaviconDataToValue);
378 SET(favicon_web_32, FaviconDataToValue);
379 SET(favicon_touch_64, FaviconDataToValue);
380 SET(favicon_touch_precomposed_64, FaviconDataToValue);
381 return value;
382 }
383
384 DictionaryValue* FaviconTrackingSpecificsToValue(
385 const sync_pb::FaviconTrackingSpecifics& proto) {
386 DictionaryValue* value = new DictionaryValue();
387 SET_STR(favicon_url);
388 SET_INT64(last_visit_time_ms)
389 SET_BOOL(is_bookmarked);
390 return value;
391 }
392
360 base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue( 393 base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue(
361 const sync_pb::HistoryDeleteDirectiveSpecifics& proto) { 394 const sync_pb::HistoryDeleteDirectiveSpecifics& proto) {
362 DictionaryValue* value = new DictionaryValue(); 395 DictionaryValue* value = new DictionaryValue();
363 SET(global_id_directive, GlobalIdDirectiveToValue); 396 SET(global_id_directive, GlobalIdDirectiveToValue);
364 SET(time_range_directive, TimeRangeDirectiveToValue); 397 SET(time_range_directive, TimeRangeDirectiveToValue);
365 return value; 398 return value;
366 } 399 }
367 400
368 DictionaryValue* NigoriSpecificsToValue( 401 DictionaryValue* NigoriSpecificsToValue(
369 const sync_pb::NigoriSpecifics& proto) { 402 const sync_pb::NigoriSpecifics& proto) {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 #undef SET_BYTES 781 #undef SET_BYTES
749 #undef SET_INT32 782 #undef SET_INT32
750 #undef SET_INT64 783 #undef SET_INT64
751 #undef SET_INT64_REP 784 #undef SET_INT64_REP
752 #undef SET_STR 785 #undef SET_STR
753 #undef SET_STR_REP 786 #undef SET_STR_REP
754 787
755 #undef SET_FIELD 788 #undef SET_FIELD
756 789
757 } // namespace syncer 790 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/protocol/proto_value_conversions.h ('k') | sync/protocol/proto_value_conversions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698