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

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

Issue 10832286: sync: Introduce control data types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small fixes Created 8 years, 3 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (specifics.has_app_notification()) 219 if (specifics.has_app_notification())
220 return APP_NOTIFICATIONS; 220 return APP_NOTIFICATIONS;
221 221
222 return UNSPECIFIED; 222 return UNSPECIFIED;
223 } 223 }
224 224
225 bool ShouldMaintainPosition(ModelType model_type) { 225 bool ShouldMaintainPosition(ModelType model_type) {
226 return model_type == BOOKMARKS; 226 return model_type == BOOKMARKS;
227 } 227 }
228 228
229 ModelTypeSet UserTypes() {
230 ModelTypeSet set;
231 for (int i = FIRST_USER_MODEL_TYPE; i <= LAST_USER_MODEL_TYPE; ++i) {
232 set.Put(ModelTypeFromInt(i));
233 }
234 return set;
235 }
236
237 ModelTypeSet ControlTypes() {
238 ModelTypeSet set;
239 for (int i = FIRST_CONTROL_MODEL_TYPE; i <= LAST_CONTROL_MODEL_TYPE; ++i) {
240 set.Put(ModelTypeFromInt(i));
241 }
242 return set;
243 }
244
245 bool IsControlType(ModelType model_type) {
246 return ControlTypes().Has(model_type);
247 }
248
229 const char* ModelTypeToString(ModelType model_type) { 249 const char* ModelTypeToString(ModelType model_type) {
230 // This is used in serialization routines as well as for displaying debug 250 // This is used in serialization routines as well as for displaying debug
231 // information. Do not attempt to change these string values unless you know 251 // information. Do not attempt to change these string values unless you know
232 // what you're doing. 252 // what you're doing.
233 switch (model_type) { 253 switch (model_type) {
234 case TOP_LEVEL_FOLDER: 254 case TOP_LEVEL_FOLDER:
235 return "Top Level Folder"; 255 return "Top Level Folder";
236 case UNSPECIFIED: 256 case UNSPECIFIED:
237 return "Unspecified"; 257 return "Unspecified";
238 case BOOKMARKS: 258 case BOOKMARKS:
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 *model_type = UNSPECIFIED; 551 *model_type = UNSPECIFIED;
532 return false; 552 return false;
533 } 553 }
534 } 554 }
535 555
536 bool IsRealDataType(ModelType model_type) { 556 bool IsRealDataType(ModelType model_type) {
537 return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT; 557 return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT;
538 } 558 }
539 559
540 } // namespace syncer 560 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698