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

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: another rebase Created 7 years, 10 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
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/string_split.h" 7 #include "base/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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 bool IsUserSelectableType(ModelType model_type) { 344 bool IsUserSelectableType(ModelType model_type) {
345 return UserSelectableTypes().Has(model_type); 345 return UserSelectableTypes().Has(model_type);
346 } 346 }
347 347
348 ModelTypeSet EncryptableUserTypes() { 348 ModelTypeSet EncryptableUserTypes() {
349 ModelTypeSet encryptable_user_types = UserTypes(); 349 ModelTypeSet encryptable_user_types = UserTypes();
350 // We never encrypt history delete directives. 350 // We never encrypt history delete directives.
351 encryptable_user_types.Remove(HISTORY_DELETE_DIRECTIVES); 351 encryptable_user_types.Remove(HISTORY_DELETE_DIRECTIVES);
352 // Synced notifications are not encrypted since the server must see changes. 352 // Synced notifications are not encrypted since the server must see changes.
353 encryptable_user_types.Remove(SYNCED_NOTIFICATIONS); 353 encryptable_user_types.Remove(SYNCED_NOTIFICATIONS);
354 // Priority preferences are not encrypted because they might be synced before
355 // encryption is ready.
356 encryptable_user_types.Remove(PRIORITY_PREFERENCES);
Nicolas Zea 2013/02/21 23:41:11 RemoveAll(PriorityUserTypes())?
albertb 2013/02/22 20:08:47 Done.
354 // Proxy types have no sync representation and are therefore not encrypted. 357 // Proxy types have no sync representation and are therefore not encrypted.
355 // Note however that proxy types map to one or more protocol types, which 358 // Note however that proxy types map to one or more protocol types, which
356 // may or may not be encrypted themselves. 359 // may or may not be encrypted themselves.
357 encryptable_user_types.RemoveAll(ProxyTypes()); 360 encryptable_user_types.RemoveAll(ProxyTypes());
358 return encryptable_user_types; 361 return encryptable_user_types;
359 } 362 }
360 363
364 ModelTypeSet PriorityUserTypes() {
365 return ModelTypeSet(PRIORITY_PREFERENCES);
366 }
367
361 ModelTypeSet ControlTypes() { 368 ModelTypeSet ControlTypes() {
362 ModelTypeSet set; 369 ModelTypeSet set;
363 // TODO(sync): We should be able to build the actual enumset's internal 370 // TODO(sync): We should be able to build the actual enumset's internal
364 // bitset value here at compile time, rather than performing an iteration 371 // bitset value here at compile time, rather than performing an iteration
365 // every time. 372 // every time.
366 for (int i = FIRST_CONTROL_MODEL_TYPE; i <= LAST_CONTROL_MODEL_TYPE; ++i) { 373 for (int i = FIRST_CONTROL_MODEL_TYPE; i <= LAST_CONTROL_MODEL_TYPE; ++i) {
367 set.Put(ModelTypeFromInt(i)); 374 set.Put(ModelTypeFromInt(i));
368 } 375 }
369 376
370 // TODO(albertb): Re-enable this when the server supports it.
371 set.Remove(PRIORITY_PREFERENCES);
372
373 return set; 377 return set;
374 } 378 }
375 379
376 ModelTypeSet ProxyTypes() { 380 ModelTypeSet ProxyTypes() {
377 ModelTypeSet set; 381 ModelTypeSet set;
378 // TODO(zea): add a TABS type here. 382 // TODO(zea): add a TABS type here.
379 return set; 383 return set;
380 } 384 }
381 385
382 bool IsControlType(ModelType model_type) { 386 bool IsControlType(ModelType model_type) {
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 } 799 }
796 *model_type = UNSPECIFIED; 800 *model_type = UNSPECIFIED;
797 return false; 801 return false;
798 } 802 }
799 803
800 bool IsRealDataType(ModelType model_type) { 804 bool IsRealDataType(ModelType model_type) {
801 return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT; 805 return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT;
802 } 806 }
803 807
804 } // namespace syncer 808 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698