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

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: Update 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_specifics.pb.h"
24 #include "sync/protocol/history_delete_directive_specifics.pb.h" 25 #include "sync/protocol/history_delete_directive_specifics.pb.h"
25 #include "sync/protocol/nigori_specifics.pb.h" 26 #include "sync/protocol/nigori_specifics.pb.h"
26 #include "sync/protocol/password_specifics.pb.h" 27 #include "sync/protocol/password_specifics.pb.h"
27 #include "sync/protocol/preference_specifics.pb.h" 28 #include "sync/protocol/preference_specifics.pb.h"
28 #include "sync/protocol/priority_preference_specifics.pb.h" 29 #include "sync/protocol/priority_preference_specifics.pb.h"
29 #include "sync/protocol/proto_enum_conversions.h" 30 #include "sync/protocol/proto_enum_conversions.h"
30 #include "sync/protocol/search_engine_specifics.pb.h" 31 #include "sync/protocol/search_engine_specifics.pb.h"
31 #include "sync/protocol/session_specifics.pb.h" 32 #include "sync/protocol/session_specifics.pb.h"
32 #include "sync/protocol/sync.pb.h" 33 #include "sync/protocol/sync.pb.h"
33 #include "sync/protocol/synced_notification_specifics.pb.h" 34 #include "sync/protocol/synced_notification_specifics.pb.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 DictionaryValue* value = new DictionaryValue(); 349 DictionaryValue* value = new DictionaryValue();
349 SET_STR(id); 350 SET_STR(id);
350 SET_STR(version); 351 SET_STR(version);
351 SET_STR(update_url); 352 SET_STR(update_url);
352 SET_BOOL(enabled); 353 SET_BOOL(enabled);
353 SET_BOOL(incognito_enabled); 354 SET_BOOL(incognito_enabled);
354 SET_STR(name); 355 SET_STR(name);
355 return value; 356 return value;
356 } 357 }
357 358
359 DictionaryValue* FaviconDataToValue(
pkotwicz 2013/02/07 02:15:47 Nit: put this method into an anonymous namespace?
360 const sync_pb::FaviconData& proto) {
361 DictionaryValue* value = new DictionaryValue();
362 SET_BYTES(favicon);
363 SET_ENUM(icon_type, GetIconTypeString);
364 SET_INT32(width);
365 return value;
366 }
367
368 DictionaryValue* FaviconSpecificsToValue(
369 const sync_pb::FaviconSpecifics& proto) {
370 DictionaryValue* value = new DictionaryValue();
371 SET_STR(favicon_source);
372 SET_REP(favicons, FaviconDataToValue);
373 SET_INT64(last_visit_time_ms);
374 SET_BOOL(is_bookmarked);
375 return value;
376 }
377
358 base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue( 378 base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue(
359 const sync_pb::HistoryDeleteDirectiveSpecifics& proto) { 379 const sync_pb::HistoryDeleteDirectiveSpecifics& proto) {
360 DictionaryValue* value = new DictionaryValue(); 380 DictionaryValue* value = new DictionaryValue();
361 SET(global_id_directive, GlobalIdDirectiveToValue); 381 SET(global_id_directive, GlobalIdDirectiveToValue);
362 SET(time_range_directive, TimeRangeDirectiveToValue); 382 SET(time_range_directive, TimeRangeDirectiveToValue);
363 return value; 383 return value;
364 } 384 }
365 385
366 DictionaryValue* NigoriSpecificsToValue( 386 DictionaryValue* NigoriSpecificsToValue(
367 const sync_pb::NigoriSpecifics& proto) { 387 const sync_pb::NigoriSpecifics& proto) {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 #undef SET_BYTES 766 #undef SET_BYTES
747 #undef SET_INT32 767 #undef SET_INT32
748 #undef SET_INT64 768 #undef SET_INT64
749 #undef SET_INT64_REP 769 #undef SET_INT64_REP
750 #undef SET_STR 770 #undef SET_STR
751 #undef SET_STR_REP 771 #undef SET_STR_REP
752 772
753 #undef SET_FIELD 773 #undef SET_FIELD
754 774
755 } // namespace syncer 775 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698