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

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: rebase 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_directory_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 78f2d0048d671f27768188703d54554e5fdae815..54fcfecd49fe2bba50adb4a54466d68cf2dc7aa7 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) {
@@ -673,11 +650,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();
@@ -696,18 +669,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();
}
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_directory_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698