| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 346 bool IsUserSelectableType(ModelType model_type) { | 346 bool IsUserSelectableType(ModelType model_type) { | 
| 347   return UserSelectableTypes().Has(model_type); | 347   return UserSelectableTypes().Has(model_type); | 
| 348 } | 348 } | 
| 349 | 349 | 
| 350 ModelTypeSet EncryptableUserTypes() { | 350 ModelTypeSet EncryptableUserTypes() { | 
| 351   ModelTypeSet encryptable_user_types = UserTypes(); | 351   ModelTypeSet encryptable_user_types = UserTypes(); | 
| 352   // We never encrypt history delete directives. | 352   // We never encrypt history delete directives. | 
| 353   encryptable_user_types.Remove(HISTORY_DELETE_DIRECTIVES); | 353   encryptable_user_types.Remove(HISTORY_DELETE_DIRECTIVES); | 
| 354   // Synced notifications are not encrypted since the server must see changes. | 354   // Synced notifications are not encrypted since the server must see changes. | 
| 355   encryptable_user_types.Remove(SYNCED_NOTIFICATIONS); | 355   encryptable_user_types.Remove(SYNCED_NOTIFICATIONS); | 
|  | 356   // Priority preferences are not encrypted because they might be synced before | 
|  | 357   // encryption is ready. | 
|  | 358   encryptable_user_types.RemoveAll(PriorityUserTypes()); | 
| 356   // Proxy types have no sync representation and are therefore not encrypted. | 359   // Proxy types have no sync representation and are therefore not encrypted. | 
| 357   // Note however that proxy types map to one or more protocol types, which | 360   // Note however that proxy types map to one or more protocol types, which | 
| 358   // may or may not be encrypted themselves. | 361   // may or may not be encrypted themselves. | 
| 359   encryptable_user_types.RemoveAll(ProxyTypes()); | 362   encryptable_user_types.RemoveAll(ProxyTypes()); | 
| 360   return encryptable_user_types; | 363   return encryptable_user_types; | 
| 361 } | 364 } | 
| 362 | 365 | 
|  | 366 ModelTypeSet PriorityUserTypes() { | 
|  | 367   return ModelTypeSet(PRIORITY_PREFERENCES); | 
|  | 368 } | 
|  | 369 | 
| 363 ModelTypeSet ControlTypes() { | 370 ModelTypeSet ControlTypes() { | 
| 364   ModelTypeSet set; | 371   ModelTypeSet set; | 
| 365   // TODO(sync): We should be able to build the actual enumset's internal | 372   // TODO(sync): We should be able to build the actual enumset's internal | 
| 366   // bitset value here at compile time, rather than performing an iteration | 373   // bitset value here at compile time, rather than performing an iteration | 
| 367   // every time. | 374   // every time. | 
| 368   for (int i = FIRST_CONTROL_MODEL_TYPE; i <= LAST_CONTROL_MODEL_TYPE; ++i) { | 375   for (int i = FIRST_CONTROL_MODEL_TYPE; i <= LAST_CONTROL_MODEL_TYPE; ++i) { | 
| 369     set.Put(ModelTypeFromInt(i)); | 376     set.Put(ModelTypeFromInt(i)); | 
| 370   } | 377   } | 
| 371 | 378 | 
| 372   // TODO(albertb): Re-enable this when the server supports it. |  | 
| 373   set.Remove(PRIORITY_PREFERENCES); |  | 
| 374 |  | 
| 375   return set; | 379   return set; | 
| 376 } | 380 } | 
| 377 | 381 | 
| 378 ModelTypeSet ProxyTypes() { | 382 ModelTypeSet ProxyTypes() { | 
| 379   ModelTypeSet set; | 383   ModelTypeSet set; | 
| 380   set.Put(PROXY_TABS); | 384   set.Put(PROXY_TABS); | 
| 381   return set; | 385   return set; | 
| 382 } | 386 } | 
| 383 | 387 | 
| 384 bool IsControlType(ModelType model_type) { | 388 bool IsControlType(ModelType model_type) { | 
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 872 | 876 | 
| 873 bool IsRealDataType(ModelType model_type) { | 877 bool IsRealDataType(ModelType model_type) { | 
| 874   return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT; | 878   return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT; | 
| 875 } | 879 } | 
| 876 | 880 | 
| 877 bool IsActOnceDataType(ModelType model_type) { | 881 bool IsActOnceDataType(ModelType model_type) { | 
| 878   return model_type == HISTORY_DELETE_DIRECTIVES; | 882   return model_type == HISTORY_DELETE_DIRECTIVES; | 
| 879 } | 883 } | 
| 880 | 884 | 
| 881 }  // namespace syncer | 885 }  // namespace syncer | 
| OLD | NEW | 
|---|