diff options
Diffstat (limited to 'chrome/browser/sync/protocol')
19 files changed, 102 insertions, 134 deletions
diff --git a/chrome/browser/sync/protocol/app_notification_specifics.proto b/chrome/browser/sync/protocol/app_notification_specifics.proto index 46d0426..58436c7 100644 --- a/chrome/browser/sync/protocol/app_notification_specifics.proto +++ b/chrome/browser/sync/protocol/app_notification_specifics.proto @@ -14,8 +14,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; - // Properties of an app notification. // An App Notification, to be delivered from Chrome Apps to the @@ -44,6 +42,3 @@ message AppNotification { optional string link_text = 7; } -extend EntitySpecifics { - optional AppNotification app_notification = 45184; -} diff --git a/chrome/browser/sync/protocol/app_setting_specifics.proto b/chrome/browser/sync/protocol/app_setting_specifics.proto index 0d9e25d..d936c66 100644 --- a/chrome/browser/sync/protocol/app_setting_specifics.proto +++ b/chrome/browser/sync/protocol/app_setting_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -16,7 +16,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; import "extension_setting_specifics.proto"; // Properties of app setting sync objects; just an extension setting. @@ -24,6 +23,3 @@ message AppSettingSpecifics { optional ExtensionSettingSpecifics extension_setting = 1; } -extend EntitySpecifics { - optional AppSettingSpecifics app_setting = 103656; -} diff --git a/chrome/browser/sync/protocol/app_specifics.proto b/chrome/browser/sync/protocol/app_specifics.proto index 3a5e438..a7f09ec 100644 --- a/chrome/browser/sync/protocol/app_specifics.proto +++ b/chrome/browser/sync/protocol/app_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -14,7 +14,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; import "extension_specifics.proto"; // Settings related to push notifications for apps. @@ -59,6 +58,3 @@ message AppSpecifics { optional string page_ordinal = 4; } -extend EntitySpecifics { - optional AppSpecifics app = 48364; -} diff --git a/chrome/browser/sync/protocol/autofill_specifics.proto b/chrome/browser/sync/protocol/autofill_specifics.proto index 0e9aded..ac7bc51 100644 --- a/chrome/browser/sync/protocol/autofill_specifics.proto +++ b/chrome/browser/sync/protocol/autofill_specifics.proto @@ -14,8 +14,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; - // Properties of autofill sync objects. // An AutofillProfile. @@ -65,7 +63,3 @@ message AutofillSpecifics { // optional AutofillCreditCardSpecifics deprecated_credit_card = 6; } -extend EntitySpecifics { - optional AutofillSpecifics autofill = 31729; - optional AutofillProfileSpecifics autofill_profile = 63951; -} diff --git a/chrome/browser/sync/protocol/bookmark_specifics.proto b/chrome/browser/sync/protocol/bookmark_specifics.proto index 83b1693..c177511 100644 --- a/chrome/browser/sync/protocol/bookmark_specifics.proto +++ b/chrome/browser/sync/protocol/bookmark_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -14,8 +14,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; - // Properties of bookmark sync objects. message BookmarkSpecifics { optional string url = 1; @@ -23,6 +21,3 @@ message BookmarkSpecifics { optional string title = 3; } -extend EntitySpecifics { - optional BookmarkSpecifics bookmark = 32904; -} diff --git a/chrome/browser/sync/protocol/extension_setting_specifics.proto b/chrome/browser/sync/protocol/extension_setting_specifics.proto index ff9f029..62947c5 100644 --- a/chrome/browser/sync/protocol/extension_setting_specifics.proto +++ b/chrome/browser/sync/protocol/extension_setting_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -14,8 +14,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; - // Properties of extension setting sync objects. message ExtensionSettingSpecifics { // Id of the extension the setting is for. @@ -28,6 +26,3 @@ message ExtensionSettingSpecifics { optional string value = 3; } -extend EntitySpecifics { - optional ExtensionSettingSpecifics extension_setting = 96159; -} diff --git a/chrome/browser/sync/protocol/extension_specifics.proto b/chrome/browser/sync/protocol/extension_specifics.proto index 25b98a0..e3e1dfb 100644 --- a/chrome/browser/sync/protocol/extension_specifics.proto +++ b/chrome/browser/sync/protocol/extension_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -14,8 +14,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; - // Properties of extension sync objects. // // Merge policy: the settings for the higher version number win; in @@ -39,6 +37,3 @@ message ExtensionSpecifics { optional string name = 6; } -extend EntitySpecifics { - optional ExtensionSpecifics extension = 48119; -} diff --git a/chrome/browser/sync/protocol/nigori_specifics.proto b/chrome/browser/sync/protocol/nigori_specifics.proto index 1655223..50f5014 100644 --- a/chrome/browser/sync/protocol/nigori_specifics.proto +++ b/chrome/browser/sync/protocol/nigori_specifics.proto @@ -15,7 +15,6 @@ option retain_unknown_fields = true; package sync_pb; import "encryption.proto"; -import "sync.proto"; message NigoriKey { optional string name = 1; @@ -93,6 +92,3 @@ message NigoriSpecifics { repeated DeviceInformation device_information = 28; } -extend EntitySpecifics { - optional NigoriSpecifics nigori = 47745; -} diff --git a/chrome/browser/sync/protocol/password_specifics.proto b/chrome/browser/sync/protocol/password_specifics.proto index 49f1343..769914433 100644 --- a/chrome/browser/sync/protocol/password_specifics.proto +++ b/chrome/browser/sync/protocol/password_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -15,7 +15,6 @@ option retain_unknown_fields = true; package sync_pb; import "encryption.proto"; -import "sync.proto"; // These are the properties that get serialized into the |encrypted| field of // PasswordSpecifics. @@ -40,6 +39,3 @@ message PasswordSpecifics { optional EncryptedData encrypted = 1; } -extend EntitySpecifics { - optional PasswordSpecifics password = 45873; -} diff --git a/chrome/browser/sync/protocol/preference_specifics.proto b/chrome/browser/sync/protocol/preference_specifics.proto index 72bc375..4827c5d 100644 --- a/chrome/browser/sync/protocol/preference_specifics.proto +++ b/chrome/browser/sync/protocol/preference_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -14,14 +14,9 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; - // Properties of preference sync objects. message PreferenceSpecifics { optional string name = 1; optional string value = 2; } -extend EntitySpecifics { - optional PreferenceSpecifics preference = 37702; -} diff --git a/chrome/browser/sync/protocol/proto_enum_conversions.h b/chrome/browser/sync/protocol/proto_enum_conversions.h index 47e4772..7722f92 100644 --- a/chrome/browser/sync/protocol/proto_enum_conversions.h +++ b/chrome/browser/sync/protocol/proto_enum_conversions.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,7 @@ // Keep this file in sync with the .proto files in this directory. #include "chrome/browser/sync/protocol/session_specifics.pb.h" +#include "chrome/browser/sync/protocol/sync.pb.h" // Utility functions to get the string equivalent for some sync proto // enums. diff --git a/chrome/browser/sync/protocol/proto_value_conversions.cc b/chrome/browser/sync/protocol/proto_value_conversions.cc index 3885fc2..86b632e 100644 --- a/chrome/browser/sync/protocol/proto_value_conversions.cc +++ b/chrome/browser/sync/protocol/proto_value_conversions.cc @@ -92,11 +92,11 @@ ListValue* MakeRepeatedValue(const F& fields, V* (*converter_fn)(T)) { StringValue>(proto.field(), \ Value::CreateStringValue)) -#define SET_EXTENSION(ns, field, fn) \ - do { \ - if (specifics.HasExtension(ns::field)) { \ - value->Set(#field, fn(specifics.GetExtension(ns::field))); \ - } \ +#define SET_FIELD(field, fn) \ + do { \ + if (specifics.has_##field()) { \ + value->Set(#field, fn(specifics.field())); \ + } \ } while (0) // If you add another macro, don't forget to add an #undef at the end @@ -379,21 +379,21 @@ DictionaryValue* TypedUrlSpecificsToValue( DictionaryValue* EntitySpecificsToValue( const sync_pb::EntitySpecifics& specifics) { DictionaryValue* value = new DictionaryValue(); - SET_EXTENSION(sync_pb, app, AppSpecificsToValue); - SET_EXTENSION(sync_pb, app_notification, AppNotificationToValue); - SET_EXTENSION(sync_pb, app_setting, AppSettingSpecificsToValue); - SET_EXTENSION(sync_pb, autofill, AutofillSpecificsToValue); - SET_EXTENSION(sync_pb, autofill_profile, AutofillProfileSpecificsToValue); - SET_EXTENSION(sync_pb, bookmark, BookmarkSpecificsToValue); - SET_EXTENSION(sync_pb, extension, ExtensionSpecificsToValue); - SET_EXTENSION(sync_pb, extension_setting, ExtensionSettingSpecificsToValue); - SET_EXTENSION(sync_pb, nigori, NigoriSpecificsToValue); - SET_EXTENSION(sync_pb, password, PasswordSpecificsToValue); - SET_EXTENSION(sync_pb, preference, PreferenceSpecificsToValue); - SET_EXTENSION(sync_pb, search_engine, SearchEngineSpecificsToValue); - SET_EXTENSION(sync_pb, session, SessionSpecificsToValue); - SET_EXTENSION(sync_pb, theme, ThemeSpecificsToValue); - SET_EXTENSION(sync_pb, typed_url, TypedUrlSpecificsToValue); + SET_FIELD(app, AppSpecificsToValue); + SET_FIELD(app_notification, AppNotificationToValue); + SET_FIELD(app_setting, AppSettingSpecificsToValue); + SET_FIELD(autofill, AutofillSpecificsToValue); + SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue); + SET_FIELD(bookmark, BookmarkSpecificsToValue); + SET_FIELD(extension, ExtensionSpecificsToValue); + SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue); + SET_FIELD(nigori, NigoriSpecificsToValue); + SET_FIELD(password, PasswordSpecificsToValue); + SET_FIELD(preference, PreferenceSpecificsToValue); + SET_FIELD(search_engine, SearchEngineSpecificsToValue); + SET_FIELD(session, SessionSpecificsToValue); + SET_FIELD(theme, ThemeSpecificsToValue); + SET_FIELD(typed_url, TypedUrlSpecificsToValue); return value; } @@ -408,6 +408,6 @@ DictionaryValue* EntitySpecificsToValue( #undef SET_STR #undef SET_STR_REP -#undef SET_EXTENSION +#undef SET_FIELD } // namespace browser_sync diff --git a/chrome/browser/sync/protocol/proto_value_conversions.h b/chrome/browser/sync/protocol/proto_value_conversions.h index f15b06f..fb32326 100644 --- a/chrome/browser/sync/protocol/proto_value_conversions.h +++ b/chrome/browser/sync/protocol/proto_value_conversions.h @@ -135,7 +135,7 @@ base::DictionaryValue* TypedUrlSpecificsToValue( // Any present extensions are mapped to sub-dictionary values with the // key equal to the extension name. base::DictionaryValue* EntitySpecificsToValue( - const sync_pb::EntitySpecifics& entity_specifics); + const sync_pb::EntitySpecifics& specifics); } // namespace browser_sync diff --git a/chrome/browser/sync/protocol/proto_value_conversions_unittest.cc b/chrome/browser/sync/protocol/proto_value_conversions_unittest.cc index de61897..699ead8 100644 --- a/chrome/browser/sync/protocol/proto_value_conversions_unittest.cc +++ b/chrome/browser/sync/protocol/proto_value_conversions_unittest.cc @@ -162,25 +162,25 @@ TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) { sync_pb::EntitySpecifics specifics; // Touch the extensions to make sure it shows up in the generated // value. -#define SET_EXTENSION(key) (void)specifics.MutableExtension(sync_pb::key) - - SET_EXTENSION(app); - SET_EXTENSION(app_notification); - SET_EXTENSION(app_setting); - SET_EXTENSION(autofill); - SET_EXTENSION(autofill_profile); - SET_EXTENSION(bookmark); - SET_EXTENSION(extension); - SET_EXTENSION(extension_setting); - SET_EXTENSION(nigori); - SET_EXTENSION(password); - SET_EXTENSION(preference); - SET_EXTENSION(search_engine); - SET_EXTENSION(session); - SET_EXTENSION(theme); - SET_EXTENSION(typed_url); - -#undef SET_EXTENSION +#define SET_FIELD(key) (void)specifics.mutable_##key() + + SET_FIELD(app); + SET_FIELD(app_notification); + SET_FIELD(app_setting); + SET_FIELD(autofill); + SET_FIELD(autofill_profile); + SET_FIELD(bookmark); + SET_FIELD(extension); + SET_FIELD(extension_setting); + SET_FIELD(nigori); + SET_FIELD(password); + SET_FIELD(preference); + SET_FIELD(search_engine); + SET_FIELD(session); + SET_FIELD(theme); + SET_FIELD(typed_url); + +#undef SET_FIELD scoped_ptr<DictionaryValue> value(EntitySpecificsToValue(specifics)); EXPECT_EQ(syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE, diff --git a/chrome/browser/sync/protocol/search_engine_specifics.proto b/chrome/browser/sync/protocol/search_engine_specifics.proto index b593b1c..effaf99 100644 --- a/chrome/browser/sync/protocol/search_engine_specifics.proto +++ b/chrome/browser/sync/protocol/search_engine_specifics.proto @@ -14,8 +14,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; - // Properties of custom search engine sync objects. message SearchEngineSpecifics { // The description of the search engine. @@ -61,6 +59,3 @@ message SearchEngineSpecifics { optional string sync_guid = 18; } -extend EntitySpecifics { - optional SearchEngineSpecifics search_engine = 88610; -} diff --git a/chrome/browser/sync/protocol/session_specifics.proto b/chrome/browser/sync/protocol/session_specifics.proto index a4a94b3..9b59dd0 100644 --- a/chrome/browser/sync/protocol/session_specifics.proto +++ b/chrome/browser/sync/protocol/session_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -14,8 +14,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; - message SessionSpecifics { // Unique id for the client. optional string session_tag = 1; @@ -111,6 +109,3 @@ message TabNavigation { optional PageTransitionQualifier navigation_qualifier = 7; } -extend EntitySpecifics { - optional SessionSpecifics session = 50119; -} diff --git a/chrome/browser/sync/protocol/sync.proto b/chrome/browser/sync/protocol/sync.proto index bc866fe..d1aea72 100644 --- a/chrome/browser/sync/protocol/sync.proto +++ b/chrome/browser/sync/protocol/sync.proto @@ -14,6 +14,20 @@ option retain_unknown_fields = true; package sync_pb; +import "app_notification_specifics.proto"; +import "app_setting_specifics.proto"; +import "app_specifics.proto"; +import "autofill_specifics.proto"; +import "bookmark_specifics.proto"; +import "extension_setting_specifics.proto"; +import "extension_specifics.proto"; +import "nigori_specifics.proto"; +import "password_specifics.proto"; +import "preference_specifics.proto"; +import "search_engine_specifics.proto"; +import "session_specifics.proto"; +import "theme_specifics.proto"; +import "typed_url_specifics.proto"; import "encryption.proto"; import "sync_enums.proto"; import "client_commands.proto"; @@ -42,11 +56,10 @@ message EntitySpecifics { // EntitySpecifics. First, pick a non-colliding tag number by // picking a revision number of one of your past commits // to src.chromium.org. Then, in a different protocol buffer - // definition that includes this, do the following: + // definition, define your message type, and add an optional field + // to the list below using the unique tag value you selected. // - // extend EntitySpecifics { - // MyDatatypeSpecifics my_datatype = 32222; - // } + // optional MyDatatypeSpecifics my_datatype = 32222; // // where: // - 32222 is the non-colliding tag number you picked earlier. @@ -57,10 +70,32 @@ message EntitySpecifics { // datatype specifics from the code. // // Server implementations are obligated to preserve the contents of - // EntitySpecifics when it contains unrecognized extensions. In this + // EntitySpecifics when it contains unrecognized fields. In this // way, it is possible to add new datatype fields without having // to update the server. - extensions 30000 to max; + // + // Note: The tag selection process is based on legacy versions of the + // protocol which used protobuf extensions. We have kept the process + // consistent as the old values cannot change. The 5+ digit nature of the + // tags also makes them recognizable (individually and collectively) from + // noise in logs and debugging contexts, and creating a divergent subset of + // tags would only make things a bit more confusing. + + optional AutofillSpecifics autofill = 31729; + optional BookmarkSpecifics bookmark = 32904; + optional PreferenceSpecifics preference = 37702; + optional TypedUrlSpecifics typed_url = 40781; + optional ThemeSpecifics theme = 41210; + optional AppNotification app_notification = 45184; + optional PasswordSpecifics password = 45873; + optional NigoriSpecifics nigori = 47745; + optional ExtensionSpecifics extension = 48119; + optional AppSpecifics app = 48364; + optional SessionSpecifics session = 50119; + optional AutofillProfileSpecifics autofill_profile = 63951; + optional SearchEngineSpecifics search_engine = 88610; + optional ExtensionSettingSpecifics extension_setting = 96159; + optional AppSettingSpecifics app_setting = 103656; } message SyncEntity { @@ -318,7 +353,7 @@ message GetUpdatesCallerInfo { message DataTypeProgressMarker { // An integer identifying the data type whose progress is tracked by this // marker. The legitimate values of this field correspond to the protobuf - // field numbers of all EntitySpecifics extensions supported by the server. + // field numbers of all EntitySpecifics fields supported by the server. // These values are externally declared in per-datatype .proto files. optional int32 data_type_id = 1; @@ -374,14 +409,14 @@ message GetUpdatesMessage { // Indicates whether related folders should be fetched. optional bool fetch_folders = 3 [default = true]; - // The presence of an individual EntitySpecifics extension indicates that the - // client requests sync object types associated with that extension. This - // determination depends only on the presence of the extension field, not its - // contents -- thus clients should send empty extension messages. For - // backwards compatibility only bookmark objects will be sent to the client - // should requested_types not be present. + // The presence of an individual EntitySpecifics field indicates that the + // client requests sync object types associated with that field. This + // determination depends only on the presence of the field, not its + // contents -- thus clients should send empty messages as the field value. + // For backwards compatibility only bookmark objects will be sent to the + // client should requested_types not be present. // - // requested_types may contain multiple EntitySpecifics extensions -- in this + // requested_types may contain multiple EntitySpecifics fields -- in this // event, the server will return items of all the indicated types. // // requested_types has been deprecated; clients should use diff --git a/chrome/browser/sync/protocol/theme_specifics.proto b/chrome/browser/sync/protocol/theme_specifics.proto index eb864ff..f8318e8 100644 --- a/chrome/browser/sync/protocol/theme_specifics.proto +++ b/chrome/browser/sync/protocol/theme_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -14,8 +14,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; - // Properties of theme sync objects. message ThemeSpecifics { // If set, we're using a custom theme and all custom_* fields should be @@ -39,6 +37,3 @@ message ThemeSpecifics { optional string custom_theme_update_url = 5; } -extend EntitySpecifics { - optional ThemeSpecifics theme = 41210; -} diff --git a/chrome/browser/sync/protocol/typed_url_specifics.proto b/chrome/browser/sync/protocol/typed_url_specifics.proto index 4bc93e3..1f8a4b8 100644 --- a/chrome/browser/sync/protocol/typed_url_specifics.proto +++ b/chrome/browser/sync/protocol/typed_url_specifics.proto @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -14,8 +14,6 @@ option retain_unknown_fields = true; package sync_pb; -import "sync.proto"; - // Properties of typed_url sync objects - fields correspond to similarly named // fields in history::URLRow. message TypedUrlSpecifics { @@ -41,7 +39,3 @@ message TypedUrlSpecifics { // arrays must be the same length. repeated int32 visit_transitions = 8 [packed=true]; } - -extend EntitySpecifics { - optional TypedUrlSpecifics typed_url = 40781; -} |