diff options
author | quiche <quiche@chromium.org> | 2014-10-30 14:32:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-30 21:32:56 +0000 |
commit | dfad17b4d9648cfa189f36b8c156d7296582bcfa (patch) | |
tree | 4c62a752d6a98623edc79c121bf2de1119da6296 /sync | |
parent | 00dc0d43eac8002ab5e1bc5fe44ce4119ce4aca4 (diff) | |
download | chromium_src-dfad17b4d9648cfa189f36b8c156d7296582bcfa.zip chromium_src-dfad17b4d9648cfa189f36b8c156d7296582bcfa.tar.gz chromium_src-dfad17b4d9648cfa189f36b8c156d7296582bcfa.tar.bz2 |
sync: add WIFI_CREDENTIALS protobuf, ModelType, and preference
- add a protobuf for WiFi credentials
- add a ModelType for syncing WiFi credentials
- add UI for controlling whether or not WiFi credentials are synced
- add new data type to testserver
While there:
- update comment in sync_setup_overlay.js
- fix ordering of arguments to EXPECT_EQ in CheckBool
(sync_setup_handler_unittest)
- move GetSelectableTypeNameMap from sync_setup_handler.cc to model_type.cc
BUG=chromium:422045
TEST=ProfileSync, SyncSetup, SyncModel, ModelType, NigoriUtil,
ProtoEnumConversions, ProtoValueConversions,
SyncEncryptionHandlerImpl
Review URL: https://codereview.chromium.org/674633002
Cr-Commit-Position: refs/heads/master@{#302159}
Diffstat (limited to 'sync')
-rw-r--r-- | sync/internal_api/public/base/model_type.h | 6 | ||||
-rw-r--r-- | sync/internal_api/public/sync_encryption_handler.cc | 4 | ||||
-rw-r--r-- | sync/internal_api/sync_encryption_handler_impl_unittest.cc | 12 | ||||
-rw-r--r-- | sync/protocol/BUILD.gn | 1 | ||||
-rw-r--r-- | sync/protocol/proto_enum_conversions.cc | 13 | ||||
-rw-r--r-- | sync/protocol/proto_enum_conversions.h | 3 | ||||
-rw-r--r-- | sync/protocol/proto_enum_conversions_unittest.cc | 7 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions.cc | 10 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions.h | 4 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions_unittest.cc | 8 | ||||
-rw-r--r-- | sync/protocol/sync.proto | 2 | ||||
-rw-r--r-- | sync/protocol/wifi_credential_specifics.proto | 58 | ||||
-rw-r--r-- | sync/sync.gyp | 1 | ||||
-rw-r--r-- | sync/syncable/model_type.cc | 51 | ||||
-rw-r--r-- | sync/syncable/nigori_util.cc | 4 | ||||
-rw-r--r-- | sync/tools/testserver/chromiumsync.py | 7 | ||||
-rw-r--r-- | sync/util/data_type_histogram.h | 3 |
17 files changed, 184 insertions, 10 deletions
diff --git a/sync/internal_api/public/base/model_type.h b/sync/internal_api/public/base/model_type.h index 61bcbd0..716bece 100644 --- a/sync/internal_api/public/base/model_type.h +++ b/sync/internal_api/public/base/model_type.h @@ -9,6 +9,7 @@ #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_MODEL_TYPE_H_ #define SYNC_INTERNAL_API_PUBLIC_BASE_MODEL_TYPE_H_ +#include <map> #include <set> #include <string> @@ -110,6 +111,9 @@ enum ModelType { ARTICLES, // App List items APP_LIST, + // WiFi credentials. Each item contains the information for connecting to one + // WiFi network. This includes, e.g., network name and password. + WIFI_CREDENTIALS, // ---- Proxy types ---- // Proxy types are excluded from the sync protocol, but are still considered @@ -145,6 +149,7 @@ typedef EnumSet<ModelType, FIRST_REAL_MODEL_TYPE, LAST_REAL_MODEL_TYPE> ModelTypeSet; typedef EnumSet<ModelType, UNSPECIFIED, LAST_REAL_MODEL_TYPE> FullModelTypeSet; +typedef std::map<syncer::ModelType, const char*> ModelTypeNameMap; inline ModelType ModelTypeFromInt(int i) { DCHECK_GE(i, 0); @@ -182,6 +187,7 @@ SYNC_EXPORT ModelTypeSet UserTypes(); // These are the user-selectable data types. SYNC_EXPORT ModelTypeSet UserSelectableTypes(); SYNC_EXPORT bool IsUserSelectableType(ModelType model_type); +SYNC_EXPORT ModelTypeNameMap GetUserSelectableTypeNameMap(); // This is the subset of UserTypes() that can be encrypted. SYNC_EXPORT_PRIVATE ModelTypeSet EncryptableUserTypes(); diff --git a/sync/internal_api/public/sync_encryption_handler.cc b/sync/internal_api/public/sync_encryption_handler.cc index e967600..f8eeeef 100644 --- a/sync/internal_api/public/sync_encryption_handler.cc +++ b/sync/internal_api/public/sync_encryption_handler.cc @@ -14,9 +14,9 @@ SyncEncryptionHandler::~SyncEncryptionHandler() {} // Static. ModelTypeSet SyncEncryptionHandler::SensitiveTypes() { - // It has its own encryption scheme, but we include it anyway. ModelTypeSet types; - types.Put(PASSWORDS); + types.Put(PASSWORDS); // Has its own encryption, but include it anyway. + types.Put(WIFI_CREDENTIALS); return types; } diff --git a/sync/internal_api/sync_encryption_handler_impl_unittest.cc b/sync/internal_api/sync_encryption_handler_impl_unittest.cc index 5aad1b0..d878fda 100644 --- a/sync/internal_api/sync_encryption_handler_impl_unittest.cc +++ b/sync/internal_api/sync_encryption_handler_impl_unittest.cc @@ -423,7 +423,8 @@ TEST_F(SyncEncryptionHandlerImplTest, EncryptEverythingExplicit) { EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); ModelTypeSet encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); - EXPECT_TRUE(encrypted_types.Equals(ModelTypeSet(PASSWORDS))); + EXPECT_TRUE(encrypted_types.Equals( + ModelTypeSet(PASSWORDS, WIFI_CREDENTIALS))); { WriteTransaction trans(FROM_HERE, user_share()); @@ -459,7 +460,8 @@ TEST_F(SyncEncryptionHandlerImplTest, EncryptEverythingImplicit) { EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); ModelTypeSet encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); - EXPECT_TRUE(encrypted_types.Equals(ModelTypeSet(PASSWORDS))); + EXPECT_TRUE(encrypted_types.Equals( + ModelTypeSet(PASSWORDS, WIFI_CREDENTIALS))); { WriteTransaction trans(FROM_HERE, user_share()); @@ -503,7 +505,8 @@ TEST_F(SyncEncryptionHandlerImplTest, UnknownSensitiveTypes) { EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); ModelTypeSet encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); - EXPECT_TRUE(encrypted_types.Equals(ModelTypeSet(PASSWORDS))); + EXPECT_TRUE(encrypted_types.Equals( + ModelTypeSet(PASSWORDS, WIFI_CREDENTIALS))); { WriteTransaction trans(FROM_HERE, user_share()); @@ -514,7 +517,8 @@ TEST_F(SyncEncryptionHandlerImplTest, UnknownSensitiveTypes) { EXPECT_FALSE(encryption_handler()->EncryptEverythingEnabled()); encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); - EXPECT_TRUE(encrypted_types.Equals(ModelTypeSet(BOOKMARKS, PASSWORDS))); + EXPECT_TRUE(encrypted_types.Equals( + ModelTypeSet(BOOKMARKS, PASSWORDS, WIFI_CREDENTIALS))); } // Receive an old nigori with old encryption keys and encrypted types. We should diff --git a/sync/protocol/BUILD.gn b/sync/protocol/BUILD.gn index d44846a..5bdca9d 100644 --- a/sync/protocol/BUILD.gn +++ b/sync/protocol/BUILD.gn @@ -46,6 +46,7 @@ proto_library("protocol") { "theme_specifics.proto", "typed_url_specifics.proto", "unique_position.proto", + "wifi_credential_specifics.proto", ] cc_generator_options = "dllexport_decl=SYNC_PROTO_EXPORT:" diff --git a/sync/protocol/proto_enum_conversions.cc b/sync/protocol/proto_enum_conversions.cc index 4c43983..eff952f 100644 --- a/sync/protocol/proto_enum_conversions.cc +++ b/sync/protocol/proto_enum_conversions.cc @@ -80,6 +80,19 @@ const char* GetPageTransitionRedirectTypeString( return ""; } +const char* GetWifiCredentialSecurityClassString( + sync_pb::WifiCredentialSpecifics::SecurityClass security_class) { + ASSERT_ENUM_BOUNDS(sync_pb::WifiCredentialSpecifics, SecurityClass, + SECURITY_CLASS_INVALID, SECURITY_CLASS_PSK); + switch (security_class) { + ENUM_CASE(sync_pb::WifiCredentialSpecifics, SECURITY_CLASS_INVALID); + ENUM_CASE(sync_pb::WifiCredentialSpecifics, SECURITY_CLASS_NONE); + ENUM_CASE(sync_pb::WifiCredentialSpecifics, SECURITY_CLASS_WEP); + ENUM_CASE(sync_pb::WifiCredentialSpecifics, SECURITY_CLASS_PSK); + } + NOTREACHED(); + return ""; +} const char* GetUpdatesSourceString( sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source) { ASSERT_ENUM_BOUNDS(sync_pb::GetUpdatesCallerInfo, GetUpdatesSource, diff --git a/sync/protocol/proto_enum_conversions.h b/sync/protocol/proto_enum_conversions.h index 57a7b5c..6a6bbdc 100644 --- a/sync/protocol/proto_enum_conversions.h +++ b/sync/protocol/proto_enum_conversions.h @@ -35,6 +35,9 @@ SYNC_EXPORT_PRIVATE const char* GetPageTransitionRedirectTypeString( sync_pb::SyncEnums::PageTransitionRedirectType redirect_type); +SYNC_EXPORT_PRIVATE const char* GetWifiCredentialSecurityClassString( + sync_pb::WifiCredentialSpecifics::SecurityClass security_class); + SYNC_EXPORT const char* GetUpdatesSourceString( sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source); diff --git a/sync/protocol/proto_enum_conversions_unittest.cc b/sync/protocol/proto_enum_conversions_unittest.cc index d566436..db88a8f 100644 --- a/sync/protocol/proto_enum_conversions_unittest.cc +++ b/sync/protocol/proto_enum_conversions_unittest.cc @@ -53,6 +53,13 @@ TEST_F(ProtoEnumConversionsTest, GetPageTransitionQualifierString) { sync_pb::SyncEnums::PageTransitionRedirectType_MAX); } +TEST_F(ProtoEnumConversionsTest, GetWifiCredentialSecurityClassString) { + TestEnumStringFunction( + GetWifiCredentialSecurityClassString, + sync_pb::WifiCredentialSpecifics::SecurityClass_MIN, + sync_pb::WifiCredentialSpecifics::SecurityClass_MAX); +} + TEST_F(ProtoEnumConversionsTest, GetUpdatesSourceString) { TestEnumStringFunction( GetUpdatesSourceString, diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc index 56a2704..cc022c4 100644 --- a/sync/protocol/proto_value_conversions.cc +++ b/sync/protocol/proto_value_conversions.cc @@ -783,6 +783,15 @@ base::DictionaryValue* TypedUrlSpecificsToValue( return value; } +base::DictionaryValue* WifiCredentialSpecificsToValue( + const sync_pb::WifiCredentialSpecifics& proto) { + base::DictionaryValue* value = new base::DictionaryValue(); + SET_BYTES(ssid); + SET_ENUM(security_class, GetWifiCredentialSecurityClassString); + SET_BYTES(passphrase); + return value; +} + base::DictionaryValue* EntitySpecificsToValue( const sync_pb::EntitySpecifics& specifics) { base::DictionaryValue* value = new base::DictionaryValue(); @@ -817,6 +826,7 @@ base::DictionaryValue* EntitySpecificsToValue( SyncedNotificationAppInfoSpecificsToValue); SET_FIELD(theme, ThemeSpecificsToValue); SET_FIELD(typed_url, TypedUrlSpecificsToValue); + SET_FIELD(wifi_credential, WifiCredentialSpecificsToValue); return value; } diff --git a/sync/protocol/proto_value_conversions.h b/sync/protocol/proto_value_conversions.h index 2a3c1ae..79e4ca2 100644 --- a/sync/protocol/proto_value_conversions.h +++ b/sync/protocol/proto_value_conversions.h @@ -78,6 +78,7 @@ class Target; class ThemeSpecifics; class TimeRangeDirective; class TypedUrlSpecifics; +class WifiCredentialSpecifics; } // namespace sync_pb // Utility functions to convert sync protocol buffers to dictionaries. @@ -274,6 +275,9 @@ SYNC_EXPORT_PRIVATE base::DictionaryValue* ThemeSpecificsToValue( SYNC_EXPORT_PRIVATE base::DictionaryValue* TypedUrlSpecificsToValue( const sync_pb::TypedUrlSpecifics& typed_url_specifics); +SYNC_EXPORT_PRIVATE base::DictionaryValue* WifiCredentialSpecificsToValue( + const sync_pb::WifiCredentialSpecifics& wifi_credential_specifics); + // Any present extensions are mapped to sub-dictionary values with the // key equal to the extension name. SYNC_EXPORT_PRIVATE base::DictionaryValue* EntitySpecificsToValue( diff --git a/sync/protocol/proto_value_conversions_unittest.cc b/sync/protocol/proto_value_conversions_unittest.cc index 664a6ab..76aab6a 100644 --- a/sync/protocol/proto_value_conversions_unittest.cc +++ b/sync/protocol/proto_value_conversions_unittest.cc @@ -35,6 +35,7 @@ #include "sync/protocol/sync.pb.h" #include "sync/protocol/theme_specifics.pb.h" #include "sync/protocol/typed_url_specifics.pb.h" +#include "sync/protocol/wifi_credential_specifics.pb.h" #include "testing/gtest/include/gtest/gtest.h" namespace syncer { @@ -55,7 +56,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(32, MODEL_TYPE_COUNT); + EXPECT_EQ(33, 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 @@ -264,6 +265,10 @@ TEST_F(ProtoValueConversionsTest, ArticleSpecificsToValue) { TestSpecificsToValue(ArticleSpecificsToValue); } +TEST_F(ProtoValueConversionsTest, WifiCredentialSpecificsToValue) { + TestSpecificsToValue(WifiCredentialSpecificsToValue); +} + // TODO(akalin): Figure out how to better test EntitySpecificsToValue. TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) { @@ -301,6 +306,7 @@ TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) { SET_FIELD(synced_notification_app_info); SET_FIELD(theme); SET_FIELD(typed_url); + SET_FIELD(wifi_credential); #undef SET_FIELD diff --git a/sync/protocol/sync.proto b/sync/protocol/sync.proto index 8f27850..53c99ec 100644 --- a/sync/protocol/sync.proto +++ b/sync/protocol/sync.proto @@ -49,6 +49,7 @@ import "synced_notification_specifics.proto"; import "theme_specifics.proto"; import "typed_url_specifics.proto"; import "unique_position.proto"; +import "wifi_credential_specifics.proto"; // Used for inspecting how long we spent performing operations in different // backends. All times must be in millis. @@ -129,6 +130,7 @@ message EntitySpecifics { 202026; optional ArticleSpecifics article = 223759; optional AppListSpecifics app_list = 229170; + optional WifiCredentialSpecifics wifi_credential = 218175; } message SyncEntity { diff --git a/sync/protocol/wifi_credential_specifics.proto b/sync/protocol/wifi_credential_specifics.proto new file mode 100644 index 0000000..29f9f07 --- /dev/null +++ b/sync/protocol/wifi_credential_specifics.proto @@ -0,0 +1,58 @@ +// Copyright 2014 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 WiFi credentials. + +// Update proto_{value,enum}_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 WiFi credential objects. +message WifiCredentialSpecifics { + optional bytes ssid = 1; // Not necessarily UTF-8. May contain NUL. + + enum SecurityClass { + SECURITY_CLASS_INVALID = 0; + SECURITY_CLASS_NONE = 1; + SECURITY_CLASS_WEP = 2; + SECURITY_CLASS_PSK = 3; // WPA-PSK or RSN-PSK + // 802.1X is omittted, as we do not support syncing 802.1X + // credentials. + } + optional SecurityClass security_class = 2; + + // Network passphrase. + // + // For SECURITY_CLASS_NONE, the passphrase should be ignored. + // + // For SECURITY_CLASS_WEP, the passphrase should have one of the + // following formats: + // - WEP-40: + // - 5 character ASCII string. Each character maps one byte of the key. + // - 10 character hex string. The string maps to the WEP key by simple + // hex decoding. + // - WEP-104: + // - 13 character ASCII string. Each character maps one byte of the key. + // - 26 character hex string. The string maps to the WEP key by simple + // hex decoding. + // + // For SECURITY_CLASS_PSK, the passphrase should have one of the + // following two formats: + // - An 8-63 character ASCII string. The string maps to the + // WPA/WPA-2 PSK as per IEEE 802.11i. + // - A 64 character hex string. The string maps to the PSK per + // simple hex decoding. + // + // Note that, although the passphrase "should" contain only ASCII + // characters, we represent |passphrase| as |bytes| rather than + // |string|. This is to accomodate networks that use non-ASCII + // passphrases. + optional bytes passphrase = 3; +} diff --git a/sync/sync.gyp b/sync/sync.gyp index 73beca3..cfb658f 100644 --- a/sync/sync.gyp +++ b/sync/sync.gyp @@ -506,6 +506,7 @@ 'protocol/theme_specifics.proto', 'protocol/typed_url_specifics.proto', 'protocol/unique_position.proto', + 'protocol/wifi_credential_specifics.proto', ], 'variables': { 'enable_wexit_time_destructors': 1, diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc index 59be6f2..5b92c78 100644 --- a/sync/syncable/model_type.cc +++ b/sync/syncable/model_type.cc @@ -25,6 +25,28 @@ namespace syncer { +// Notes: +// 1) This list must contain exactly the same elements as the set returned by +// UserSelectableTypes(). +// 2) This list must be in the same order as the respective values in the +// ModelType enum. +const char* kUserSelectableDataTypeNames[] = { + "bookmarks", + "preferences", + "passwords", + "autofill", + "themes", + "typedUrls", + "extensions", + "apps", + "wifiCredentials", + "tabs", +}; + +COMPILE_ASSERT( + 33 == MODEL_TYPE_COUNT, + update_kUserSelectableDataTypeNames_to_match_UserSelectableTypes); + void AddDefaultFieldValue(ModelType datatype, sync_pb::EntitySpecifics* specifics) { if (!ProtocolTypes().Has(datatype)) { @@ -119,6 +141,9 @@ void AddDefaultFieldValue(ModelType datatype, case ARTICLES: specifics->mutable_article(); break; + case WIFI_CREDENTIALS: + specifics->mutable_wifi_credential(); + break; default: NOTREACHED() << "No known extension for model type."; } @@ -196,6 +221,8 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) { return sync_pb::EntitySpecifics::kManagedUserSharedSettingFieldNumber; case ARTICLES: return sync_pb::EntitySpecifics::kArticleFieldNumber; + case WIFI_CREDENTIALS: + return sync_pb::EntitySpecifics::kWifiCredentialFieldNumber; default: NOTREACHED() << "No known extension for model type."; return 0; @@ -324,6 +351,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) { if (specifics.has_article()) return ARTICLES; + if (specifics.has_wifi_credential()) + return WIFI_CREDENTIALS; + return UNSPECIFIED; } @@ -356,6 +386,7 @@ ModelTypeSet UserSelectableTypes() { set.Put(TYPED_URLS); set.Put(EXTENSIONS); set.Put(APPS); + set.Put(WIFI_CREDENTIALS); set.Put(PROXY_TABS); return set; } @@ -364,6 +395,18 @@ bool IsUserSelectableType(ModelType model_type) { return UserSelectableTypes().Has(model_type); } +ModelTypeNameMap GetUserSelectableTypeNameMap() { + ModelTypeNameMap type_names; + ModelTypeSet type_set = UserSelectableTypes(); + ModelTypeSet::Iterator it = type_set.First(); + DCHECK_EQ(arraysize(kUserSelectableDataTypeNames), type_set.Size()); + for (size_t i = 0; i < arraysize(kUserSelectableDataTypeNames) && it.Good(); + ++i, it.Inc()) { + type_names[it.Get()] = kUserSelectableDataTypeNames[i]; + } + return type_names; +} + ModelTypeSet EncryptableUserTypes() { ModelTypeSet encryptable_user_types = UserTypes(); // We never encrypt history delete directives. @@ -524,6 +567,8 @@ const char* ModelTypeToString(ModelType model_type) { return "Managed User Shared Settings"; case ARTICLES: return "Articles"; + case WIFI_CREDENTIALS: + return "WiFi Credentials"; case PROXY_TABS: return "Tabs"; default: @@ -603,6 +648,8 @@ int ModelTypeToHistogramInt(ModelType model_type) { return 30; case SYNCED_NOTIFICATION_APP_INFO: return 31; + case WIFI_CREDENTIALS: + return 32; // Silence a compiler warning. case MODEL_TYPE_COUNT: return 0; @@ -696,6 +743,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) { return SUPERVISED_USER_SHARED_SETTINGS; else if (model_type_string == "Articles") return ARTICLES; + else if (model_type_string == "WiFi Credentials") + return WIFI_CREDENTIALS; else if (model_type_string == "Tabs") return PROXY_TABS; else @@ -820,6 +869,8 @@ std::string ModelTypeToRootTag(ModelType type) { return "google_chrome_managed_user_shared_settings"; case ARTICLES: return "google_chrome_articles"; + case WIFI_CREDENTIALS: + return "google_chrome_wifi_credentials"; case PROXY_TABS: return std::string(); default: diff --git a/sync/syncable/nigori_util.cc b/sync/syncable/nigori_util.cc index 63dbcac..eaf9eca 100644 --- a/sync/syncable/nigori_util.cc +++ b/sync/syncable/nigori_util.cc @@ -243,7 +243,7 @@ void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, bool encrypt_everything, sync_pb::NigoriSpecifics* nigori) { nigori->set_encrypt_everything(encrypt_everything); - COMPILE_ASSERT(32 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); + COMPILE_ASSERT(33 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); nigori->set_encrypt_bookmarks( encrypted_types.Has(BOOKMARKS)); nigori->set_encrypt_preferences( @@ -279,7 +279,7 @@ ModelTypeSet GetEncryptedTypesFromNigori( return ModelTypeSet::All(); ModelTypeSet encrypted_types; - COMPILE_ASSERT(32 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); + COMPILE_ASSERT(33 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); if (nigori.encrypt_bookmarks()) encrypted_types.Put(BOOKMARKS); if (nigori.encrypt_preferences()) diff --git a/sync/tools/testserver/chromiumsync.py b/sync/tools/testserver/chromiumsync.py index 2930059..5487ef2 100644 --- a/sync/tools/testserver/chromiumsync.py +++ b/sync/tools/testserver/chromiumsync.py @@ -55,6 +55,7 @@ import synced_notification_render_pb2 import synced_notification_specifics_pb2 import theme_specifics_pb2 import typed_url_specifics_pb2 +import wifi_credential_specifics_pb2 # An enumeration of the various kinds of data that can be synced. # Over the wire, this enumeration is not used: a sync object's type is @@ -90,7 +91,8 @@ ALL_TYPES = ( TYPED_URL, EXTENSION_SETTINGS, FAVICON_IMAGES, - FAVICON_TRACKING) = range(30) + FAVICON_TRACKING, + WIFI_CREDENTIAL) = range(31) # An enumeration on the frequency at which the server should send errors # to the client. This would be specified by the url that triggers the error. @@ -138,6 +140,7 @@ SYNC_TYPE_TO_DESCRIPTOR = { SYNC_TYPE_FIELDS["synced_notification_app_info"], THEME: SYNC_TYPE_FIELDS['theme'], TYPED_URL: SYNC_TYPE_FIELDS['typed_url'], + WIFI_CREDENTIAL: SYNC_TYPE_FIELDS["wifi_credential"], } # The parent ID used to indicate a top-level node. @@ -560,6 +563,8 @@ class SyncDataModel(object): parent_tag=ROOT_ID, sync_type=THEME), PermanentItem('google_chrome_typed_urls', name='Typed URLs', parent_tag=ROOT_ID, sync_type=TYPED_URL), + PermanentItem('google_chrome_wifi_credentials', name='WiFi Credentials', + parent_tag=ROOT_ID, sync_type=WIFI_CREDENTIAL), PermanentItem('google_chrome_dictionary', name='Dictionary', parent_tag=ROOT_ID, sync_type=DICTIONARY), PermanentItem('google_chrome_articles', name='Articles', diff --git a/sync/util/data_type_histogram.h b/sync/util/data_type_histogram.h index b5e0eda..1baaba3 100644 --- a/sync/util/data_type_histogram.h +++ b/sync/util/data_type_histogram.h @@ -123,6 +123,9 @@ case ::syncer::ARTICLES: \ PER_DATA_TYPE_MACRO("Article"); \ break; \ + case ::syncer::WIFI_CREDENTIALS: \ + PER_DATA_TYPE_MACRO("WifiCredentials"); \ + break; \ case ::syncer::PROXY_TABS: \ PER_DATA_TYPE_MACRO("Tabs"); \ break; \ |