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

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

Issue 12820010: sync: Define histogram ints for model types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove comment Created 7 years, 9 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/internal_api/public/base/model_type.h ('k') | sync/syncable/model_type_unittest.cc » ('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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 return "Favicon Tracking"; 442 return "Favicon Tracking";
443 case PROXY_TABS: 443 case PROXY_TABS:
444 return "Tabs"; 444 return "Tabs";
445 default: 445 default:
446 break; 446 break;
447 } 447 }
448 NOTREACHED() << "No known extension for model type."; 448 NOTREACHED() << "No known extension for model type.";
449 return "INVALID"; 449 return "INVALID";
450 } 450 }
451 451
452 // The normal rules about histograms apply here. Always append to the bottom of
453 // the list, and be careful to not reuse integer values that have already been
454 // assigned. Don't forget to update histograms.xml when you make changes to
455 // this list.
456 int ModelTypeToHistogramInt(ModelType model_type) {
457 switch (model_type) {
458 case UNSPECIFIED:
459 return 0;
460 case TOP_LEVEL_FOLDER:
461 return 1;
462 case BOOKMARKS:
463 return 2;
464 case PREFERENCES:
465 return 3;
466 case PASSWORDS:
467 return 4;
468 case AUTOFILL_PROFILE:
469 return 5;
470 case AUTOFILL:
471 return 6;
472 case THEMES:
473 return 7;
474 case TYPED_URLS:
475 return 8;
476 case EXTENSIONS:
477 return 9;
478 case SEARCH_ENGINES:
479 return 10;
480 case SESSIONS:
481 return 11;
482 case APPS:
483 return 12;
484 case APP_SETTINGS:
485 return 13;
486 case EXTENSION_SETTINGS:
487 return 14;
488 case APP_NOTIFICATIONS:
489 return 15;
490 case HISTORY_DELETE_DIRECTIVES:
491 return 16;
492 case NIGORI:
493 return 17;
494 case DEVICE_INFO:
495 return 18;
496 case EXPERIMENTS:
497 return 19;
498 case SYNCED_NOTIFICATIONS:
499 return 20;
500 case PRIORITY_PREFERENCES:
501 return 21;
502 case DICTIONARY:
503 return 22;
504 case FAVICON_IMAGES:
505 return 23;
506 case FAVICON_TRACKING:
507 return 24;
508 case PROXY_TABS:
509 return 25;
510 // Silence a compiler warning.
511 case MODEL_TYPE_COUNT:
512 return 0;
513 }
514 return 0;
515 }
516
452 base::StringValue* ModelTypeToValue(ModelType model_type) { 517 base::StringValue* ModelTypeToValue(ModelType model_type) {
453 if (model_type >= FIRST_REAL_MODEL_TYPE) { 518 if (model_type >= FIRST_REAL_MODEL_TYPE) {
454 return new base::StringValue(ModelTypeToString(model_type)); 519 return new base::StringValue(ModelTypeToString(model_type));
455 } else if (model_type == TOP_LEVEL_FOLDER) { 520 } else if (model_type == TOP_LEVEL_FOLDER) {
456 return new base::StringValue("Top-level folder"); 521 return new base::StringValue("Top-level folder");
457 } else if (model_type == UNSPECIFIED) { 522 } else if (model_type == UNSPECIFIED) {
458 return new base::StringValue("Unspecified"); 523 return new base::StringValue("Unspecified");
459 } 524 }
460 NOTREACHED(); 525 NOTREACHED();
461 return new base::StringValue(""); 526 return new base::StringValue("");
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 872
808 bool IsRealDataType(ModelType model_type) { 873 bool IsRealDataType(ModelType model_type) {
809 return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT; 874 return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT;
810 } 875 }
811 876
812 bool IsActOnceDataType(ModelType model_type) { 877 bool IsActOnceDataType(ModelType model_type) {
813 return model_type == HISTORY_DELETE_DIRECTIVES; 878 return model_type == HISTORY_DELETE_DIRECTIVES;
814 } 879 }
815 880
816 } // namespace syncer 881 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/base/model_type.h ('k') | sync/syncable/model_type_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698