OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sync/internal_api/public/base/model_type.h" | 5 #include "sync/internal_api/public/base/model_type.h" |
6 | 6 |
7 #include "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "sync/protocol/app_notification_specifics.pb.h" | 9 #include "sync/protocol/app_notification_specifics.pb.h" |
10 #include "sync/protocol/app_setting_specifics.pb.h" | 10 #include "sync/protocol/app_setting_specifics.pb.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 366 |
367 ModelTypeSet EncryptableUserTypes() { | 367 ModelTypeSet EncryptableUserTypes() { |
368 ModelTypeSet encryptable_user_types = UserTypes(); | 368 ModelTypeSet encryptable_user_types = UserTypes(); |
369 // We never encrypt history delete directives. | 369 // We never encrypt history delete directives. |
370 encryptable_user_types.Remove(HISTORY_DELETE_DIRECTIVES); | 370 encryptable_user_types.Remove(HISTORY_DELETE_DIRECTIVES); |
371 // Synced notifications are not encrypted since the server must see changes. | 371 // Synced notifications are not encrypted since the server must see changes. |
372 encryptable_user_types.Remove(SYNCED_NOTIFICATIONS); | 372 encryptable_user_types.Remove(SYNCED_NOTIFICATIONS); |
373 // Synced Notification App Info does not have private data, so it is not | 373 // Synced Notification App Info does not have private data, so it is not |
374 // encrypted. | 374 // encrypted. |
375 encryptable_user_types.Remove(SYNCED_NOTIFICATION_APP_INFO); | 375 encryptable_user_types.Remove(SYNCED_NOTIFICATION_APP_INFO); |
| 376 // Device info data is not encrypted because it might be synced before |
| 377 // encryption is ready. |
| 378 encryptable_user_types.Remove(DEVICE_INFO); |
376 // Priority preferences are not encrypted because they might be synced before | 379 // Priority preferences are not encrypted because they might be synced before |
377 // encryption is ready. | 380 // encryption is ready. |
378 encryptable_user_types.Remove(PRIORITY_PREFERENCES); | 381 encryptable_user_types.Remove(PRIORITY_PREFERENCES); |
379 // Supervised user settings are not encrypted since they are set server-side. | 382 // Supervised user settings are not encrypted since they are set server-side. |
380 encryptable_user_types.Remove(SUPERVISED_USER_SETTINGS); | 383 encryptable_user_types.Remove(SUPERVISED_USER_SETTINGS); |
381 // Supervised users are not encrypted since they are managed server-side. | 384 // Supervised users are not encrypted since they are managed server-side. |
382 encryptable_user_types.Remove(SUPERVISED_USERS); | 385 encryptable_user_types.Remove(SUPERVISED_USERS); |
383 // Supervised user shared settings are not encrypted since they are managed | 386 // Supervised user shared settings are not encrypted since they are managed |
384 // server-side and shared between manager and supervised user. | 387 // server-side and shared between manager and supervised user. |
385 encryptable_user_types.Remove(SUPERVISED_USER_SHARED_SETTINGS); | 388 encryptable_user_types.Remove(SUPERVISED_USER_SHARED_SETTINGS); |
386 // Proxy types have no sync representation and are therefore not encrypted. | 389 // Proxy types have no sync representation and are therefore not encrypted. |
387 // Note however that proxy types map to one or more protocol types, which | 390 // Note however that proxy types map to one or more protocol types, which |
388 // may or may not be encrypted themselves. | 391 // may or may not be encrypted themselves. |
389 encryptable_user_types.RemoveAll(ProxyTypes()); | 392 encryptable_user_types.RemoveAll(ProxyTypes()); |
390 return encryptable_user_types; | 393 return encryptable_user_types; |
391 } | 394 } |
392 | 395 |
393 ModelTypeSet PriorityUserTypes() { | 396 ModelTypeSet PriorityUserTypes() { |
394 return ModelTypeSet(PRIORITY_PREFERENCES); | 397 return ModelTypeSet(DEVICE_INFO, PRIORITY_PREFERENCES); |
395 } | 398 } |
396 | 399 |
397 ModelTypeSet ControlTypes() { | 400 ModelTypeSet ControlTypes() { |
398 ModelTypeSet set; | 401 ModelTypeSet set; |
399 // TODO(sync): We should be able to build the actual enumset's internal | 402 // TODO(sync): We should be able to build the actual enumset's internal |
400 // bitset value here at compile time, rather than performing an iteration | 403 // bitset value here at compile time, rather than performing an iteration |
401 // every time. | 404 // every time. |
402 for (int i = FIRST_CONTROL_MODEL_TYPE; i <= LAST_CONTROL_MODEL_TYPE; ++i) { | 405 for (int i = FIRST_CONTROL_MODEL_TYPE; i <= LAST_CONTROL_MODEL_TYPE; ++i) { |
403 set.Put(ModelTypeFromInt(i)); | 406 set.Put(ModelTypeFromInt(i)); |
404 } | 407 } |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 | 1064 |
1062 bool IsProxyType(ModelType model_type) { | 1065 bool IsProxyType(ModelType model_type) { |
1063 return model_type >= FIRST_PROXY_TYPE && model_type <= LAST_PROXY_TYPE; | 1066 return model_type >= FIRST_PROXY_TYPE && model_type <= LAST_PROXY_TYPE; |
1064 } | 1067 } |
1065 | 1068 |
1066 bool IsActOnceDataType(ModelType model_type) { | 1069 bool IsActOnceDataType(ModelType model_type) { |
1067 return model_type == HISTORY_DELETE_DIRECTIVES; | 1070 return model_type == HISTORY_DELETE_DIRECTIVES; |
1068 } | 1071 } |
1069 | 1072 |
1070 } // namespace syncer | 1073 } // namespace syncer |
OLD | NEW |