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

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

Issue 12700016: [Sync] Add favicon sync experiment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 7 years, 9 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
« no previous file with comments | « sync/protocol/experiments_specifics.proto ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #define SET_INT64(field) SET(field, MakeInt64Value) 98 #define SET_INT64(field) SET(field, MakeInt64Value)
99 #define SET_INT64_REP(field) SET_REP(field, MakeInt64Value) 99 #define SET_INT64_REP(field) SET_REP(field, MakeInt64Value)
100 #define SET_STR(field) SET(field, new base::StringValue) 100 #define SET_STR(field) SET(field, new base::StringValue)
101 #define SET_STR_REP(field) \ 101 #define SET_STR_REP(field) \
102 value->Set(#field, \ 102 value->Set(#field, \
103 MakeRepeatedValue<const std::string&, \ 103 MakeRepeatedValue<const std::string&, \
104 google::protobuf::RepeatedPtrField< \ 104 google::protobuf::RepeatedPtrField< \
105 std::string >, \ 105 std::string >, \
106 base::StringValue>(proto.field(), \ 106 base::StringValue>(proto.field(), \
107 MakeStringValue)) 107 MakeStringValue))
108 #define SET_EXPERIMENT_ENABLED_FIELD(field) \
109 do { \
110 if (proto.has_##field() && \
111 proto.field().has_enabled()) { \
rlarocque 2013/03/18 18:48:11 nit: align slashes.
Nicolas Zea 2013/03/18 19:12:18 Done.
112 value->Set(#field, \
113 new base::FundamentalValue( \
114 proto.field().enabled())); \
115 } \
116 } while (0)
108 117
109 #define SET_FIELD(field, fn) \ 118 #define SET_FIELD(field, fn) \
110 do { \ 119 do { \
111 if (specifics.has_##field()) { \ 120 if (specifics.has_##field()) { \
112 value->Set(#field, fn(specifics.field())); \ 121 value->Set(#field, fn(specifics.field())); \
113 } \ 122 } \
114 } while (0) 123 } while (0)
115 124
116 // If you add another macro, don't forget to add an #undef at the end 125 // If you add another macro, don't forget to add an #undef at the end
117 // of this file, too. 126 // of this file, too.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 SET_STR(username_value); 210 SET_STR(username_value);
202 SET_STR(password_element); 211 SET_STR(password_element);
203 value->SetString("password_value", "<redacted>"); 212 value->SetString("password_value", "<redacted>");
204 SET_BOOL(ssl_valid); 213 SET_BOOL(ssl_valid);
205 SET_BOOL(preferred); 214 SET_BOOL(preferred);
206 SET_INT64(date_created); 215 SET_INT64(date_created);
207 SET_BOOL(blacklisted); 216 SET_BOOL(blacklisted);
208 return value; 217 return value;
209 } 218 }
210 219
211 base::DictionaryValue* KeystoreEncryptionFlagsToValue(
212 const sync_pb::KeystoreEncryptionFlags& proto) {
213 base::DictionaryValue* value = new base::DictionaryValue();
214 SET_BOOL(enabled);
215 return value;
216 }
217
218 base::DictionaryValue* GlobalIdDirectiveToValue( 220 base::DictionaryValue* GlobalIdDirectiveToValue(
219 const sync_pb::GlobalIdDirective& proto) { 221 const sync_pb::GlobalIdDirective& proto) {
220 base::DictionaryValue* value = new base::DictionaryValue(); 222 base::DictionaryValue* value = new base::DictionaryValue();
221 SET_INT64_REP(global_id); 223 SET_INT64_REP(global_id);
222 SET_INT64(start_time_usec); 224 SET_INT64(start_time_usec);
223 SET_INT64(end_time_usec); 225 SET_INT64(end_time_usec);
224 return value; 226 return value;
225 } 227 }
226 228
227 base::DictionaryValue* TimeRangeDirectiveToValue( 229 base::DictionaryValue* TimeRangeDirectiveToValue(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 base::DictionaryValue* DictionarySpecificsToValue( 334 base::DictionaryValue* DictionarySpecificsToValue(
333 const sync_pb::DictionarySpecifics& proto) { 335 const sync_pb::DictionarySpecifics& proto) {
334 base::DictionaryValue* value = new base::DictionaryValue(); 336 base::DictionaryValue* value = new base::DictionaryValue();
335 SET_STR(word); 337 SET_STR(word);
336 return value; 338 return value;
337 } 339 }
338 340
339 base::DictionaryValue* ExperimentsSpecificsToValue( 341 base::DictionaryValue* ExperimentsSpecificsToValue(
340 const sync_pb::ExperimentsSpecifics& proto) { 342 const sync_pb::ExperimentsSpecifics& proto) {
341 base::DictionaryValue* value = new base::DictionaryValue(); 343 base::DictionaryValue* value = new base::DictionaryValue();
342 SET(keystore_encryption, KeystoreEncryptionFlagsToValue); 344 SET_EXPERIMENT_ENABLED_FIELD(keystore_encryption);
345 SET_EXPERIMENT_ENABLED_FIELD(history_delete_directives);
346 SET_EXPERIMENT_ENABLED_FIELD(autofill_culling);
347 SET_EXPERIMENT_ENABLED_FIELD(favicon_sync);
343 return value; 348 return value;
344 } 349 }
345 350
346 base::DictionaryValue* ExtensionSettingSpecificsToValue( 351 base::DictionaryValue* ExtensionSettingSpecificsToValue(
347 const sync_pb::ExtensionSettingSpecifics& proto) { 352 const sync_pb::ExtensionSettingSpecifics& proto) {
348 base::DictionaryValue* value = new base::DictionaryValue(); 353 base::DictionaryValue* value = new base::DictionaryValue();
349 SET_STR(extension_id); 354 SET_STR(extension_id);
350 SET_STR(key); 355 SET_STR(key);
351 SET_STR(value); 356 SET_STR(value);
352 return value; 357 return value;
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 #undef SET_BYTES 795 #undef SET_BYTES
791 #undef SET_INT32 796 #undef SET_INT32
792 #undef SET_INT64 797 #undef SET_INT64
793 #undef SET_INT64_REP 798 #undef SET_INT64_REP
794 #undef SET_STR 799 #undef SET_STR
795 #undef SET_STR_REP 800 #undef SET_STR_REP
796 801
797 #undef SET_FIELD 802 #undef SET_FIELD
798 803
799 } // namespace syncer 804 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/protocol/experiments_specifics.proto ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698