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

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: Fix merge conflict in prolto_value_conversions.h Created 7 years, 11 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
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_notification_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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 214 }
214 215
215 base::DictionaryValue* TimeRangeDirectiveToValue( 216 base::DictionaryValue* TimeRangeDirectiveToValue(
216 const sync_pb::TimeRangeDirective& proto) { 217 const sync_pb::TimeRangeDirective& proto) {
217 DictionaryValue* value = new DictionaryValue(); 218 DictionaryValue* value = new DictionaryValue();
218 SET_INT64(start_time_usec); 219 SET_INT64(start_time_usec);
219 SET_INT64(end_time_usec); 220 SET_INT64(end_time_usec);
220 return value; 221 return value;
221 } 222 }
222 223
224 // TODO(petewil): I will need new functions here for the SyncedNotifications
225 // subtypes.
226
223 DictionaryValue* AppNotificationToValue( 227 DictionaryValue* AppNotificationToValue(
224 const sync_pb::AppNotification& proto) { 228 const sync_pb::AppNotification& proto) {
225 DictionaryValue* value = new DictionaryValue(); 229 DictionaryValue* value = new DictionaryValue();
226 SET_STR(guid); 230 SET_STR(guid);
227 SET_STR(app_id); 231 SET_STR(app_id);
228 SET_INT64(creation_timestamp_ms); 232 SET_INT64(creation_timestamp_ms);
229 SET_STR(title); 233 SET_STR(title);
230 SET_STR(body_text); 234 SET_STR(body_text);
231 SET_STR(link_url); 235 SET_STR(link_url);
232 SET_STR(link_text); 236 SET_STR(link_text);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 380 }
377 381
378 DictionaryValue* PreferenceSpecificsToValue( 382 DictionaryValue* PreferenceSpecificsToValue(
379 const sync_pb::PreferenceSpecifics& proto) { 383 const sync_pb::PreferenceSpecifics& proto) {
380 DictionaryValue* value = new DictionaryValue(); 384 DictionaryValue* value = new DictionaryValue();
381 SET_STR(name); 385 SET_STR(name);
382 SET_STR(value); 386 SET_STR(value);
383 return value; 387 return value;
384 } 388 }
385 389
390 DictionaryValue* SyncedNotificationSpecificsToValue(
391 const sync_pb::SyncedNotificationSpecifics& proto) {
392 DictionaryValue* value = new DictionaryValue();
393 // TODO(petewil): Adjust this once we add actual types in protobuf.
394 return value;
395 }
396
386 DictionaryValue* SearchEngineSpecificsToValue( 397 DictionaryValue* SearchEngineSpecificsToValue(
387 const sync_pb::SearchEngineSpecifics& proto) { 398 const sync_pb::SearchEngineSpecifics& proto) {
388 DictionaryValue* value = new DictionaryValue(); 399 DictionaryValue* value = new DictionaryValue();
389 SET_STR(short_name); 400 SET_STR(short_name);
390 SET_STR(keyword); 401 SET_STR(keyword);
391 SET_STR(favicon_url); 402 SET_STR(favicon_url);
392 SET_STR(url); 403 SET_STR(url);
393 SET_BOOL(safe_for_autoreplace); 404 SET_BOOL(safe_for_autoreplace);
394 SET_STR(originating_url); 405 SET_STR(originating_url);
395 SET_INT64(date_created); 406 SET_INT64(date_created);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 SET_FIELD(device_info, DeviceInfoSpecificsToValue); 460 SET_FIELD(device_info, DeviceInfoSpecificsToValue);
450 SET_FIELD(experiments, ExperimentsSpecificsToValue); 461 SET_FIELD(experiments, ExperimentsSpecificsToValue);
451 SET_FIELD(extension, ExtensionSpecificsToValue); 462 SET_FIELD(extension, ExtensionSpecificsToValue);
452 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); 463 SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue);
453 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); 464 SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue);
454 SET_FIELD(nigori, NigoriSpecificsToValue); 465 SET_FIELD(nigori, NigoriSpecificsToValue);
455 SET_FIELD(password, PasswordSpecificsToValue); 466 SET_FIELD(password, PasswordSpecificsToValue);
456 SET_FIELD(preference, PreferenceSpecificsToValue); 467 SET_FIELD(preference, PreferenceSpecificsToValue);
457 SET_FIELD(search_engine, SearchEngineSpecificsToValue); 468 SET_FIELD(search_engine, SearchEngineSpecificsToValue);
458 SET_FIELD(session, SessionSpecificsToValue); 469 SET_FIELD(session, SessionSpecificsToValue);
470 SET_FIELD(synced_notification, SyncedNotificationSpecificsToValue);
459 SET_FIELD(theme, ThemeSpecificsToValue); 471 SET_FIELD(theme, ThemeSpecificsToValue);
460 SET_FIELD(typed_url, TypedUrlSpecificsToValue); 472 SET_FIELD(typed_url, TypedUrlSpecificsToValue);
461 return value; 473 return value;
462 } 474 }
463 475
464 namespace { 476 namespace {
465 477
466 DictionaryValue* SyncEntityToValue(const sync_pb::SyncEntity& proto, 478 DictionaryValue* SyncEntityToValue(const sync_pb::SyncEntity& proto,
467 bool include_specifics) { 479 bool include_specifics) {
468 DictionaryValue* value = new DictionaryValue(); 480 DictionaryValue* value = new DictionaryValue();
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 #undef SET_BYTES 717 #undef SET_BYTES
706 #undef SET_INT32 718 #undef SET_INT32
707 #undef SET_INT64 719 #undef SET_INT64
708 #undef SET_INT64_REP 720 #undef SET_INT64_REP
709 #undef SET_STR 721 #undef SET_STR
710 #undef SET_STR_REP 722 #undef SET_STR_REP
711 723
712 #undef SET_FIELD 724 #undef SET_FIELD
713 725
714 } // namespace syncer 726 } // 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