Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: sync/syncable/model_type.cc

Issue 12033093: sync: Implementation of Priority Preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/protocol/proto_value_conversions.cc ('k') | sync/tools/testserver/chromiumsync.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « sync/protocol/proto_value_conversions.cc ('k') | sync/tools/testserver/chromiumsync.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698