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; |
} |