diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-10 01:06:41 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-10 01:06:41 +0000 |
commit | 1bcf30ec84f19d40cc5c3f6051d0bb5860bfc74a (patch) | |
tree | a1c5b036a8aad3554aaca8947c3a249a8d5945e3 /sync | |
parent | 70180a806fe954878cdca606620da7a153a9efe7 (diff) | |
download | chromium_src-1bcf30ec84f19d40cc5c3f6051d0bb5860bfc74a.zip chromium_src-1bcf30ec84f19d40cc5c3f6051d0bb5860bfc74a.tar.gz chromium_src-1bcf30ec84f19d40cc5c3f6051d0bb5860bfc74a.tar.bz2 |
[Sync] Create new top-level sync/ directory
Move sync .proto files to sync/protocol. Update all references.
This begins the Great Sync Migration.
BUG=117585,43624
TEST=
Review URL: https://chromiumcodereview.appspot.com/9668028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
22 files changed, 1648 insertions, 0 deletions
diff --git a/sync/OWNERS b/sync/OWNERS new file mode 100644 index 0000000..041a6b9 --- /dev/null +++ b/sync/OWNERS @@ -0,0 +1,9 @@ +set noparent +akalin@chromium.org +atwilson@chromium.org +lipalani@chromium.org +nick@chromium.org +rlarocque@chromium.org +rsimha@chromium.org +tim@chromium.org +zea@chromium.org diff --git a/sync/protocol/app_notification_specifics.proto b/sync/protocol/app_notification_specifics.proto new file mode 100644 index 0000000..58436c7 --- /dev/null +++ b/sync/protocol/app_notification_specifics.proto @@ -0,0 +1,44 @@ +// 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. +// +// Sync protocol datatype extension for app notifications. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// Properties of an app notification. + +// An App Notification, to be delivered from Chrome Apps to the +// Chrome browser through the Notification API. +message AppNotification { + // Globally unique id. This is more robust for uniquely identifying each + // notification and hence gives us flexibility in the future. In absence + // of this, unique id would be (app_id, creation_timestamp_ms). But that + // relies on creation_timestamp_ms being high resolution and is not + // globally unique - only unique for a given user. + optional string guid = 1; + // Metadata, not shown directly to the user. + // The unique App Id, as created by the webstore and used to + // delegate messages to the applications. This is defined as 32 characters + optional string app_id = 2; + // Timestamp when the message was created in milliseconds. + // This is seperate from ctime as this is only set by the application. + optional int64 creation_timestamp_ms = 3; + + // Payload - these fields are visible to the user content is defined by the + // app. The fields are described in: + // chrome/browser/extensions/app_notification.h + optional string title = 4; + optional string body_text = 5; + optional string link_url = 6; + optional string link_text = 7; +} + diff --git a/sync/protocol/app_setting_specifics.proto b/sync/protocol/app_setting_specifics.proto new file mode 100644 index 0000000..d936c66 --- /dev/null +++ b/sync/protocol/app_setting_specifics.proto @@ -0,0 +1,25 @@ +// 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. +// +// Sync protocol datatype extension for an app setting. +// This is the same as for an extension setting, but uses a separate datatype +// in order to control syncability separately. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +import "extension_setting_specifics.proto"; + +// Properties of app setting sync objects; just an extension setting. +message AppSettingSpecifics { + optional ExtensionSettingSpecifics extension_setting = 1; +} + diff --git a/sync/protocol/app_specifics.proto b/sync/protocol/app_specifics.proto new file mode 100644 index 0000000..a7f09ec --- /dev/null +++ b/sync/protocol/app_specifics.proto @@ -0,0 +1,60 @@ +// 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. +// +// Sync protocol datatype extension for apps. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +import "extension_specifics.proto"; + +// Settings related to push notifications for apps. +message AppNotificationSettings { + // DEPRECATED: Use oauth_client_id below. + // Whether or not the user has setup notifications at least once. + // The value for this field will start out false and will be set + // to true when the user accepts receiving notifications for the + // first time and then it will always remain true. + optional bool initial_setup_done = 1; + + // Whether or not the user has disabled notifications. + optional bool disabled = 2; + + // OAuth2 client id to which the user granted the notification permission. + // This field will start out empty. + // It will be set when the user accepts receiving notifications. + // This field is used when the user revokes the notifications permission. + // Note that it is never cleared after it was set once. Hence, the presence + // of this field can be used to determine if the user has setup notifications + // at least once for the given app. + optional string oauth_client_id = 3; +} + +// Properties of app sync objects. +// +// For now, an app is just an extension. We keep the two data types +// separate for future-proofing purposes. +message AppSpecifics { + // Extension data. + optional ExtensionSpecifics extension = 1; + + // Notification settings. + optional AppNotificationSettings notification_settings = 2; + + // This controls where on a page this application icon will appear. + optional string app_launch_ordinal = 3; + + // This specifics which page the application icon will appear on in the NTP. + // This values only provide the order within the application pages, not within + // all of the panels in the NTP. + optional string page_ordinal = 4; +} + diff --git a/sync/protocol/autofill_specifics.proto b/sync/protocol/autofill_specifics.proto new file mode 100644 index 0000000..ac7bc51 --- /dev/null +++ b/sync/protocol/autofill_specifics.proto @@ -0,0 +1,65 @@ +// 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. +// +// Sync protocol datatype extension for autofill. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// Properties of autofill sync objects. + +// An AutofillProfile. +message AutofillProfileSpecifics { + // User-defined label. + optional string label = 1; + + optional string guid = 15; + + // Contact info. + repeated string name_first = 2; + repeated string name_middle = 3; + repeated string name_last = 4; + repeated string email_address = 5; + optional string company_name = 6; + + // Home address. + optional string address_home_line1 = 7; + optional string address_home_line2 = 8; + optional string address_home_city = 9; + optional string address_home_state = 10; + optional string address_home_zip = 11; + optional string address_home_country = 12; + + // Phone. + repeated string phone_home_whole_number = 13; + + // Deprecated. + optional string phone_fax_whole_number = 14 [deprecated=true]; +} + +message AutofillSpecifics { + // If any of these 3 fields are present, then all 3 should be, and it implies + // that this entity represents a classic autofill object. In this case, + // none of the autofill++ objects below should be present. + optional string name = 1; + optional string value = 2; + repeated int64 usage_timestamp = 3; + + // An autofill++ profile object. If present, indicates this entity + // represents an AutofillProfile exclusively, and no other fields (such as + // name/value or credit_card) should be present. + optional AutofillProfileSpecifics profile = 4; + + // Obsolete credit card fields. + // optional bytes deprecated_encrypted_credit_card = 5; + // optional AutofillCreditCardSpecifics deprecated_credit_card = 6; +} + diff --git a/sync/protocol/bookmark_specifics.proto b/sync/protocol/bookmark_specifics.proto new file mode 100644 index 0000000..c177511 --- /dev/null +++ b/sync/protocol/bookmark_specifics.proto @@ -0,0 +1,23 @@ +// 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. +// +// Sync protocol datatype extension for bookmarks. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// Properties of bookmark sync objects. +message BookmarkSpecifics { + optional string url = 1; + optional bytes favicon = 2; + optional string title = 3; +} + diff --git a/sync/protocol/client_commands.proto b/sync/protocol/client_commands.proto new file mode 100644 index 0000000..e574255 --- /dev/null +++ b/sync/protocol/client_commands.proto @@ -0,0 +1,31 @@ +// 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. +// +// Sync protocol for communication between sync client and server. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +message ClientCommand { + // Time to wait before sending any requests to the server. + optional int32 set_sync_poll_interval = 1; // in seconds + optional int32 set_sync_long_poll_interval = 2; // in seconds + + optional int32 max_commit_batch_size = 3; + + // Number of seconds to delay between a sessions + // action and sending a commit message to the + // server + optional int32 sessions_commit_delay_seconds = 4; + + // Number of seconds to delay before the throttled client should retry. + optional int32 throttle_delay_seconds = 5; +}; diff --git a/sync/protocol/client_debug_info.proto b/sync/protocol/client_debug_info.proto new file mode 100644 index 0000000..15216f8 --- /dev/null +++ b/sync/protocol/client_debug_info.proto @@ -0,0 +1,75 @@ +// 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. +// +// Common sync protocol for encrypted data. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// The additional info here is from SyncerStatus. They get sent when the event +// SYNC_CYCLE_COMPLETED is sent. +message SyncCycleCompletedEventInfo { + // optional bool syncer_stuck = 1; // Was always false, now obsolete. + + // The client has never set these values correctly. It set + // num_blocking_conflicts to the total number of conflicts detected and set + // num_non_blocking_conflicts to the number of blocking (aka. simple) + // conflicts. + // + // These counters have been deprecated to avoid further confusion. The newer + // counters provide more detail and are less buggy. + optional int32 num_blocking_conflicts = 2 [deprecated = true]; + optional int32 num_non_blocking_conflicts = 3 [deprecated = true]; + + // These new conflict counters replace the ones above. + optional int32 num_encryption_conflicts = 4; + optional int32 num_hierarchy_conflicts = 5; + optional int32 num_simple_conflicts = 6; + optional int32 num_server_conflicts = 7; +} + +message DebugEventInfo { + // These events are sent by |SyncManager| class. Note: In the code they each + // of these events have some additional info but we are not sending them to + // server. + enum EventType { + CONNECTION_STATUS_CHANGE = 1; // Connection status change. Note this + // gets generated even during a successful + // connection. + UPDATED_TOKEN = 2; // Client received an updated token. + PASSPHRASE_REQUIRED = 3; // Cryptographer needs passphrase. + PASSPHRASE_ACCEPTED = 4; // Passphrase was accepted by cryptographer. + INITIALIZATION_COMPLETE = 5; // Sync Initialization is complete. + + // |STOP_SYNCING_PERMANENTLY| event should never be seen by the server in + // the absence of bugs. + STOP_SYNCING_PERMANENTLY = 6; // Server sent stop syncing permanently. + + ENCRYPTED_TYPES_CHANGED = 9; // Set of encrypted types has changed. + ENCRYPTION_COMPLETE = 7; // Client has finished encrypting all data. + ACTIONABLE_ERROR = 8; // Client received an actionable error. + BOOTSTRAP_TOKEN_UPDATED = 9; // A new cryptographer bootstrap token was + // generated. + } + optional EventType type = 1; + optional SyncCycleCompletedEventInfo sync_cycle_completed_event_info = 2; +} + +message DebugInfo { + repeated DebugEventInfo events = 1; + + // Whether cryptographer is ready to encrypt and decrypt data. + optional bool cryptographer_ready = 2; + + // Cryptographer has pending keys which indicates the correct passphrase + // has not been provided yet. + optional bool cryptographer_has_pending_keys = 3; + + // Indicates client has dropped some events to save bandwidth. + optional bool events_dropped = 4; +} diff --git a/sync/protocol/encryption.proto b/sync/protocol/encryption.proto new file mode 100644 index 0000000..202ec33 --- /dev/null +++ b/sync/protocol/encryption.proto @@ -0,0 +1,32 @@ +// 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. +// +// Common sync protocol for encrypted data. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// Encrypted sync data consists of two parts: a key name and a blob. Key name is +// the name of the key that was used to encrypt blob and blob is encrypted data +// itself. +// +// The reason we need to keep track of the key name is that a sync user can +// change their passphrase (and thus their encryption key) at any time. When +// that happens, we make a best effort to reencrypt all nodes with the new +// passphrase, but since we don't have transactions on the server-side, we +// cannot guarantee that every node will be reencrypted. As a workaround, we +// keep track of all keys, assign each key a name (by using that key to encrypt +// a well known string) and keep track of which key was used to encrypt each +// node. +message EncryptedData { + optional string key_name = 1; + optional string blob = 2; +}; diff --git a/sync/protocol/extension_setting_specifics.proto b/sync/protocol/extension_setting_specifics.proto new file mode 100644 index 0000000..62947c5 --- /dev/null +++ b/sync/protocol/extension_setting_specifics.proto @@ -0,0 +1,28 @@ +// 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. +// +// Sync protocol datatype extension for an extension setting. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// Properties of extension setting sync objects. +message ExtensionSettingSpecifics { + // Id of the extension the setting is for. + optional string extension_id = 1; + + // Setting key. + optional string key = 2; + + // Setting value serialized as JSON. + optional string value = 3; +} + diff --git a/sync/protocol/extension_specifics.proto b/sync/protocol/extension_specifics.proto new file mode 100644 index 0000000..e3e1dfb --- /dev/null +++ b/sync/protocol/extension_specifics.proto @@ -0,0 +1,39 @@ +// 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. +// +// Sync protocol datatype extension for extensions. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// Properties of extension sync objects. +// +// Merge policy: the settings for the higher version number win; in +// the case of a tie, server wins. +message ExtensionSpecifics { + // Globally unique id for this extension. + optional string id = 1; + // The known installed version. + optional string version = 2; + + // Auto-update URL to use for this extension. May be blank, in + // which case the default one (i.e., the one for the Chrome + // Extensions Gallery) is used. + optional string update_url = 3; + // Whether or not this extension is enabled. + optional bool enabled = 4; + // Whether or not this extension is enabled in incognito mode. + optional bool incognito_enabled = 5; + + // The name of the extension. Used only for debugging. + optional string name = 6; +} + diff --git a/sync/protocol/nigori_specifics.proto b/sync/protocol/nigori_specifics.proto new file mode 100644 index 0000000..50f5014 --- /dev/null +++ b/sync/protocol/nigori_specifics.proto @@ -0,0 +1,94 @@ +// 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. +// +// Sync protocol datatype extension for nigori keys. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +import "encryption.proto"; + +message NigoriKey { + optional string name = 1; + optional bytes user_key = 2; + optional bytes encryption_key = 3; + optional bytes mac_key = 4; +} + +message NigoriKeyBag { + repeated NigoriKey key = 2; +} + +// Information about a device that is running a sync-enabled Chrome browser. +// We are mapping the unique per-device cache guid to more specific information +// about the device. +message DeviceInformation { + optional string cache_guid = 1; + + // The name of the device is dependent on the OS running the Chrome instance. + // On a Chromebook this is "Chromebook", on Linux the distribution name, on + // Mac OSX the hadware model name and on Windows the computer name. + optional string name = 2; + + // The platform of the device (ChromeOS, Linux, Mac, or Windows). + optional string platform = 3; + + // The Chrome version of the sync-enabled Chrome browser. + optional string chrome_version = 4; +} + +// Properties of nigori sync object. +message NigoriSpecifics { + optional EncryptedData encrypted = 1; + // True if |encrypted| is encrypted using a passphrase + // explicitly set by the user. + optional bool using_explicit_passphrase = 2; + + // Obsolete encryption fields. These were deprecated due to legacy versions + // that understand their usage but did not perform encryption properly. + // optional bool deprecated_encrypt_bookmarks = 3; + // optional bool deprecated_encrypt_preferences = 4; + // optional bool deprecated_encrypt_autofill_profile = 5; + // optional bool deprecated_encrypt_autofill = 6; + // optional bool deprecated_encrypt_themes = 7; + // optional bool deprecated_encrypt_typed_urls = 8; + // optional bool deprecated_encrypt_extensions = 9; + // optional bool deprecated_encrypt_sessions = 10; + // optional bool deprecated_encrypt_apps = 11; + // optional bool deprecated_encrypt_search_engines = 12; + + // Booleans corresponding to whether a datatype should be encrypted. + // Passwords are always encrypted, so we don't need a field here. + optional bool encrypt_bookmarks = 13; + optional bool encrypt_preferences = 14; + optional bool encrypt_autofill_profile = 15; + optional bool encrypt_autofill = 16; + optional bool encrypt_themes = 17; + optional bool encrypt_typed_urls = 18; + optional bool encrypt_extensions = 19; + optional bool encrypt_sessions = 20; + optional bool encrypt_apps = 21; + optional bool encrypt_search_engines = 22; + + optional bool sync_tabs = 23; + + // If true, all current and future datatypes will be encrypted. + optional bool encrypt_everything = 24; + + optional bool encrypt_extension_settings = 25; + optional bool encrypt_app_notifications = 26; + optional bool encrypt_app_settings = 27; + + // User device information. Contains information about each device that has a + // sync-enabled Chrome browser connected to the user account. + repeated DeviceInformation device_information = 28; +} + diff --git a/sync/protocol/password_specifics.proto b/sync/protocol/password_specifics.proto new file mode 100644 index 0000000..769914433 --- /dev/null +++ b/sync/protocol/password_specifics.proto @@ -0,0 +1,41 @@ +// 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. +// +// Sync protocol datatype extension for password data. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +import "encryption.proto"; + +// These are the properties that get serialized into the |encrypted| field of +// PasswordSpecifics. +message PasswordSpecificsData { + optional int32 scheme = 1; + optional string signon_realm = 2; + optional string origin = 3; + optional string action = 4; + optional string username_element = 5; + optional string username_value = 6; + optional string password_element = 7; + optional string password_value = 8; + optional bool ssl_valid = 9; + optional bool preferred = 10; + optional int64 date_created = 11; + optional bool blacklisted = 12; +} + +// Properties of password sync objects. The actual password data is held in a +// PasswordSpecificsData that is encrypted into |encrypted|. +message PasswordSpecifics { + optional EncryptedData encrypted = 1; +} + diff --git a/sync/protocol/preference_specifics.proto b/sync/protocol/preference_specifics.proto new file mode 100644 index 0000000..4827c5d --- /dev/null +++ b/sync/protocol/preference_specifics.proto @@ -0,0 +1,22 @@ +// 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. +// +// Sync protocol datatype extension for preferences. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// Properties of preference sync objects. +message PreferenceSpecifics { + optional string name = 1; + optional string value = 2; +} + diff --git a/sync/protocol/search_engine_specifics.proto b/sync/protocol/search_engine_specifics.proto new file mode 100644 index 0000000..effaf99 --- /dev/null +++ b/sync/protocol/search_engine_specifics.proto @@ -0,0 +1,61 @@ +// 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. +// +// Sync protocol datatype extension for custom search engines. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// Properties of custom search engine sync objects. +message SearchEngineSpecifics { + // The description of the search engine. + optional string short_name = 1; + // The search engine keyword for omnibox access. + optional string keyword = 2; + // A URL to the favicon to show in the search engines options page. + optional string favicon_url = 3; + // The actual parameterized search engine query URL. + optional string url = 4; + // A flag signifying whether it is safe to automatically modify this search + // engine entry or not. + optional bool safe_for_autoreplace = 5; + // The URL to the OSD file this search engine entry came from. + optional string originating_url = 6; + // The date this search engine entry was created. A UTC timestamp with units + // in microseconds. + optional int64 date_created = 7; + // A list of supported input encodings. + optional string input_encodings = 8; + // Whether this entry is shown in the list of default search engines or not. + optional bool show_in_default_list = 9; + // The parameterized URL that provides suggestions as the user types. + optional string suggestions_url = 10; + // The ID associated with the prepopulate data this search engine comes from. + // Set to zero if it was not prepopulated. + optional int32 prepopulate_id = 11; + // Whether to autogenerate a keyword for the search engine or not. + optional bool autogenerate_keyword = 12; + // ID 13 reserved - previously used by |logo_id|, now deprecated. + // Obsolete field. This used to represent whether or not this search engine + // entry was created automatically by an administrator via group policy. This + // notion no longer exists amongst synced search engines as we do not want to + // sync managed search engines. + // optional bool deprecated_created_by_policy = 14; + // The parameterized URL that is used for Instant results. + optional string instant_url = 15; + // ID 16 reserved - previously used by |id|, now deprecated. + // The last time this entry was modified by a user. A UTC timestamp with units + // in microseconds. + optional int64 last_modified = 17; + // The primary identifier of this search engine entry for Sync. + optional string sync_guid = 18; +} + diff --git a/sync/protocol/session_specifics.proto b/sync/protocol/session_specifics.proto new file mode 100644 index 0000000..9b59dd0 --- /dev/null +++ b/sync/protocol/session_specifics.proto @@ -0,0 +1,111 @@ +// 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. +// +// Sync protocol datatype extension for sessions. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +message SessionSpecifics { + // Unique id for the client. + optional string session_tag = 1; + optional SessionHeader header = 2; + optional SessionTab tab = 3; +} +// Properties of session sync objects. +message SessionHeader { + // Each session is composed of windows. + repeated SessionWindow window = 2; + // A non-unique but human-readable name to describe this client. + optional string client_name = 3; + // The type of device. + enum DeviceType { + TYPE_WIN = 1; + TYPE_MAC = 2; + TYPE_LINUX = 3; + TYPE_CROS = 4; + TYPE_OTHER = 5; + } + optional DeviceType device_type = 4; +} +message SessionWindow { + // Unique (to the owner) id for this window. + optional int32 window_id = 1; + // Index of the selected tab in tabs; -1 if no tab is selected. + optional int32 selected_tab_index = 2 [default = -1]; + // Type of the browser. Currently we only store browsers of type + // TYPE_TABBED and TYPE_POPUP. + enum BrowserType { + TYPE_TABBED = 1; + TYPE_POPUP = 2; + } + optional BrowserType browser_type = 3 [default = TYPE_TABBED]; + // The tabs that compose a window (correspond to tab id's). + repeated int32 tab = 4; +} +message SessionTab { + // Unique (to the owner) id for this tab. + optional int32 tab_id = 1; + // The unique id for the window this tab belongs to. + optional int32 window_id = 2; + // Visual index of the tab within its window. There may be gaps in these + // values. + optional int32 tab_visual_index = 3 [default = -1]; + // Identifies the index of the current navigation in navigations. For + // example, if this is 2 it means the current navigation is navigations[2]. + optional int32 current_navigation_index = 4 [default = -1]; + // True if the tab is pinned. + optional bool pinned = 5 [default = false]; + // If non-empty, this tab is an app tab and this is the id of the extension. + optional string extension_app_id = 6; + // Tabs are navigated, and the navigation data is here. + repeated TabNavigation navigation = 7; +} +message TabNavigation { + // The index in the NavigationController. If this is -1, it means this + // TabNavigation is bogus. + optional int32 index = 1 [default = -1]; + // The virtual URL, when nonempty, will override the actual URL of the page + // when we display it to the user. + optional string virtual_url = 2; + // The referring URL, which can be empty. + optional string referrer = 3; + // The title of the page. + optional string title = 4; + // Content state is an opaque blob created by WebKit that represents the + // state of the page. This includes form entries and scroll position for each + // frame. + optional string state = 5; + // Types of transitions between pages. + enum PageTransition { + LINK = 0; + TYPED = 1; + AUTO_BOOKMARK = 2; + AUTO_SUBFRAME = 3; + MANUAL_SUBFRAME = 4; + GENERATED = 5; + START_PAGE = 6; + FORM_SUBMIT = 7; + RELOAD = 8; + KEYWORD = 9; + KEYWORD_GENERATED = 10; + CHAIN_START = 12; + CHAIN_END = 13; + } + // These qualifiers further define the transition. + enum PageTransitionQualifier { + CLIENT_REDIRECT = 1; + SERVER_REDIRECT = 2; + } + optional PageTransition page_transition = 6 [default = TYPED]; + optional PageTransitionQualifier navigation_qualifier = 7; +} + diff --git a/sync/protocol/sync.proto b/sync/protocol/sync.proto new file mode 100644 index 0000000..d1aea72 --- /dev/null +++ b/sync/protocol/sync.proto @@ -0,0 +1,682 @@ +// 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. +// +// Sync protocol for communication between sync client and server. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +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"; +import "client_debug_info.proto"; + +// Used for inspecting how long we spent performing operations in different +// backends. All times must be in millis. +message ProfilingData { + optional int64 meta_data_write_time = 1; + optional int64 file_data_write_time = 2; + optional int64 user_lookup_time = 3; + optional int64 meta_data_read_time = 4; + optional int64 file_data_read_time = 5; + optional int64 total_request_time = 6; +} + +message EntitySpecifics { + // If a datatype is encrypted, this field will contain the encrypted + // original EntitySpecifics. The extension for the datatype will continue + // to exist, but contain only the default values. + // Note that currently passwords employ their own legacy encryption scheme and + // do not use this field. + optional EncryptedData encrypted = 1; + + // To add new datatype-specific fields to the protocol, extend + // 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, define your message type, and add an optional field + // to the list below using the unique tag value you selected. + // + // optional MyDatatypeSpecifics my_datatype = 32222; + // + // where: + // - 32222 is the non-colliding tag number you picked earlier. + // - MyDatatypeSpecifics is the type (probably a message type defined + // in your new .proto file) that you want to associate with each + // object of the new datatype. + // - my_datatype is the field identifier you'll use to access the + // datatype specifics from the code. + // + // Server implementations are obligated to preserve the contents of + // EntitySpecifics when it contains unrecognized fields. In this + // way, it is possible to add new datatype fields without having + // to update the server. + // + // 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 { + // This item's identifier. In a commit of a new item, this will be a + // client-generated ID. If the commit succeeds, the server will generate + // a globally unique ID and return it to the committing client in the + // CommitResponse.EntryResponse. In the context of a GetUpdatesResponse, + // |id_string| is always the server generated ID. The original + // client-generated ID is preserved in the |originator_client_id| field. + // Present in both GetUpdatesResponse and CommitMessage. + optional string id_string = 1; + + // An id referencing this item's parent in the hierarchy. In a + // CommitMessage, it is accepted for this to be a client-generated temporary + // ID if there was a new created item with that ID appearing earlier + // in the message. In all other situations, it is a server ID. + // Present in both GetUpdatesResponse and CommitMessage. + optional string parent_id_string = 2; + + // old_parent_id is only set in commits and indicates the old server + // parent(s) to remove. When omitted, the old parent is the same as + // the new. + // Present only in CommitMessage. + optional string old_parent_id = 3; + + // The version of this item -- a monotonically increasing value that is + // maintained by for each item. If zero in a CommitMessage, the server + // will interpret this entity as a newly-created item and generate a + // new server ID and an initial version number. If nonzero in a + // CommitMessage, this item is treated as an update to an existing item, and + // the server will use |id_string| to locate the item. Then, if the item's + // current version on the server does not match |version|, the commit will + // fail for that item. The server will not update it, and will return + // a result code of CONFLICT. In a GetUpdatesResponse, |version| is + // always positive and indentifies the revision of the item data being sent + // to the client. + // Present in both GetUpdatesResponse and CommitMessage. + required int64 version = 4; + + // Last modification time (in java time milliseconds) + // Present in both GetUpdatesResponse and CommitMessage. + optional int64 mtime = 5; + + // Creation time. + // Present in both GetUpdatesResponse and CommitMessage. + optional int64 ctime = 6; + + // The name of this item. + // Historical note: + // Since November 2010, this value is no different from non_unique_name. + // Before then, server implementations would maintain a unique-within-parent + // value separate from its base, "non-unique" value. Clients had not + // depended on the uniqueness of the property since November 2009; it was + // removed from Chromium by http://codereview.chromium.org/371029 . + // Present in both GetUpdatesResponse and CommitMessage. + required string name = 7; + + // The name of this item. Same as |name|. + // |non_unique_name| should take precedence over the |name| value if both + // are supplied. For efficiency, clients and servers should avoid setting + // this redundant value. + // Present in both GetUpdatesResponse and CommitMessage. + optional string non_unique_name = 8; + + // A value from a monotonically increasing sequence that indicates when + // this item was last updated on the server. This is now equivalent + // to version. This is now deprecated in favor of version. + // Present only in GetUpdatesResponse. + optional int64 sync_timestamp = 9; + + // If present, this tag identifies this item as being a uniquely + // instanced item. The server ensures that there is never more + // than one entity in a user's store with the same tag value. + // This value is used to identify and find e.g. the "Google Chrome" settings + // folder without relying on it existing at a particular path, or having + // a particular name, in the data store. + // + // This variant of the tag is created by the server, so clients can't create + // an item with a tag using this field. + // + // Use client_defined_unique_tag if you want to create one from the client. + // + // An item can't have both a client_defined_unique_tag and + // a server_defined_unique_tag. + // + // Present only in GetUpdatesResponse. + optional string server_defined_unique_tag = 10; + + // If this group is present, it implies that this SyncEntity corresponds to + // a bookmark or a bookmark folder. + // + // This group is deprecated; clients should use the bookmark EntitySpecifics + // protocol buffer extension instead. + optional group BookmarkData = 11 { + // We use a required field to differentiate between a bookmark and a + // bookmark folder. + // Present in both GetUpdatesMessage and CommitMessage. + required bool bookmark_folder = 12; + + // For bookmark objects, contains the bookmark's URL. + // Present in both GetUpdatesResponse and CommitMessage. + optional string bookmark_url = 13; + + // For bookmark objects, contains the bookmark's favicon. The favicon is + // represented as a 16X16 PNG image. + // Present in both GetUpdatesResponse and CommitMessage. + optional bytes bookmark_favicon = 14; + } + + // Supplies a numeric position for this item, relative to other items with + // the same parent. + // + // Present in both GetUpdatesResponse and CommitMessage. + // + // In a CommitMessage context, server implementations may choose whether + // to compute a position based on this field or based on + // |insert_after_item_id|. Clients should set both values so that they + // result in a consistent ordering regardless of which choice the server + // makes. + optional int64 position_in_parent = 15; + + // Contains the ID of the element (under the same parent) after which this + // element resides. An empty string indicates that the element is the first + // element in the parent. This value is used during commits to specify + // a relative position for a position change. In the context of + // a GetUpdatesMessage, |position_in_parent| is used instead to + // communicate position. + // + // Present only in CommitMessage. + // + // This is being deprecated: clients should now explicitly set + // an absolute |position_in_parent| value at commit time. In the + // interim, clients should supply both values and continue to honor + // the |position_in_parent| value returned in the CommitResponse. + optional string insert_after_item_id = 16; + + // Arbitrary key/value pairs associated with this item. + // Present in both GetUpdatesResponse and CommitMessage. + // Deprecated. + // optional ExtendedAttributes extended_attributes = 17; + + // If true, indicates that this item has been (or should be) deleted. + // Present in both GetUpdatesResponse and CommitMessage. + optional bool deleted = 18 [default = false]; + + // A GUID that identifies the the sync client who initially committed + // this entity. This value corresponds to |cache_guid| in CommitMessage. + // This field, along with |originator_client_item_id|, can be used to + // reunite the original with its official committed version in the case + // where a client does not receive or process the commit response for + // some reason. + // Present only in GetUpdatesResponse. + optional string originator_cache_guid = 19; + + // The local item id of this entry from the client that initially + // committed this entity. Typically a negative integer. + // Present only in GetUpdatesResponse. + optional string originator_client_item_id = 20; + + // Extensible container for datatype-specific data. + // This became available in version 23 of the protocol. + optional EntitySpecifics specifics = 21; + + // Indicate whether this is a folder or not. Available in version 23+. + optional bool folder = 22 [default = false]; + + // A client defined unique hash for this entity. + // Similar to server_defined_unique_tag. + // + // When initially committing an entity, a client can request that the entity + // is unique per that account. To do so, the client should specify a + // client_defined_unique_tag. At most one entity per tag value may exist. + // per account. The server will enforce uniqueness on this tag + // and fail attempts to create duplicates of this tag. + // Will be returned in any updates for this entity. + // + // The difference between server_defined_unique_tag and + // client_defined_unique_tag is the creator of the entity. Server defined + // tags are entities created by the server at account creation, + // while client defined tags are entities created by the client at any time. + // + // During GetUpdates, a sync entity update will come back with ONE of: + // a) Originator and cache id - If client committed the item as non "unique" + // b) Server tag - If server committed the item as unique + // c) Client tag - If client committed the item as unique + // + // May be present in CommitMessages for the initial creation of an entity. + // If present in Commit updates for the entity, it will be ignored. + // + // Available in version 24+. + // + // May be returned in GetUpdatesMessage and sent up in CommitMessage. + // + optional string client_defined_unique_tag = 23; +}; + +// This message contains diagnostic information used to correlate +// commit-related traffic with extensions-related mutations to the +// data models in chromium. It plays no functional role in +// processing this CommitMessage. +message ChromiumExtensionsActivity { + // The human-readable ID identifying the extension responsible + // for the traffic reported in this ChromiumExtensionsActivity. + optional string extension_id = 1; + + // How many times the extension successfully invoked a write + // operation through the bookmarks API since the last CommitMessage. + optional uint32 bookmark_writes_since_last_commit = 2; +}; + +message CommitMessage { + repeated SyncEntity entries = 1; + + // A GUID that identifies the committing sync client. This value will be + // returned as originator_cache_guid for any new items. + optional string cache_guid = 2; + + repeated ChromiumExtensionsActivity extensions_activity = 3; +}; + +message GetUpdatesCallerInfo { + enum GetUpdatesSource { + UNKNOWN = 0; // The source was not set by the caller. + FIRST_UPDATE = 1; // First request after browser restart. Not to + // be confused with "NEW_CLIENT". + LOCAL = 2; // The source of the update was a local change. + NOTIFICATION = 3; // The source of the update was a p2p notification. + PERIODIC = 4; // The source of the update was periodic polling. + SYNC_CYCLE_CONTINUATION = 5; // The source of the update was a + // continuation of a previous update. + CLEAR_PRIVATE_DATA = 6; // Source is a call to remove all private data + NEWLY_SUPPORTED_DATATYPE = 7; // The client is in configuration mode + // because it's syncing all datatypes, and + // support for a new datatype was recently + // released via a software auto-update. + MIGRATION = 8; // The client is in configuration mode because a + // MIGRATION_DONE error previously returned by the + // server necessitated resynchronization. + NEW_CLIENT = 9; // The client is in configuration mode because the + // user enabled sync for the first time. Not to be + // confused with FIRST_UPDATE. + RECONFIGURATION = 10; // The client is in configuration mode because the + // user opted to sync a different set of datatypes. + DATATYPE_REFRESH = 11; // A datatype has requested a refresh. This is + // typically used when datatype's have custom + // sync UI, e.g. sessions. + } + + required GetUpdatesSource source = 1; + + // True only if notifications were enabled for this GetUpdateMessage. + optional bool notifications_enabled = 2; +}; + +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 fields supported by the server. + // These values are externally declared in per-datatype .proto files. + optional int32 data_type_id = 1; + + // An opaque-to-the-client sequence of bytes that the server may interpret + // as an indicator of the client's knowledge state. If this is empty or + // omitted by the client, it indicates that the client is initiating a + // a first-time sync of this datatype. Otherwise, clients must supply a + // value previously returned by the server in an earlier GetUpdatesResponse. + // These values are not comparable or generable on the client. + // + // The opaque semantics of this field are to afford server implementations + // some flexibility in implementing progress tracking. For instance, + // a server implementation built on top of a distributed storage service -- + // or multiple heterogenous such services -- might need to supply a vector + // of totally ordered monotonic update timestamps, rather than a single + // monotonically increasing value. Other optimizations may also be + // possible if the server is allowed to embed arbitrary information in + // the progress token. + // + // Server implementations should keep the size of these tokens relatively + // small, on the order of tens of bytes, and they should remain small + // regardless of the number of items synchronized. (A possible bad server + // implementation would be for progress_token to contain a list of all the + // items ever sent to the client. Servers shouldn't do this.) + optional bytes token = 2; + + // Clients that previously downloaded updates synced using the timestamp based + // progress tracking mechanism, but which wish to switch over to the opaque + // token mechanism can set this field in a GetUpdatesMessage. The server + // will perform a get updates operation as normal from the indicated + // timestamp, and return only an opaque progress token. + optional int64 timestamp_token_for_migration = 3; + + // An opaque-to-the-client string of bytes, received through a notification, + // that the server may interpret as a hint about the location of the latest + // version of the data for this type. + optional string notification_hint = 4; +} + +message GetUpdatesMessage { + // Indicates the client's current progress in downloading updates. A + // from_timestamp value of zero means that the client is requesting a first- + // time sync. After that point, clients should fill in this value with the + // value returned in the last-seen GetUpdatesResponse.new_timestamp. + // + // from_timestamp has been deprecated; clients should use + // |from_progress_marker| instead, which allows more flexibility. + optional int64 from_timestamp = 1; + + // Indicates the reason for the GetUpdatesMessage. + optional GetUpdatesCallerInfo caller_info = 2; + + // Indicates whether related folders should be fetched. + optional bool fetch_folders = 3 [default = true]; + + // 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 fields -- in this + // event, the server will return items of all the indicated types. + // + // requested_types has been deprecated; clients should use + // |from_progress_marker| instead, which allows more flexibility. + optional EntitySpecifics requested_types = 4; + + // Client-requested limit on the maximum number of updates to return at once. + // The server may opt to return fewer updates than this amount, but it should + // not return more. + optional int32 batch_size = 5; + + // Per-datatype progress marker. If present, the server will ignore + // the values of requested_types and from_timestamp, using this instead. + repeated DataTypeProgressMarker from_progress_marker = 6; + + // Indicates whether the response should be sent in chunks. This may be + // needed for devices with limited memory resources. If true, the response + // will include one or more ClientToServerResponses, with the frist one + // containing GetUpdatesMetadataResponse, and the remaining ones, if any, + // containing GetUpdatesStreamingResponse. These ClientToServerResponses are + // delimited by a length prefix, which is encoded as a varint. + optional bool streaming = 7 [default = false]; + + // Whether to create the mobile bookmarks folder if it's not + // already created. Should be set to true only by mobile clients. + optional bool create_mobile_bookmarks_folder = 1000 [default = false]; +}; + +message AuthenticateMessage { + required string auth_token = 1; +}; + +// This message is sent to the server to clear data. An asynchronous +// response is returned to the client indicating that the server has received +// the request and has begun to clear data. +message ClearUserDataMessage { +} + +message ClearUserDataResponse { +} + +message ClientToServerMessage { + required string share = 1; + optional int32 protocol_version = 2 [default = 30]; + enum Contents { + COMMIT = 1; + GET_UPDATES = 2; + AUTHENTICATE = 3; + CLEAR_DATA = 4; + } + + required Contents message_contents = 3; + optional CommitMessage commit = 4; + optional GetUpdatesMessage get_updates = 5; + optional AuthenticateMessage authenticate = 6; + // Request to clear all Chromium data from the server + optional ClearUserDataMessage clear_user_data = 9; + + optional string store_birthday = 7; // Opaque store ID; if it changes, duck! + // The client sets this if it detects a sync issue. The server will tell it + // if it should perform a refresh. + optional bool sync_problem_detected = 8 [default = false]; + + // Client side state information for debugging purpose. + // This is only sent on the first getupdates of every sync cycle, + // as an optimization to save bandwidth. + optional DebugInfo debug_info = 10; +}; + +message CommitResponse { + enum ResponseType { + SUCCESS = 1; + CONFLICT = 2; // You're out of date; update and check your data + // TODO(ncarter): What's the difference between RETRY and TRANSIENT_ERROR? + RETRY = 3; // Someone has a conflicting, non-expired session open + INVALID_MESSAGE = 4; // What the client sent was invalid, and trying again + // won't help. + OVER_QUOTA = 5; // This operation would put you, or you are, over quota + TRANSIENT_ERROR = 6; // Something went wrong; try again in a bit + } + repeated group EntryResponse = 1 { + required ResponseType response_type = 2; + + // Sync servers may also return a new ID for an existing item, indicating + // a new entry's been created to hold the data the client's sending up. + optional string id_string = 3; + + // should be filled if our parent was assigned a new ID. + optional string parent_id_string = 4; + + // This value is the same as the position_in_parent value returned within + // the SyncEntity message in GetUpdatesResponse. + optional int64 position_in_parent = 5; + + // The item's current version. + optional int64 version = 6; + + // Allows the server to move-aside an entry as it's being committed. + // This name is the same as the name field returned within the SyncEntity + // message in GetUpdatesResponse. + optional string name = 7; + + // This name is the same as the non_unique_name field returned within the + // SyncEntity message in GetUpdatesResponse. + optional string non_unique_name = 8; + + optional string error_message = 9; + + // Last modification time (in java time milliseconds). Allows the server + // to override the client-supplied mtime during a commit operation. + optional int64 mtime = 10; + } +}; + +message GetUpdatesResponse { + // New sync entries that the client should apply. + repeated SyncEntity entries = 1; + + // If there are more changes on the server that weren't processed during this + // GetUpdates request, the client should send another GetUpdates request and + // use new_timestamp as the from_timestamp value within GetUpdatesMessage. + // + // This field has been deprecated and will be returned only to clients + // that set the also-deprecated |from_timestamp| field in the update request. + // Clients should use |from_progress_marker| and |new_progress_marker| + // instead. + optional int64 new_timestamp = 2; + + // DEPRECATED FIELD - server does not set this anymore. + optional int64 deprecated_newest_timestamp = 3; + + // Approximate count of changes remaining - use this for UI feedback. + // If present and zero, this estimate is firm: the server has no changes + // after the current batch. + optional int64 changes_remaining = 4; + + // Opaque, per-datatype timestamp-like tokens. A client should use this + // field in lieu of new_timestamp, which is deprecated in newer versions + // of the protocol. Clients should retain and persist the values returned + // in this field, and present them back to the server to indicate the + // starting point for future update requests. + // + // This will be sent only if the client provided |from_progress_marker| + // in the update request. + // + // The server may provide a new progress marker even if this is the end of + // the batch, or if there were no new updates on the server; and the client + // must save these. If the server does not provide a |new_progress_marker| + // value for a particular datatype, when the request provided a + // |from_progress_marker| value for that datatype, the client should + // interpret this to mean "no change from the previous state" and retain its + // previous progress-marker value for that datatype. + // + // Progress markers in the context of a response will never have the + // |timestamp_token_for_migration| field set. + repeated DataTypeProgressMarker new_progress_marker = 5; +}; + +// The metadata response for GetUpdatesMessage. This response is sent when +// streaming is set to true in the request. It is prefixed with a length +// delimiter, which is encoded in varint. +message GetUpdatesMetadataResponse { + // Approximate count of changes remaining. Detailed comment is available in + // GetUpdatesResponse. + optional int64 changes_remaining = 1; + + // Opaque, per-datatype timestamp-like tokens. Detailed comment is available + // in GetUpdatesResponse. + repeated DataTypeProgressMarker new_progress_marker = 2; +}; + +// The streaming response message for GetUpdatesMessage. This message is sent +// when streaming is set to true in the request. There may be multiple +// GetUpdatesStreamingResponse messages in a response. This type of messages +// is preceded by GetUpdatesMetadataResponse. It is prefixed with a length +// delimiter, which is encoded in varint. +message GetUpdatesStreamingResponse { + // New sync entries that the client should apply. + repeated SyncEntity entries = 1; +}; + +// A user-identifying struct. For a given Google account the email and display +// name can change, but obfuscated_id should be constant. +// The obfuscated id is optional because at least one planned use of the proto +// (sharing) does not require it. +message UserIdentification { + required string email = 1; // the user's full primary email address. + optional string display_name = 2; // the user's display name. + optional string obfuscated_id = 3; // an obfuscated, opaque user id. +}; + +message AuthenticateResponse { + // Optional only for backward compatibility. + optional UserIdentification user = 1; +}; + +message ThrottleParameters { + // Deprecated. Remove this from the server side. + required int32 min_measure_payload_size = 1; + required double target_utilization = 2; + required double measure_interval_max = 3; + required double measure_interval_min = 4; + required double observation_window = 5; +}; + +message ClientToServerResponse { + optional CommitResponse commit = 1; + optional GetUpdatesResponse get_updates = 2; + optional AuthenticateResponse authenticate = 3; + optional ClearUserDataResponse clear_user_data = 9; + optional GetUpdatesMetadataResponse stream_metadata = 10; + // If GetUpdatesStreamingResponse is contained in the ClientToServerResponse, + // none of the other fields (error_code and etc) will be set. + optional GetUpdatesStreamingResponse stream_data = 11; + + message Error { + optional SyncEnums.ErrorType error_type = 1 [default = UNKNOWN]; + optional string error_description = 2; + optional string url = 3; + enum Action { + UPGRADE_CLIENT = 0; // Upgrade the client to latest version. + CLEAR_USER_DATA_AND_RESYNC = 1; // Clear user data from dashboard and + // setup sync again. + ENABLE_SYNC_ON_ACCOUNT = 2; // The administrator needs to enable sync + // on the account. + STOP_AND_RESTART_SYNC = 3; // Stop sync and set up sync again. + DISABLE_SYNC_ON_CLIENT = 4; // Wipe the client of all sync data and + // stop syncing. + UNKNOWN_ACTION = 5; // This is the default. + } + optional Action action = 4 [default = UNKNOWN_ACTION]; + + // Currently only meaningful if |error_type| is throttled. If this field + // is absent then the whole client (all datatypes) is throttled. + repeated int32 error_data_type_ids = 5; + } + + optional Error error = 13; + + // Up until protocol_version 24, the default was SUCCESS which made it + // impossible to add new enum values since older clients would parse any + // out-of-range value as SUCCESS. Starting with 25, unless explicitly set, + // the error_code will be UNKNOWN so that clients know when they're + // out-of-date. Note also that when using protocol_version < 25, + // TRANSIENT_ERROR is not supported. Instead, the server sends back a HTTP + // 400 error code. This is deprecated now. + optional SyncEnums.ErrorType error_code = 4 [default = UNKNOWN]; + optional string error_message = 5; + + // Opaque store ID; if it changes, the contents of the client's cache + // is meaningless to this server. This happens most typically when + // you switch from one storage backend instance (say, a test instance) + // to another (say, the official instance). + optional string store_birthday = 6; + + optional ClientCommand client_command = 7; + optional ProfilingData profiling_data = 8; + + // The data types whose storage has been migrated. Present when the value of + // error_code is MIGRATION_DONE. + repeated int32 migrated_data_type_id = 12; +}; + diff --git a/sync/protocol/sync_enums.proto b/sync/protocol/sync_enums.proto new file mode 100644 index 0000000..d28023b --- /dev/null +++ b/sync/protocol/sync_enums.proto @@ -0,0 +1,64 @@ +// 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. +// +// Sync protocol for communication between sync client and server. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +message SyncEnums { + // These events are sent by |SyncManager| class. Note: In the code they each + // of these events have some additional info but we are not sending them to + // server. + enum EventType { + AUTH_ERROR = 1; // Auth error. Note this gets generated even during + // successful auth with the error set to none. + UPDATED_TOKEN = 2; // Client received an updated token. + PASSPHRASE_REQUIRED = 3; // Cryptographer needs passphrase. + PASSPHRASE_ACCEPTED = 4; // Passphrase was accepted by cryptographer. + INITIALIZATION_COMPLETE = 5; // Sync Initialization is complete. + + // |STOP_SYNCING_PERMANENTLY| event should never be seen by the server in + // the absence of bugs. + STOP_SYNCING_PERMANENTLY = 6; // Server sent stop syncing permanently. + + ENCRYPTED_TYPES_CHANGED = 9; // Set of encrypted types has changed. + ENCRYPTION_COMPLETE = 7; // Client has finished encrypting all data. + ACTIONABLE_ERROR = 8; // Client received an actionable error. + } + + enum ErrorType { + SUCCESS = 0; + ACCESS_DENIED = 1; // Returned when the user doesn't have access to + // store (instead of HTTP 401). + NOT_MY_BIRTHDAY = 2; // Returned when the server and client disagree on + // the store birthday. + THROTTLED = 3; // Returned when the store has exceeded the + // allowed bandwidth utilization. + AUTH_EXPIRED = 4; // Auth token or cookie has expired. + USER_NOT_ACTIVATED = 5; // User doesn't have the Chrome bit set on that + // Google Account. + AUTH_INVALID = 6; // Auth token or cookie is otherwise invalid. + CLEAR_PENDING = 7; // A clear of the user data is pending (e.g. + // initiated by privacy request). Client should + // come back later. + TRANSIENT_ERROR = 8; // A transient error occured (eg. backend + // timeout). Client should try again later. + MIGRATION_DONE = 9; // Migration has finished for one or more data + // types. Client should clear the cache for + // these data types only and then re-sync with + // a server. + UNKNOWN = 100; // Unknown value. This should never be explicitly + // used; it is the default value when an + // out-of-date client parses a value it doesn't + // recognize. + } +} diff --git a/sync/protocol/sync_proto.gyp b/sync/protocol/sync_proto.gyp new file mode 100644 index 0000000..28198b8 --- /dev/null +++ b/sync/protocol/sync_proto.gyp @@ -0,0 +1,41 @@ +# 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. + +{ + 'variables': { + 'chromium_code': 1, + }, + 'targets': [ + { + 'target_name': 'sync_proto', + 'type': 'static_library', + 'sources': [ + 'app_notification_specifics.proto', + 'app_setting_specifics.proto', + 'app_specifics.proto', + 'autofill_specifics.proto', + 'bookmark_specifics.proto', + 'client_commands.proto', + 'client_debug_info.proto', + 'encryption.proto', + 'extension_setting_specifics.proto', + 'extension_specifics.proto', + 'nigori_specifics.proto', + 'password_specifics.proto', + 'preference_specifics.proto', + 'search_engine_specifics.proto', + 'session_specifics.proto', + 'sync.proto', + 'sync_enums.proto', + 'test.proto', + 'theme_specifics.proto', + 'typed_url_specifics.proto', + ], + 'variables': { + 'proto_out_dir': 'sync/protocol', + }, + 'includes': ['../../build/protoc.gypi'], + }, + ], +} diff --git a/sync/protocol/test.proto b/sync/protocol/test.proto new file mode 100644 index 0000000..7453cee --- /dev/null +++ b/sync/protocol/test.proto @@ -0,0 +1,21 @@ +// 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. +// +// Protocol messages used only for testing. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +message UnknownFieldsTestA { + required bool foo = 1; +} + +message UnknownFieldsTestB { + required bool foo = 1; + required bool bar = 2; +} diff --git a/sync/protocol/theme_specifics.proto b/sync/protocol/theme_specifics.proto new file mode 100644 index 0000000..f8318e8 --- /dev/null +++ b/sync/protocol/theme_specifics.proto @@ -0,0 +1,39 @@ +// 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. +// +// Sync protocol datatype extension for themes. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// Properties of theme sync objects. +message ThemeSpecifics { + // If set, we're using a custom theme and all custom_* fields should be + // present. If not set, we use the default or system theme (see below) + // and all custom_* fields should be omitted. + optional bool use_custom_theme = 1; + // This field is only set (i.e., not cleared) on platforms that have + // a distinction between the system theme and the default theme, but + // other platforms must be careful to pass through the set state (not + // just the value) of this flag. + // + // If true, we use the system theme by default (i.e., when we don't use + // a custom theme) for platforms that make a distinction between the + // default theme and the system theme. Has no effect if use_custom_theme + // is set. + optional bool use_system_theme_by_default = 2; + + // Custom-theme-specific fields. + optional string custom_theme_name = 3; + optional string custom_theme_id = 4; + optional string custom_theme_update_url = 5; +} + diff --git a/sync/protocol/typed_url_specifics.proto b/sync/protocol/typed_url_specifics.proto new file mode 100644 index 0000000..1f8a4b8 --- /dev/null +++ b/sync/protocol/typed_url_specifics.proto @@ -0,0 +1,41 @@ +// 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. +// +// Sync protocol datatype extension for typed urls. + +// Update proto_value_conversions{.h,.cc,_unittest.cc} if you change +// any fields in this file. + +syntax = "proto2"; + +option optimize_for = LITE_RUNTIME; +option retain_unknown_fields = true; + +package sync_pb; + +// Properties of typed_url sync objects - fields correspond to similarly named +// fields in history::URLRow. +message TypedUrlSpecifics { + // Actual URL that was typed. + optional string url = 1; + // Title of the page corresponding to this URL. + optional string title = 2; + // The number of times this URL was typed. Deprecated since we no longer sync + // this information (it's inferred by the history code from the transition + // type for each visit). + // optional int32 typed_count = 3; (deprecated) + // True if the URL should be used for auto-complete. + optional bool hidden = 4; + // The number of visits (includes page reloads). + // repeated int64 visit = 5; (deprecated) + // The number of explicit navigations to this URL (excludes page reloads) - + // deprecated as we no longer sync this (history code infers this from the + // |visits| array). + // optional int32 visited_count = 6; (deprecated) + // Timestamps for all visits to this URL. + repeated int64 visits = 7 [packed=true]; + // The PageTransition::Type for each of the visits in the |visit| array. Both + // arrays must be the same length. + repeated int32 visit_transitions = 8 [packed=true]; +} |