summaryrefslogtreecommitdiffstats
path: root/sync/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'sync/protocol')
-rw-r--r--sync/protocol/device_info_specifics.proto37
-rw-r--r--sync/protocol/nigori_specifics.proto21
-rw-r--r--sync/protocol/proto_enum_conversions.cc18
-rw-r--r--sync/protocol/proto_enum_conversions.h2
-rw-r--r--sync/protocol/proto_value_conversions.cc11
-rw-r--r--sync/protocol/proto_value_conversions.h9
-rw-r--r--sync/protocol/proto_value_conversions_unittest.cc8
-rw-r--r--sync/protocol/session_specifics.proto11
-rw-r--r--sync/protocol/sync.proto12
-rw-r--r--sync/protocol/sync_enums.proto10
-rw-r--r--sync/protocol/sync_proto.gyp3
11 files changed, 86 insertions, 56 deletions
diff --git a/sync/protocol/device_info_specifics.proto b/sync/protocol/device_info_specifics.proto
new file mode 100644
index 0000000..67eb469
--- /dev/null
+++ b/sync/protocol/device_info_specifics.proto
@@ -0,0 +1,37 @@
+// 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 "sync_enums.proto";
+
+// Information about a device that is running a sync-enabled Chrome browser. We
+// are mapping the per-client cache guid to more specific information about the
+// device.
+message DeviceInfoSpecifics {
+ // The cache_guid created to identify a sync client on this device.
+ optional string cache_guid = 1;
+
+ // A non-unique but human readable name to describe this client.
+ optional string client_name = 2;
+
+ // The platform of the device.
+ optional SyncEnums.DeviceType device_type = 3;
+
+ // The UserAgent used when contacting the Chrome Sync server.
+ optional string sync_user_agent = 4;
+
+ // The Chrome instance's version. Updated (if necessary) on every startup.
+ optional string chrome_version = 5;
+}
diff --git a/sync/protocol/nigori_specifics.proto b/sync/protocol/nigori_specifics.proto
index 2d2454c..6b3b066 100644
--- a/sync/protocol/nigori_specifics.proto
+++ b/sync/protocol/nigori_specifics.proto
@@ -27,24 +27,6 @@ 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 encryption_keybag = 1;
@@ -92,7 +74,8 @@ message NigoriSpecifics {
// 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;
+ // This has been moved to the DeviceInfo message.
+ // repeated DeviceInformation deprecated_device_information = 28;
// Enable syncing favicons as part of tab sync.
optional bool sync_tab_favicons = 29;
diff --git a/sync/protocol/proto_enum_conversions.cc b/sync/protocol/proto_enum_conversions.cc
index 1d0ec19..6db81c7 100644
--- a/sync/protocol/proto_enum_conversions.cc
+++ b/sync/protocol/proto_enum_conversions.cc
@@ -139,16 +139,16 @@ const char* GetActionString(sync_pb::SyncEnums::Action action) {
}
const char* GetDeviceTypeString(
- sync_pb::SessionHeader::DeviceType device_type) {
- ASSERT_ENUM_BOUNDS(sync_pb::SessionHeader, DeviceType, TYPE_WIN, TYPE_TABLET);
+ sync_pb::SyncEnums::DeviceType device_type) {
+ ASSERT_ENUM_BOUNDS(sync_pb::SyncEnums, DeviceType, TYPE_WIN, TYPE_TABLET);
switch (device_type) {
- ENUM_CASE(sync_pb::SessionHeader, TYPE_WIN);
- ENUM_CASE(sync_pb::SessionHeader, TYPE_MAC);
- ENUM_CASE(sync_pb::SessionHeader, TYPE_LINUX);
- ENUM_CASE(sync_pb::SessionHeader, TYPE_CROS);
- ENUM_CASE(sync_pb::SessionHeader, TYPE_OTHER);
- ENUM_CASE(sync_pb::SessionHeader, TYPE_PHONE);
- ENUM_CASE(sync_pb::SessionHeader, TYPE_TABLET);
+ ENUM_CASE(sync_pb::SyncEnums, TYPE_WIN);
+ ENUM_CASE(sync_pb::SyncEnums, TYPE_MAC);
+ ENUM_CASE(sync_pb::SyncEnums, TYPE_LINUX);
+ ENUM_CASE(sync_pb::SyncEnums, TYPE_CROS);
+ ENUM_CASE(sync_pb::SyncEnums, TYPE_OTHER);
+ ENUM_CASE(sync_pb::SyncEnums, TYPE_PHONE);
+ ENUM_CASE(sync_pb::SyncEnums, TYPE_TABLET);
}
NOTREACHED();
return "";
diff --git a/sync/protocol/proto_enum_conversions.h b/sync/protocol/proto_enum_conversions.h
index c6af25f..ef34b05 100644
--- a/sync/protocol/proto_enum_conversions.h
+++ b/sync/protocol/proto_enum_conversions.h
@@ -39,7 +39,7 @@ const char* GetErrorTypeString(sync_pb::SyncEnums::ErrorType error_type);
const char* GetActionString(sync_pb::SyncEnums::Action action);
const char* GetDeviceTypeString(
- sync_pb::SessionHeader::DeviceType device_type);
+ sync_pb::SyncEnums::DeviceType device_type);
const char* GetFaviconTypeString(
sync_pb::SessionTab::FaviconType favicon_type);
diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc
index eb881de..53fd03e 100644
--- a/sync/protocol/proto_value_conversions.cc
+++ b/sync/protocol/proto_value_conversions.cc
@@ -191,12 +191,13 @@ DictionaryValue* PasswordSpecificsDataToValue(
return value;
}
-DictionaryValue* DeviceInformationToValue(
- const sync_pb::DeviceInformation& proto) {
+DictionaryValue* DeviceInfoSpecificsToValue(
+ const sync_pb::DeviceInfoSpecifics& proto) {
DictionaryValue* value = new DictionaryValue();
SET_STR(cache_guid);
- SET_STR(name);
- SET_STR(platform);
+ SET_STR(client_name);
+ SET_ENUM(device_type, GetDeviceTypeString);
+ SET_STR(sync_user_agent);
SET_STR(chrome_version);
return value;
}
@@ -313,7 +314,6 @@ DictionaryValue* NigoriSpecificsToValue(
SET_BOOL(encrypt_apps);
SET_BOOL(encrypt_search_engines);
SET_BOOL(encrypt_everything);
- SET_REP(device_information, DeviceInformationToValue);
SET_BOOL(sync_tab_favicons);
SET_ENUM(passphrase_type, PassphraseTypeString);
SET(keystore_decryptor_token, EncryptedDataToValue);
@@ -400,6 +400,7 @@ DictionaryValue* EntitySpecificsToValue(
SET_FIELD(autofill, AutofillSpecificsToValue);
SET_FIELD(autofill_profile, AutofillProfileSpecificsToValue);
SET_FIELD(bookmark, BookmarkSpecificsToValue);
+ SET_FIELD(device_info, DeviceInfoSpecificsToValue);
SET_FIELD(extension, ExtensionSpecificsToValue);
SET_FIELD(extension_setting, ExtensionSettingSpecificsToValue);
SET_FIELD(nigori, NigoriSpecificsToValue);
diff --git a/sync/protocol/proto_value_conversions.h b/sync/protocol/proto_value_conversions.h
index a1e938b..597b767 100644
--- a/sync/protocol/proto_value_conversions.h
+++ b/sync/protocol/proto_value_conversions.h
@@ -21,6 +21,7 @@ class AutofillSpecifics;
class BookmarkSpecifics;
class ClientToServerMessage;
class ClientToServerResponse;
+class DeviceInfoSpecifics;
class DeviceInformation;
class EncryptedData;
class EntitySpecifics;
@@ -81,11 +82,6 @@ base::DictionaryValue* TabNavigationToValue(
base::DictionaryValue* PasswordSpecificsDataToValue(
const sync_pb::PasswordSpecificsData& password_specifics_data);
-// Sub-protocol of NigoriSpecifics.
-
-base::DictionaryValue* DeviceInformationToValue(
- const sync_pb::DeviceInformation& device_information);
-
// Main *SpecificsToValue functions.
base::DictionaryValue* AppNotificationToValue(
@@ -118,6 +114,9 @@ base::DictionaryValue* NigoriSpecificsToValue(
base::DictionaryValue* PasswordSpecificsToValue(
const sync_pb::PasswordSpecifics& password_specifics);
+base::DictionaryValue* DeviceInfoSpecificsToValue(
+ const sync_pb::DeviceInfoSpecifics& device_info_specifics);
+
base::DictionaryValue* PreferenceSpecificsToValue(
const sync_pb::PreferenceSpecifics& password_specifics);
diff --git a/sync/protocol/proto_value_conversions_unittest.cc b/sync/protocol/proto_value_conversions_unittest.cc
index fd36450..91325e7 100644
--- a/sync/protocol/proto_value_conversions_unittest.cc
+++ b/sync/protocol/proto_value_conversions_unittest.cc
@@ -14,6 +14,7 @@
#include "sync/protocol/app_specifics.pb.h"
#include "sync/protocol/autofill_specifics.pb.h"
#include "sync/protocol/bookmark_specifics.pb.h"
+#include "sync/protocol/device_info_specifics.pb.h"
#include "sync/protocol/encryption.pb.h"
#include "sync/protocol/extension_setting_specifics.pb.h"
#include "sync/protocol/extension_specifics.pb.h"
@@ -47,7 +48,7 @@ TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) {
// If this number changes, that means we added or removed a data
// type. Don't forget to add a unit test for {New
// type}SpecificsToValue below.
- EXPECT_EQ(17, MODEL_TYPE_COUNT);
+ EXPECT_EQ(18, MODEL_TYPE_COUNT);
// We'd also like to check if we changed any field in our messages.
// However, that's hard to do: sizeof could work, but it's
@@ -136,6 +137,10 @@ TEST_F(ProtoValueConversionsTest, PasswordSpecificsToValue) {
TestSpecificsToValue(PasswordSpecificsToValue);
}
+TEST_F(ProtoValueConversionsTest, DeviceInfoSpecificsToValue) {
+ TestSpecificsToValue(DeviceInfoSpecificsToValue);
+}
+
TEST_F(ProtoValueConversionsTest, PreferenceSpecificsToValue) {
TestSpecificsToValue(PreferenceSpecificsToValue);
}
@@ -174,6 +179,7 @@ TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) {
SET_FIELD(extension_setting);
SET_FIELD(nigori);
SET_FIELD(password);
+ SET_FIELD(device_info);
SET_FIELD(preference);
SET_FIELD(search_engine);
SET_FIELD(session);
diff --git a/sync/protocol/session_specifics.proto b/sync/protocol/session_specifics.proto
index 2438ef6..972a80b 100644
--- a/sync/protocol/session_specifics.proto
+++ b/sync/protocol/session_specifics.proto
@@ -33,16 +33,7 @@ message SessionHeader {
// 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;
- TYPE_PHONE = 6;
- TYPE_TABLET = 7;
- }
- optional DeviceType device_type = 4;
+ optional SyncEnums.DeviceType device_type = 4;
}
message SessionWindow {
diff --git a/sync/protocol/sync.proto b/sync/protocol/sync.proto
index 618e129..a0ee10b 100644
--- a/sync/protocol/sync.proto
+++ b/sync/protocol/sync.proto
@@ -19,20 +19,21 @@ import "app_setting_specifics.proto";
import "app_specifics.proto";
import "autofill_specifics.proto";
import "bookmark_specifics.proto";
-import "get_updates_caller_info.proto";
+import "client_commands.proto";
+import "client_debug_info.proto";
+import "device_info_specifics.proto";
+import "encryption.proto";
import "extension_setting_specifics.proto";
import "extension_specifics.proto";
+import "get_updates_caller_info.proto";
import "nigori_specifics.proto";
import "password_specifics.proto";
import "preference_specifics.proto";
import "search_engine_specifics.proto";
import "session_specifics.proto";
+import "sync_enums.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.
@@ -97,6 +98,7 @@ message EntitySpecifics {
optional SearchEngineSpecifics search_engine = 88610;
optional ExtensionSettingSpecifics extension_setting = 96159;
optional AppSettingSpecifics app_setting = 103656;
+ optional DeviceInfoSpecifics device_info = 154522;
}
message SyncEntity {
diff --git a/sync/protocol/sync_enums.proto b/sync/protocol/sync_enums.proto
index 0c43729..40731f8 100644
--- a/sync/protocol/sync_enums.proto
+++ b/sync/protocol/sync_enums.proto
@@ -100,4 +100,14 @@ message SyncEnums {
// stop syncing.
UNKNOWN_ACTION = 5; // This is the default.
}
+
+ enum DeviceType {
+ TYPE_WIN = 1;
+ TYPE_MAC = 2;
+ TYPE_LINUX = 3;
+ TYPE_CROS = 4;
+ TYPE_OTHER = 5;
+ TYPE_PHONE = 6;
+ TYPE_TABLET = 7;
+ }
}
diff --git a/sync/protocol/sync_proto.gyp b/sync/protocol/sync_proto.gyp
index c9d5627..ce5aba6 100644
--- a/sync/protocol/sync_proto.gyp
+++ b/sync/protocol/sync_proto.gyp
@@ -18,10 +18,11 @@
'bookmark_specifics.proto',
'client_commands.proto',
'client_debug_info.proto',
- 'get_updates_caller_info.proto',
+ 'device_info_specifics.proto',
'encryption.proto',
'extension_setting_specifics.proto',
'extension_specifics.proto',
+ 'get_updates_caller_info.proto',
'nigori_specifics.proto',
'password_specifics.proto',
'preference_specifics.proto',