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

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

Issue 11441005: Create a fresh sync datatype for Synced Notifications (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: CR changes - name change for Daniel, Fred's CR fixes Created 8 years 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
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 10 matching lines...) Expand all
21 #include "sync/protocol/extension_setting_specifics.pb.h" 21 #include "sync/protocol/extension_setting_specifics.pb.h"
22 #include "sync/protocol/extension_specifics.pb.h" 22 #include "sync/protocol/extension_specifics.pb.h"
23 #include "sync/protocol/history_delete_directive_specifics.pb.h" 23 #include "sync/protocol/history_delete_directive_specifics.pb.h"
24 #include "sync/protocol/nigori_specifics.pb.h" 24 #include "sync/protocol/nigori_specifics.pb.h"
25 #include "sync/protocol/password_specifics.pb.h" 25 #include "sync/protocol/password_specifics.pb.h"
26 #include "sync/protocol/preference_specifics.pb.h" 26 #include "sync/protocol/preference_specifics.pb.h"
27 #include "sync/protocol/proto_enum_conversions.h" 27 #include "sync/protocol/proto_enum_conversions.h"
28 #include "sync/protocol/search_engine_specifics.pb.h" 28 #include "sync/protocol/search_engine_specifics.pb.h"
29 #include "sync/protocol/session_specifics.pb.h" 29 #include "sync/protocol/session_specifics.pb.h"
30 #include "sync/protocol/sync.pb.h" 30 #include "sync/protocol/sync.pb.h"
31 #include "sync/protocol/synced_notifications_specifics.pb.h"
31 #include "sync/protocol/theme_specifics.pb.h" 32 #include "sync/protocol/theme_specifics.pb.h"
32 #include "sync/protocol/typed_url_specifics.pb.h" 33 #include "sync/protocol/typed_url_specifics.pb.h"
33 34
34 namespace syncer { 35 namespace syncer {
35 36
36 namespace { 37 namespace {
37 38
38 // Basic Type -> Value functions. 39 // Basic Type -> Value functions.
39 40
40 StringValue* MakeInt64Value(int64 x) { 41 StringValue* MakeInt64Value(int64 x) {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 213 }
213 214
214 base::DictionaryValue* TimeRangeDirectiveToValue( 215 base::DictionaryValue* TimeRangeDirectiveToValue(
215 const sync_pb::TimeRangeDirective& proto) { 216 const sync_pb::TimeRangeDirective& proto) {
216 DictionaryValue* value = new DictionaryValue(); 217 DictionaryValue* value = new DictionaryValue();
217 SET_INT64(start_time_usec); 218 SET_INT64(start_time_usec);
218 SET_INT64(end_time_usec); 219 SET_INT64(end_time_usec);
219 return value; 220 return value;
220 } 221 }
221 222
223 // TODO(petewil): I will need new functions here for the SyncedNotifications
224 // subtypes.
225
222 DictionaryValue* AppNotificationToValue( 226 DictionaryValue* AppNotificationToValue(
223 const sync_pb::AppNotification& proto) { 227 const sync_pb::AppNotification& proto) {
224 DictionaryValue* value = new DictionaryValue(); 228 DictionaryValue* value = new DictionaryValue();
225 SET_STR(guid); 229 SET_STR(guid);
226 SET_STR(app_id); 230 SET_STR(app_id);
227 SET_INT64(creation_timestamp_ms); 231 SET_INT64(creation_timestamp_ms);
228 SET_STR(title); 232 SET_STR(title);
229 SET_STR(body_text); 233 SET_STR(body_text);
230 SET_STR(link_url); 234 SET_STR(link_url);
231 SET_STR(link_text); 235 SET_STR(link_text);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 379 }
376 380
377 DictionaryValue* PreferenceSpecificsToValue( 381 DictionaryValue* PreferenceSpecificsToValue(
378 const sync_pb::PreferenceSpecifics& proto) { 382 const sync_pb::PreferenceSpecifics& proto) {
379 DictionaryValue* value = new DictionaryValue(); 383 DictionaryValue* value = new DictionaryValue();
380 SET_STR(name); 384 SET_STR(name);
381 SET_STR(value); 385 SET_STR(value);
382 return value; 386 return value;
383 } 387 }
384 388
389
Nicolas Zea 2012/12/12 23:56:00 nit: remove extra newlines around this method.
390 DictionaryValue* SyncedNotificationsSpecificsToValue(
391 const sync_pb::SyncedNotificationsSpecifics& proto) {
392 DictionaryValue* value = new DictionaryValue();
393 // TODO(petewil): Adjust this once we add actual types in protobuf.
394 SET_STR(name);
395 SET_STR(value);
396 return value;
397 }
398
399
385 DictionaryValue* SearchEngineSpecificsToValue( 400 DictionaryValue* SearchEngineSpecificsToValue(
386 const sync_pb::SearchEngineSpecifics& proto) { 401 const sync_pb::SearchEngineSpecifics& proto) {
387 DictionaryValue* value = new DictionaryValue(); 402 DictionaryValue* value = new DictionaryValue();
388 SET_STR(short_name); 403 SET_STR(short_name);
389 SET_STR(keyword); 404 SET_STR(keyword);
390 SET_STR(favicon_url); 405 SET_STR(favicon_url);
391 SET_STR(url); 406 SET_STR(url);
392 SET_BOOL(safe_for_autoreplace); 407 SET_BOOL(safe_for_autoreplace);
393 SET_STR(originating_url); 408 SET_STR(originating_url);
394 SET_INT64(date_created); 409 SET_INT64(date_created);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 SET_FIELD(device_info, DeviceInfoSpecificsToValue); 463 SET_FIELD(device_info, DeviceInfoSpecificsToValue);
449 SET_FIELD(experiments, ExperimentsSpecificsToValue); 464 SET_FIELD(experiments, ExperimentsSpecificsToValue);
450 SET_FIELD(extension, ExtensionSpecificsToValue); 465 SET_FIELD(extension, ExtensionSpecificsToValue);
451 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); 466 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue);
452 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); 467 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue);
453 SET_FIELD(nigori, NigoriSpecificsToValue); 468 SET_FIELD(nigori, NigoriSpecificsToValue);
454 SET_FIELD(password, PasswordSpecificsToValue); 469 SET_FIELD(password, PasswordSpecificsToValue);
455 SET_FIELD(preference, PreferenceSpecificsToValue); 470 SET_FIELD(preference, PreferenceSpecificsToValue);
456 SET_FIELD(search_engine, SearchEngineSpecificsToValue); 471 SET_FIELD(search_engine, SearchEngineSpecificsToValue);
457 SET_FIELD(session, SessionSpecificsToValue); 472 SET_FIELD(session, SessionSpecificsToValue);
473 SET_FIELD(synced_notifications, SyncedNotificationsSpecificsToValue);
458 SET_FIELD(theme, ThemeSpecificsToValue); 474 SET_FIELD(theme, ThemeSpecificsToValue);
459 SET_FIELD(typed_url, TypedUrlSpecificsToValue); 475 SET_FIELD(typed_url, TypedUrlSpecificsToValue);
460 return value; 476 return value;
461 } 477 }
462 478
463 namespace { 479 namespace {
464 480
465 DictionaryValue* SyncEntityToValue(const sync_pb::SyncEntity& proto, 481 DictionaryValue* SyncEntityToValue(const sync_pb::SyncEntity& proto,
466 bool include_specifics) { 482 bool include_specifics) {
467 DictionaryValue* value = new DictionaryValue(); 483 DictionaryValue* value = new DictionaryValue();
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 #undef SET_BYTES 720 #undef SET_BYTES
705 #undef SET_INT32 721 #undef SET_INT32
706 #undef SET_INT64 722 #undef SET_INT64
707 #undef SET_INT64_REP 723 #undef SET_INT64_REP
708 #undef SET_STR 724 #undef SET_STR
709 #undef SET_STR_REP 725 #undef SET_STR_REP
710 726
711 #undef SET_FIELD 727 #undef SET_FIELD
712 728
713 } // namespace syncer 729 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698