Commit b40e52d7 authored by bauerb@chromium.org's avatar bauerb@chromium.org

Add ManagedUserSettings Sync data type.

This data type should not be visible in the UI, as it will be configured automatically for managed users.

TBR=atwilson@chromium.org
BUG=229383

Review URL: https://codereview.chromium.org/14053004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194582 0039d316-1c4b-4281-b951-d872f2087c98
parent be97da1b
...@@ -41,6 +41,7 @@ static const syncer::ModelType kStartOrder[] = { ...@@ -41,6 +41,7 @@ static const syncer::ModelType kStartOrder[] = {
syncer::DICTIONARY, syncer::DICTIONARY,
syncer::FAVICON_IMAGES, syncer::FAVICON_IMAGES,
syncer::FAVICON_TRACKING, syncer::FAVICON_TRACKING,
syncer::MANAGED_USER_SETTINGS,
syncer::AUTOFILL, // Non-UI thread datatypes. syncer::AUTOFILL, // Non-UI thread datatypes.
syncer::AUTOFILL_PROFILE, syncer::AUTOFILL_PROFILE,
syncer::EXTENSION_SETTINGS, syncer::EXTENSION_SETTINGS,
......
...@@ -1414,7 +1414,7 @@ const browser_sync::user_selectable_type::UserSelectableSyncType ...@@ -1414,7 +1414,7 @@ const browser_sync::user_selectable_type::UserSelectableSyncType
browser_sync::user_selectable_type::PROXY_TABS browser_sync::user_selectable_type::PROXY_TABS
}; };
COMPILE_ASSERT(26 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram); COMPILE_ASSERT(27 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram);
if (!sync_everything) { if (!sync_everything) {
const syncer::ModelTypeSet current_types = GetPreferredDataTypes(); const syncer::ModelTypeSet current_types = GetPreferredDataTypes();
......
...@@ -340,6 +340,8 @@ const char* SyncPrefs::GetPrefNameForDataType(syncer::ModelType data_type) { ...@@ -340,6 +340,8 @@ const char* SyncPrefs::GetPrefNameForDataType(syncer::ModelType data_type) {
return prefs::kSyncFaviconImages; return prefs::kSyncFaviconImages;
case syncer::FAVICON_TRACKING: case syncer::FAVICON_TRACKING:
return prefs::kSyncFaviconTracking; return prefs::kSyncFaviconTracking;
case syncer::MANAGED_USER_SETTINGS:
return prefs::kSyncManagedUserSettings;
case syncer::PROXY_TABS: case syncer::PROXY_TABS:
return prefs::kSyncTabs; return prefs::kSyncTabs;
case syncer::PRIORITY_PREFERENCES: case syncer::PRIORITY_PREFERENCES:
......
// Copyright (c) 2013 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.
#include "base/prefs/pref_service.h"
#include "chrome/browser/managed_mode/managed_user_service.h"
#include "chrome/browser/managed_mode/managed_user_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/common/pref_names.h"
class SingleClientManagedUserSettingsSyncTest : public SyncTest {
public:
SingleClientManagedUserSettingsSyncTest() : SyncTest(SINGLE_CLIENT) {}
virtual ~SingleClientManagedUserSettingsSyncTest() {}
};
IN_PROC_BROWSER_TEST_F(SingleClientManagedUserSettingsSyncTest, Sanity) {
ASSERT_TRUE(SetupClients());
for (int i = 0; i < num_clients(); ++i) {
Profile* profile = GetProfile(i);
profile->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, true);
ManagedUserServiceFactory::GetForProfile(profile)->Init();
}
ASSERT_TRUE(SetupSync());
}
...@@ -87,7 +87,7 @@ const char* kDataTypeNames[] = { ...@@ -87,7 +87,7 @@ const char* kDataTypeNames[] = {
"tabs" "tabs"
}; };
COMPILE_ASSERT(26 == syncer::MODEL_TYPE_COUNT, COMPILE_ASSERT(27 == syncer::MODEL_TYPE_COUNT,
update_kDataTypeNames_to_match_UserSelectableTypes); update_kDataTypeNames_to_match_UserSelectableTypes);
typedef std::map<syncer::ModelType, const char*> ModelTypeNameMap; typedef std::map<syncer::ModelType, const char*> ModelTypeNameMap;
......
...@@ -2391,6 +2391,7 @@ ...@@ -2391,6 +2391,7 @@
'browser/sync/test/integration/single_client_bookmarks_sync_test.cc', 'browser/sync/test/integration/single_client_bookmarks_sync_test.cc',
'browser/sync/test/integration/single_client_dictionary_sync_test.cc', 'browser/sync/test/integration/single_client_dictionary_sync_test.cc',
'browser/sync/test/integration/single_client_extensions_sync_test.cc', 'browser/sync/test/integration/single_client_extensions_sync_test.cc',
'browser/sync/test/integration/single_client_managed_user_settings_sync_test.cc',
'browser/sync/test/integration/single_client_passwords_sync_test.cc', 'browser/sync/test/integration/single_client_passwords_sync_test.cc',
'browser/sync/test/integration/single_client_preferences_sync_test.cc', 'browser/sync/test/integration/single_client_preferences_sync_test.cc',
'browser/sync/test/integration/single_client_search_engines_sync_test.cc', 'browser/sync/test/integration/single_client_search_engines_sync_test.cc',
......
...@@ -1730,27 +1730,28 @@ const char kSyncKeepEverythingSynced[] = "sync.keep_everything_synced"; ...@@ -1730,27 +1730,28 @@ const char kSyncKeepEverythingSynced[] = "sync.keep_everything_synced";
// Booleans specifying whether the user has selected to sync the following // Booleans specifying whether the user has selected to sync the following
// datatypes. // datatypes.
const char kSyncBookmarks[] = "sync.bookmarks";
const char kSyncPasswords[] = "sync.passwords";
const char kSyncPreferences[] = "sync.preferences";
const char kSyncPriorityPreferences[] = "sync.priority_preferences";
const char kSyncAppNotifications[] = "sync.app_notifications"; const char kSyncAppNotifications[] = "sync.app_notifications";
const char kSyncAppSettings[] = "sync.app_settings"; const char kSyncAppSettings[] = "sync.app_settings";
const char kSyncApps[] = "sync.apps"; const char kSyncApps[] = "sync.apps";
const char kSyncAutofill[] = "sync.autofill";
const char kSyncAutofillProfile[] = "sync.autofill_profile"; const char kSyncAutofillProfile[] = "sync.autofill_profile";
const char kSyncThemes[] = "sync.themes"; const char kSyncAutofill[] = "sync.autofill";
const char kSyncTypedUrls[] = "sync.typed_urls"; const char kSyncBookmarks[] = "sync.bookmarks";
const char kSyncExtensions[] = "sync.extensions"; const char kSyncDictionary[] = "sync.dictionary";
const char kSyncExtensionSettings[] = "sync.extension_settings"; const char kSyncExtensionSettings[] = "sync.extension_settings";
const char kSyncExtensions[] = "sync.extensions";
const char kSyncFaviconImages[] = "sync.favicon_images";
const char kSyncFaviconTracking[] = "sync.favicon_tracking";
const char kSyncHistoryDeleteDirectives[] = "sync.history_delete_directives";
const char kSyncManagedUserSettings[] = "sync.managed_user_settings";
const char kSyncPasswords[] = "sync.passwords";
const char kSyncPreferences[] = "sync.preferences";
const char kSyncPriorityPreferences[] = "sync.priority_preferences";
const char kSyncSearchEngines[] = "sync.search_engines"; const char kSyncSearchEngines[] = "sync.search_engines";
const char kSyncSessions[] = "sync.sessions"; const char kSyncSessions[] = "sync.sessions";
const char kSyncHistoryDeleteDirectives[] = "sync.history_delete_directives";
const char kSyncSyncedNotifications[] = "sync.synced_notifications"; const char kSyncSyncedNotifications[] = "sync.synced_notifications";
const char kSyncDictionary[] = "sync.dictionary";
const char kSyncFaviconImages[] = "sync.favicon_images";
const char kSyncFaviconTracking[] = "sync.favicon_tracking";
const char kSyncTabs[] = "sync.tabs"; const char kSyncTabs[] = "sync.tabs";
const char kSyncThemes[] = "sync.themes";
const char kSyncTypedUrls[] = "sync.typed_urls";
// Boolean used by enterprise configuration management in order to lock down // Boolean used by enterprise configuration management in order to lock down
// sync. // sync.
......
...@@ -605,29 +605,32 @@ extern const char kSigninAllowed[]; ...@@ -605,29 +605,32 @@ extern const char kSigninAllowed[];
extern const char kSyncLastSyncedTime[]; extern const char kSyncLastSyncedTime[];
extern const char kSyncHasSetupCompleted[]; extern const char kSyncHasSetupCompleted[];
extern const char kSyncKeepEverythingSynced[]; extern const char kSyncKeepEverythingSynced[];
extern const char kSyncBookmarks[];
extern const char kSyncPasswords[];
extern const char kSyncPreferences[];
extern const char kSyncPriorityPreferences[];
extern const char kSyncAppNotifications[]; extern const char kSyncAppNotifications[];
extern const char kSyncAppSettings[]; extern const char kSyncAppSettings[];
extern const char kSyncApps[]; extern const char kSyncApps[];
extern const char kSyncAutofill[];
extern const char kSyncAutofillProfile[]; extern const char kSyncAutofillProfile[];
extern const char kSyncAutofill[];
extern const char kSyncBookmarks[];
extern const char kSyncDictionary[];
extern const char kSyncExtensionSettings[];
extern const char kSyncExtensions[];
extern const char kSyncFaviconImages[]; extern const char kSyncFaviconImages[];
extern const char kSyncFaviconTracking[]; extern const char kSyncFaviconTracking[];
extern const char kSyncThemes[];
extern const char kSyncTypedUrls[];
extern const char kSyncExtensions[];
extern const char kSyncExtensionSettings[];
extern const char kSyncHistoryDeleteDirectives[]; extern const char kSyncHistoryDeleteDirectives[];
extern const char kSyncDictionary[]; extern const char kSyncManagedUserSettings[];
extern const char kSyncManaged[]; extern const char kSyncPasswords[];
extern const char kSyncPreferences[];
extern const char kSyncPriorityPreferences[];
extern const char kSyncSearchEngines[]; extern const char kSyncSearchEngines[];
extern const char kSyncSessions[]; extern const char kSyncSessions[];
extern const char kSyncSuppressStart[];
extern const char kSyncSyncedNotifications[]; extern const char kSyncSyncedNotifications[];
extern const char kSyncTabs[]; extern const char kSyncTabs[];
extern const char kSyncThemes[];
extern const char kSyncTypedUrls[];
extern const char kSyncManaged[];
extern const char kSyncSuppressStart[];
extern const char kGoogleServicesLastUsername[]; extern const char kGoogleServicesLastUsername[];
extern const char kGoogleServicesUsername[]; extern const char kGoogleServicesUsername[];
extern const char kGoogleServicesUsernamePattern[]; extern const char kGoogleServicesUsernamePattern[];
......
...@@ -329,6 +329,12 @@ const sync_pb::SessionSpecifics& BaseNode::GetSessionSpecifics() const { ...@@ -329,6 +329,12 @@ const sync_pb::SessionSpecifics& BaseNode::GetSessionSpecifics() const {
return GetEntitySpecifics().session(); return GetEntitySpecifics().session();
} }
const sync_pb::ManagedUserSettingSpecifics&
BaseNode::GetManagedUserSettingSpecifics() const {
DCHECK_EQ(GetModelType(), MANAGED_USER_SETTINGS);
return GetEntitySpecifics().managed_user_setting();
}
const sync_pb::DeviceInfoSpecifics& BaseNode::GetDeviceInfoSpecifics() const { const sync_pb::DeviceInfoSpecifics& BaseNode::GetDeviceInfoSpecifics() const {
DCHECK_EQ(GetModelType(), DEVICE_INFO); DCHECK_EQ(GetModelType(), DEVICE_INFO);
return GetEntitySpecifics().device_info(); return GetEntitySpecifics().device_info();
......
...@@ -93,6 +93,8 @@ enum ModelType { ...@@ -93,6 +93,8 @@ enum ModelType {
// These preferences are synced before other user types and are never // These preferences are synced before other user types and are never
// encrypted. // encrypted.
PRIORITY_PREFERENCES, PRIORITY_PREFERENCES,
// Managed user settings.
MANAGED_USER_SETTINGS,
// ---- Proxy types ---- // ---- Proxy types ----
// Proxy types are excluded from the sync protocol, but are still considered // Proxy types are excluded from the sync protocol, but are still considered
......
...@@ -153,6 +153,11 @@ class SYNC_EXPORT BaseNode { ...@@ -153,6 +153,11 @@ class SYNC_EXPORT BaseNode {
// data. Can only be called if GetModelType() == SESSIONS. // data. Can only be called if GetModelType() == SESSIONS.
const sync_pb::SessionSpecifics& GetSessionSpecifics() const; const sync_pb::SessionSpecifics& GetSessionSpecifics() const;
// Getter specific to the MANAGED_USER_SETTINGS datatype. Returns protobuf
// data. Can only be called if GetModelType() == MANAGED_USER_SETTINGS.
const sync_pb::ManagedUserSettingSpecifics&
GetManagedUserSettingSpecifics() const;
// Getter specific to the DEVICE_INFO datatype. Returns protobuf // Getter specific to the DEVICE_INFO datatype. Returns protobuf
// data. Can only be called if GetModelType() == DEVICE_INFO. // data. Can only be called if GetModelType() == DEVICE_INFO.
const sync_pb::DeviceInfoSpecifics& GetDeviceInfoSpecifics() const; const sync_pb::DeviceInfoSpecifics& GetDeviceInfoSpecifics() const;
......
...@@ -160,6 +160,11 @@ class SYNC_EXPORT WriteNode : public BaseNode { ...@@ -160,6 +160,11 @@ class SYNC_EXPORT WriteNode : public BaseNode {
// Should only be called if GetModelType() == SESSIONS. // Should only be called if GetModelType() == SESSIONS.
void SetSessionSpecifics(const sync_pb::SessionSpecifics& specifics); void SetSessionSpecifics(const sync_pb::SessionSpecifics& specifics);
// Set the managed user setting specifics (name and value).
// Should only be called if GetModelType() == MANAGED_USER_SETTINGS.
void SetManagedUserSettingSpecifics(
const sync_pb::ManagedUserSettingSpecifics& specifics);
// Set the device info specifics. // Set the device info specifics.
// Should only be called if GetModelType() == DEVICE_INFO. // Should only be called if GetModelType() == DEVICE_INFO.
void SetDeviceInfoSpecifics(const sync_pb::DeviceInfoSpecifics& specifics); void SetDeviceInfoSpecifics(const sync_pb::DeviceInfoSpecifics& specifics);
......
...@@ -186,6 +186,13 @@ void WriteNode::SetSessionSpecifics( ...@@ -186,6 +186,13 @@ void WriteNode::SetSessionSpecifics(
SetEntitySpecifics(entity_specifics); SetEntitySpecifics(entity_specifics);
} }
void WriteNode::SetManagedUserSettingSpecifics(
const sync_pb::ManagedUserSettingSpecifics& new_value) {
sync_pb::EntitySpecifics entity_specifics;
entity_specifics.mutable_managed_user_setting()->CopyFrom(new_value);
SetEntitySpecifics(entity_specifics);
}
void WriteNode::SetDeviceInfoSpecifics( void WriteNode::SetDeviceInfoSpecifics(
const sync_pb::DeviceInfoSpecifics& new_value) { const sync_pb::DeviceInfoSpecifics& new_value) {
sync_pb::EntitySpecifics entity_specifics; sync_pb::EntitySpecifics entity_specifics;
......
// Copyright (c) 2013 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 managed user settings.
// 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 managed user setting sync objects.
message ManagedUserSettingSpecifics {
optional string name = 1;
optional string value = 2;
}
...@@ -402,6 +402,14 @@ base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue( ...@@ -402,6 +402,14 @@ base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue(
return value; return value;
} }
base::DictionaryValue* ManagedUserSettingSpecificsToValue(
const sync_pb::ManagedUserSettingSpecifics& proto) {
base::DictionaryValue* value = new base::DictionaryValue();
SET_STR(name);
SET_STR(value);
return value;
}
base::DictionaryValue* NigoriSpecificsToValue( base::DictionaryValue* NigoriSpecificsToValue(
const sync_pb::NigoriSpecifics& proto) { const sync_pb::NigoriSpecifics& proto) {
base::DictionaryValue* value = new base::DictionaryValue(); base::DictionaryValue* value = new base::DictionaryValue();
...@@ -530,6 +538,7 @@ base::DictionaryValue* EntitySpecificsToValue( ...@@ -530,6 +538,7 @@ base::DictionaryValue* EntitySpecificsToValue(
SET_FIELD(favicon_image, FaviconImageSpecificsToValue); SET_FIELD(favicon_image, FaviconImageSpecificsToValue);
SET_FIELD(favicon_tracking, FaviconTrackingSpecificsToValue); SET_FIELD(favicon_tracking, FaviconTrackingSpecificsToValue);
SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue); SET_FIELD(history_delete_directive, HistoryDeleteDirectiveSpecificsToValue);
SET_FIELD(managed_user_setting, ManagedUserSettingSpecificsToValue);
SET_FIELD(nigori, NigoriSpecificsToValue); SET_FIELD(nigori, NigoriSpecificsToValue);
SET_FIELD(password, PasswordSpecificsToValue); SET_FIELD(password, PasswordSpecificsToValue);
SET_FIELD(preference, PreferenceSpecificsToValue); SET_FIELD(preference, PreferenceSpecificsToValue);
......
...@@ -41,6 +41,7 @@ class FaviconTrackingSpecifics; ...@@ -41,6 +41,7 @@ class FaviconTrackingSpecifics;
class GlobalIdDirective; class GlobalIdDirective;
class HistoryDeleteDirectiveSpecifics; class HistoryDeleteDirectiveSpecifics;
class KeystoreEncryptionFlagsSpecifics; class KeystoreEncryptionFlagsSpecifics;
class ManagedUserSettingSpecifics;
class NigoriSpecifics; class NigoriSpecifics;
class PasswordSpecifics; class PasswordSpecifics;
class PasswordSpecificsData; class PasswordSpecificsData;
...@@ -166,6 +167,9 @@ SYNC_EXPORT base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue( ...@@ -166,6 +167,9 @@ SYNC_EXPORT base::DictionaryValue* HistoryDeleteDirectiveSpecificsToValue(
const sync_pb::HistoryDeleteDirectiveSpecifics& const sync_pb::HistoryDeleteDirectiveSpecifics&
history_delete_directive_specifics); history_delete_directive_specifics);
SYNC_EXPORT_PRIVATE base::DictionaryValue* ManagedUserSettingSpecificsToValue(
const sync_pb::ManagedUserSettingSpecifics& managed_user_setting_specifics);
SYNC_EXPORT_PRIVATE base::DictionaryValue* NigoriSpecificsToValue( SYNC_EXPORT_PRIVATE base::DictionaryValue* NigoriSpecificsToValue(
const sync_pb::NigoriSpecifics& nigori_specifics); const sync_pb::NigoriSpecifics& nigori_specifics);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "sync/protocol/extension_specifics.pb.h" #include "sync/protocol/extension_specifics.pb.h"
#include "sync/protocol/favicon_image_specifics.pb.h" #include "sync/protocol/favicon_image_specifics.pb.h"
#include "sync/protocol/favicon_tracking_specifics.pb.h" #include "sync/protocol/favicon_tracking_specifics.pb.h"
#include "sync/protocol/managed_user_setting_specifics.pb.h"
#include "sync/protocol/nigori_specifics.pb.h" #include "sync/protocol/nigori_specifics.pb.h"
#include "sync/protocol/password_specifics.pb.h" #include "sync/protocol/password_specifics.pb.h"
#include "sync/protocol/preference_specifics.pb.h" #include "sync/protocol/preference_specifics.pb.h"
...@@ -52,7 +53,7 @@ TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) { ...@@ -52,7 +53,7 @@ TEST_F(ProtoValueConversionsTest, ProtoChangeCheck) {
// If this number changes, that means we added or removed a data // If this number changes, that means we added or removed a data
// type. Don't forget to add a unit test for {New // type. Don't forget to add a unit test for {New
// type}SpecificsToValue below. // type}SpecificsToValue below.
EXPECT_EQ(26, MODEL_TYPE_COUNT); EXPECT_EQ(27, MODEL_TYPE_COUNT);
// We'd also like to check if we changed any field in our messages. // 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 // However, that's hard to do: sizeof could work, but it's
...@@ -173,6 +174,10 @@ TEST_F(ProtoValueConversionsTest, HistoryDeleteDirectiveSpecificsToValue) { ...@@ -173,6 +174,10 @@ TEST_F(ProtoValueConversionsTest, HistoryDeleteDirectiveSpecificsToValue) {
TestSpecificsToValue(HistoryDeleteDirectiveSpecificsToValue); TestSpecificsToValue(HistoryDeleteDirectiveSpecificsToValue);
} }
TEST_F(ProtoValueConversionsTest, ManagedUserSettingSpecificsToValue) {
TestSpecificsToValue(ManagedUserSettingSpecificsToValue);
}
TEST_F(ProtoValueConversionsTest, NigoriSpecificsToValue) { TEST_F(ProtoValueConversionsTest, NigoriSpecificsToValue) {
TestSpecificsToValue(NigoriSpecificsToValue); TestSpecificsToValue(NigoriSpecificsToValue);
} }
...@@ -231,6 +236,7 @@ TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) { ...@@ -231,6 +236,7 @@ TEST_F(ProtoValueConversionsTest, EntitySpecificsToValue) {
SET_FIELD(favicon_image); SET_FIELD(favicon_image);
SET_FIELD(favicon_tracking); SET_FIELD(favicon_tracking);
SET_FIELD(history_delete_directive); SET_FIELD(history_delete_directive);
SET_FIELD(managed_user_setting);
SET_FIELD(nigori); SET_FIELD(nigori);
SET_FIELD(password); SET_FIELD(password);
SET_FIELD(preference); SET_FIELD(preference);
......
...@@ -32,6 +32,7 @@ import "favicon_tracking_specifics.proto"; ...@@ -32,6 +32,7 @@ import "favicon_tracking_specifics.proto";
import "get_updates_caller_info.proto"; import "get_updates_caller_info.proto";
import "history_delete_directive_specifics.proto"; import "history_delete_directive_specifics.proto";
import "nigori_specifics.proto"; import "nigori_specifics.proto";
import "managed_user_setting_specifics.proto";
import "password_specifics.proto"; import "password_specifics.proto";
import "preference_specifics.proto"; import "preference_specifics.proto";
import "priority_preference_specifics.proto"; import "priority_preference_specifics.proto";
...@@ -114,6 +115,7 @@ message EntitySpecifics { ...@@ -114,6 +115,7 @@ message EntitySpecifics {
optional DictionarySpecifics dictionary = 170540; optional DictionarySpecifics dictionary = 170540;
optional FaviconTrackingSpecifics favicon_tracking = 181534; optional FaviconTrackingSpecifics favicon_tracking = 181534;
optional FaviconImageSpecifics favicon_image = 182019; optional FaviconImageSpecifics favicon_image = 182019;
optional ManagedUserSettingSpecifics managed_user_setting = 186662;
} }
message SyncEntity { message SyncEntity {
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
'protocol/get_updates_caller_info.proto', 'protocol/get_updates_caller_info.proto',
'protocol/history_delete_directive_specifics.proto', 'protocol/history_delete_directive_specifics.proto',
'protocol/nigori_specifics.proto', 'protocol/nigori_specifics.proto',
'protocol/managed_user_setting_specifics.proto',
'protocol/password_specifics.proto', 'protocol/password_specifics.proto',
'protocol/preference_specifics.proto', 'protocol/preference_specifics.proto',
'protocol/priority_preference_specifics.proto', 'protocol/priority_preference_specifics.proto',
......
...@@ -101,6 +101,9 @@ void AddDefaultFieldValue(ModelType datatype, ...@@ -101,6 +101,9 @@ void AddDefaultFieldValue(ModelType datatype,
case FAVICON_TRACKING: case FAVICON_TRACKING:
specifics->mutable_favicon_tracking(); specifics->mutable_favicon_tracking();
break; break;
case MANAGED_USER_SETTINGS:
specifics->mutable_managed_user_setting();
break;
default: default:
NOTREACHED() << "No known extension for model type."; NOTREACHED() << "No known extension for model type.";
} }
...@@ -187,6 +190,8 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) { ...@@ -187,6 +190,8 @@ int GetSpecificsFieldNumberFromModelType(ModelType model_type) {
return sync_pb::EntitySpecifics::kFaviconImageFieldNumber; return sync_pb::EntitySpecifics::kFaviconImageFieldNumber;
case FAVICON_TRACKING: case FAVICON_TRACKING:
return sync_pb::EntitySpecifics::kFaviconTrackingFieldNumber; return sync_pb::EntitySpecifics::kFaviconTrackingFieldNumber;
case MANAGED_USER_SETTINGS:
return sync_pb::EntitySpecifics::kManagedUserSettingFieldNumber;
default: default:
NOTREACHED() << "No known extension for model type."; NOTREACHED() << "No known extension for model type.";
return 0; return 0;
...@@ -303,6 +308,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) { ...@@ -303,6 +308,9 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_favicon_tracking()) if (specifics.has_favicon_tracking())
return FAVICON_TRACKING; return FAVICON_TRACKING;
if (specifics.has_managed_user_setting())
return MANAGED_USER_SETTINGS;
return UNSPECIFIED; return UNSPECIFIED;
} }
...@@ -352,6 +360,8 @@ ModelTypeSet EncryptableUserTypes() { ...@@ -352,6 +360,8 @@ ModelTypeSet EncryptableUserTypes() {
// Priority preferences are not encrypted because they might be synced before // Priority preferences are not encrypted because they might be synced before
// encryption is ready. // encryption is ready.
encryptable_user_types.RemoveAll(PriorityUserTypes()); encryptable_user_types.RemoveAll(PriorityUserTypes());
// Managed user settings are not encrypted since they are set server-side.
encryptable_user_types.Remove(MANAGED_USER_SETTINGS);
// Proxy types have no sync representation and are therefore not encrypted. // Proxy types have no sync representation and are therefore not encrypted.
// Note however that proxy types map to one or more protocol types, which // Note however that proxy types map to one or more protocol types, which
// may or may not be encrypted themselves. // may or may not be encrypted themselves.
...@@ -440,6 +450,8 @@ const char* ModelTypeToString(ModelType model_type) { ...@@ -440,6 +450,8 @@ const char* ModelTypeToString(ModelType model_type) {
return "Favicon Images"; return "Favicon Images";
case FAVICON_TRACKING: case FAVICON_TRACKING:
return "Favicon Tracking"; return "Favicon Tracking";
case MANAGED_USER_SETTINGS:
return "Managed User Settings";
case PROXY_TABS: case PROXY_TABS:
return "Tabs"; return "Tabs";
default: default:
...@@ -507,6 +519,8 @@ int ModelTypeToHistogramInt(ModelType model_type) { ...@@ -507,6 +519,8 @@ int ModelTypeToHistogramInt(ModelType model_type) {
return 24; return 24;
case PROXY_TABS: case PROXY_TABS:
return 25; return 25;
case MANAGED_USER_SETTINGS:
return 26;
// Silence a compiler warning. // Silence a compiler warning.
case MODEL_TYPE_COUNT: case MODEL_TYPE_COUNT:
return 0; return 0;
...@@ -588,6 +602,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) { ...@@ -588,6 +602,8 @@ ModelType ModelTypeFromString(const std::string& model_type_string) {
return FAVICON_IMAGES; return FAVICON_IMAGES;
else if (model_type_string == "Favicon Tracking") else if (model_type_string == "Favicon Tracking")
return FAVICON_TRACKING; return FAVICON_TRACKING;
else if (model_type_string == "Managed User Settings")
return MANAGED_USER_SETTINGS;
else if (model_type_string == "Tabs") else if (model_type_string == "Tabs")
return PROXY_TABS; return PROXY_TABS;
else else
...@@ -676,6 +692,8 @@ std::string ModelTypeToRootTag(ModelType type) { ...@@ -676,6 +692,8 @@ std::string ModelTypeToRootTag(ModelType type) {
return "google_chrome_favicon_images"; return "google_chrome_favicon_images";
case FAVICON_TRACKING: case FAVICON_TRACKING:
return "google_chrome_favicon_tracking"; return "google_chrome_favicon_tracking";
case MANAGED_USER_SETTINGS:
return "google_chrome_managed_user_settings";
case PROXY_TABS: case PROXY_TABS:
return std::string(); return std::string();
default: default:
...@@ -713,6 +731,7 @@ const char kPriorityPreferenceNotificationType[] = "PRIORITY_PREFERENCE"; ...@@ -713,6 +731,7 @@ const char kPriorityPreferenceNotificationType[] = "PRIORITY_PREFERENCE";
const char kDictionaryNotificationType[] = "DICTIONARY"; const char kDictionaryNotificationType[] = "DICTIONARY";
const char kFaviconImageNotificationType[] = "FAVICON_IMAGE"; const char kFaviconImageNotificationType[] = "FAVICON_IMAGE";
const char kFaviconTrackingNotificationType[] = "FAVICON_TRACKING"; const char kFaviconTrackingNotificationType[] = "FAVICON_TRACKING";
const char kManagedUserSettingNotificationType[] = "MANAGED_USER_SETTING";
} // namespace } // namespace
bool RealModelTypeToNotificationType(ModelType model_type, bool RealModelTypeToNotificationType(ModelType model_type,
...@@ -787,6 +806,9 @@ bool RealModelTypeToNotificationType(ModelType model_type, ...@@ -787,6 +806,9 @@ bool RealModelTypeToNotificationType(ModelType model_type,
case FAVICON_TRACKING: case FAVICON_TRACKING:
*notification_type = kFaviconTrackingNotificationType; *notification_type = kFaviconTrackingNotificationType;
return true; return true;
case MANAGED_USER_SETTINGS:
*notification_type = kManagedUserSettingNotificationType;
return true;
default: default:
break; break;
} }
...@@ -865,6 +887,9 @@ bool NotificationTypeToRealModelType(const std::string& notification_type, ...@@ -865,6 +887,9 @@ bool NotificationTypeToRealModelType(const std::string& notification_type,
} else if (notification_type == kFaviconTrackingNotificationType) { } else if (notification_type == kFaviconTrackingNotificationType) {
*model_type = FAVICON_TRACKING; *model_type = FAVICON_TRACKING;
return true; return true;
} else if (notification_type == kManagedUserSettingNotificationType) {
*model_type = MANAGED_USER_SETTINGS;
return true;
} }
*model_type = UNSPECIFIED; *model_type = UNSPECIFIED;
return false; return false;
......
...@@ -242,7 +242,7 @@ void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, ...@@ -242,7 +242,7 @@ void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types,
bool encrypt_everything, bool encrypt_everything,
sync_pb::NigoriSpecifics* nigori) { sync_pb::NigoriSpecifics* nigori) {
nigori->set_encrypt_everything(encrypt_everything); nigori->set_encrypt_everything(encrypt_everything);
COMPILE_ASSERT(26 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); COMPILE_ASSERT(27 == MODEL_TYPE_COUNT, UpdateEncryptedTypes);
nigori->set_encrypt_bookmarks( nigori->set_encrypt_bookmarks(
encrypted_types.Has(BOOKMARKS)); encrypted_types.Has(BOOKMARKS));
nigori->set_encrypt_preferences( nigori->set_encrypt_preferences(
...@@ -276,7 +276,7 @@ ModelTypeSet GetEncryptedTypesFromNigori( ...@@ -276,7 +276,7 @@ ModelTypeSet GetEncryptedTypesFromNigori(
return ModelTypeSet::All(); return ModelTypeSet::All();
ModelTypeSet encrypted_types; ModelTypeSet encrypted_types;
COMPILE_ASSERT(26 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); COMPILE_ASSERT(27 == MODEL_TYPE_COUNT, UpdateEncryptedTypes);
if (nigori.encrypt_bookmarks()) if (nigori.encrypt_bookmarks())
encrypted_types.Put(BOOKMARKS); encrypted_types.Put(BOOKMARKS);
if (nigori.encrypt_preferences()) if (nigori.encrypt_preferences())
......
...@@ -31,6 +31,7 @@ import extension_specifics_pb2 ...@@ -31,6 +31,7 @@ import extension_specifics_pb2
import favicon_image_specifics_pb2 import favicon_image_specifics_pb2
import favicon_tracking_specifics_pb2 import favicon_tracking_specifics_pb2
import history_delete_directive_specifics_pb2 import history_delete_directive_specifics_pb2
import managed_user_setting_specifics_pb2
import nigori_specifics_pb2 import nigori_specifics_pb2
import password_specifics_pb2 import password_specifics_pb2
import preference_specifics_pb2 import preference_specifics_pb2
...@@ -60,6 +61,7 @@ ALL_TYPES = ( ...@@ -60,6 +61,7 @@ ALL_TYPES = (
EXPERIMENTS, EXPERIMENTS,
EXTENSIONS, EXTENSIONS,
HISTORY_DELETE_DIRECTIVE, HISTORY_DELETE_DIRECTIVE,
MANAGED_USER_SETTING,
NIGORI, NIGORI,
PASSWORD, PASSWORD,
PREFERENCE, PREFERENCE,
...@@ -71,7 +73,7 @@ ALL_TYPES = ( ...@@ -71,7 +73,7 @@ ALL_TYPES = (
TYPED_URL, TYPED_URL,
EXTENSION_SETTINGS, EXTENSION_SETTINGS,
FAVICON_IMAGES, FAVICON_IMAGES,
FAVICON_TRACKING) = range(24) FAVICON_TRACKING) = range(25)
# An enumeration on the frequency at which the server should send errors # 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. # to the client. This would be specified by the url that triggers the error.
...@@ -102,6 +104,7 @@ SYNC_TYPE_TO_DESCRIPTOR = { ...@@ -102,6 +104,7 @@ SYNC_TYPE_TO_DESCRIPTOR = {
FAVICON_IMAGES: SYNC_TYPE_FIELDS['favicon_image'], FAVICON_IMAGES: SYNC_TYPE_FIELDS['favicon_image'],
FAVICON_TRACKING: SYNC_TYPE_FIELDS['favicon_tracking'], FAVICON_TRACKING: SYNC_TYPE_FIELDS['favicon_tracking'],
HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'], HISTORY_DELETE_DIRECTIVE: SYNC_TYPE_FIELDS['history_delete_directive'],
MANAGED_USER_SETTING: SYNC_TYPE_FIELDS['managed_user_setting'],
NIGORI: SYNC_TYPE_FIELDS['nigori'], NIGORI: SYNC_TYPE_FIELDS['nigori'],
PASSWORD: SYNC_TYPE_FIELDS['password'], PASSWORD: SYNC_TYPE_FIELDS['password'],
PREFERENCE: SYNC_TYPE_FIELDS['preference'], PREFERENCE: SYNC_TYPE_FIELDS['preference'],
...@@ -491,6 +494,9 @@ class SyncDataModel(object): ...@@ -491,6 +494,9 @@ class SyncDataModel(object):
name='Favicon Tracking', name='Favicon Tracking',
parent_tag=ROOT_ID, parent_tag=ROOT_ID,
sync_type=FAVICON_TRACKING), sync_type=FAVICON_TRACKING),
PermanentItem('google_chrome_managed_user_settings',
name='Managed User Settings',
parent_tag=ROOT_ID, sync_type=MANAGED_USER_SETTING),
PermanentItem('google_chrome_nigori', name='Nigori', PermanentItem('google_chrome_nigori', name='Nigori',
parent_tag=ROOT_ID, sync_type=NIGORI), parent_tag=ROOT_ID, sync_type=NIGORI),
PermanentItem('google_chrome_passwords', name='Passwords', PermanentItem('google_chrome_passwords', name='Passwords',
......
...@@ -105,6 +105,9 @@ ...@@ -105,6 +105,9 @@
case ::syncer::FAVICON_TRACKING: \ case ::syncer::FAVICON_TRACKING: \
PER_DATA_TYPE_MACRO("FaviconTracking"); \ PER_DATA_TYPE_MACRO("FaviconTracking"); \
break; \ break; \
case ::syncer::MANAGED_USER_SETTINGS: \
PER_DATA_TYPE_MACRO("ManagedUserSetting"); \
break; \
case ::syncer::PROXY_TABS :\ case ::syncer::PROXY_TABS :\
PER_DATA_TYPE_MACRO("Tabs"); \ PER_DATA_TYPE_MACRO("Tabs"); \
break; \ break; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment