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

Unified Diff: chrome/browser/chromeos/gdata/gdata_directory_service.cc

Issue 10857063: gdata: Remove logic to detect incompatibility proto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/chromeos/gdata/gdata_directory_service.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_directory_service.cc b/chrome/browser/chromeos/gdata/gdata_directory_service.cc
index 101d9d81a30a9d10b36e6880421d6830a938f889..aa1e5b6f24d8616914525958804a7347ce929ab7 100644
--- a/chrome/browser/chromeos/gdata/gdata_directory_service.cc
+++ b/chrome/browser/chromeos/gdata/gdata_directory_service.cc
@@ -28,29 +28,6 @@ const char kDBKeyLargestChangestamp[] = "m:largest_changestamp";
const char kDBKeyVersion[] = "m:version";
const char kDBKeyResourceIdPrefix[] = "r:";
-// Returns true if |proto| is a valid proto as the root directory.
-// Used to reject incompatible proto.
-bool IsValidRootDirectoryProto(const GDataDirectoryProto& proto) {
- const GDataEntryProto& entry_proto = proto.gdata_entry();
- // The title field for the root directory was originally empty, then
- // changed to "gdata", then changed to "drive". Discard the proto data if
- // the older formats are detected. See crbug.com/128133 for details.
- if (entry_proto.title() != "drive") {
- LOG(ERROR) << "Incompatible proto detected (bad title): "
- << entry_proto.title();
- return false;
- }
- // The title field for the root directory was originally empty. Discard
- // the proto data if the older format is detected.
- if (entry_proto.resource_id() != kGDataRootDirectoryResourceId) {
- LOG(ERROR) << "Incompatible proto detected (bad resource ID): "
- << entry_proto.resource_id();
- return false;
- }
-
- return true;
-}
-
} // namespace
EntryInfoResult::EntryInfoResult() : error(GDATA_FILE_ERROR_FAILED) {
@@ -680,11 +657,7 @@ bool GDataDirectoryService::ParseFromString(
return false;
}
- if (!IsValidRootDirectoryProto(proto.gdata_directory()))
- return false;
-
- if (!root_->FromProto(proto.gdata_directory()))
- return false;
+ root_->FromProto(proto.gdata_directory());
origin_ = FROM_CACHE;
largest_changestamp_ = proto.largest_changestamp();
@@ -703,18 +676,12 @@ scoped_ptr<GDataEntry> GDataDirectoryService::FromProtoString(
entry.reset(CreateGDataDirectory());
// Call GDataEntry::FromProto instead of GDataDirectory::FromProto because
// the proto does not include children.
- if (!entry->FromProto(entry_proto)) {
- NOTREACHED() << "FromProto (directory) failed";
- entry.reset();
- }
+ entry->FromProto(entry_proto);
} else {
scoped_ptr<GDataFile> file(CreateGDataFile());
// Call GDataFile::FromProto.
- if (file->FromProto(entry_proto)) {
- entry.reset(file.release());
- } else {
- NOTREACHED() << "FromProto (file) failed";
- }
+ file->FromProto(entry_proto);
+ entry.reset(file.release());
}
return entry.Pass();
}

Powered by Google App Engine
This is Rietveld 408576698