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

Unified Diff: chrome/browser/sync/syncable/model_type.cc

Issue 7481023: Adding notifications for new sync types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now acknowledges sync types when notification is clocked. Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/syncable/model_type.cc
diff --git a/chrome/browser/sync/syncable/model_type.cc b/chrome/browser/sync/syncable/model_type.cc
index 28bafef06e1507c43c375cbd10757673f0874625..2027131899d68d8429cd90f10636d0a864ff422e 100644
--- a/chrome/browser/sync/syncable/model_type.cc
+++ b/chrome/browser/sync/syncable/model_type.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/sync/syncable/model_type.h"
#include "base/metrics/histogram.h"
+#include "base/string_split.h"
#include "base/values.h"
#include "chrome/browser/sync/engine/syncproto.h"
#include "chrome/browser/sync/protocol/app_specifics.pb.h"
@@ -302,11 +303,23 @@ bool ModelTypeBitSetFromString(
const std::string& model_type_bitset_string,
ModelTypeBitSet* model_types) {
DCHECK(model_types);
- if (model_type_bitset_string.length() != MODEL_TYPE_COUNT)
- return false;
- if (model_type_bitset_string.find_first_not_of("01") != std::string::npos)
- return false;
- *model_types = ModelTypeBitSet(model_type_bitset_string);
+ ModelTypeBitSet bitset;
+ if (!model_type_bitset_string.empty()) {
+ std::vector<std::string> types;
+ // Parse the comma-delimited list of types.
+ base::SplitString(model_type_bitset_string, ',', &types);
+
+ // Walk the list of types and set them in our ModelTypeBitSet.
+ for (std::vector<std::string>::const_iterator it = types.begin();
+ it != types.end();
+ ++it) {
+ ModelType type = ModelTypeFromString(*it);
+ if (type == UNSPECIFIED)
+ return false;
+ bitset.set(type);
+ }
+ }
+ *model_types = bitset;
return true;
}

Powered by Google App Engine
This is Rietveld 408576698