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

Unified Diff: chrome/browser/chromeos/gdata/gdata_files.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 | « chrome/browser/chromeos/gdata/gdata_files.h ('k') | chrome/browser/chromeos/gdata/gdata_files_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_files.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_files.cc b/chrome/browser/chromeos/gdata/gdata_files.cc
index 312b571d8d0be72bdbad466e9f9aa4ac680ba632..bddc17ab7ae9e2fc86918b46823fc2fc4eef0291 100644
--- a/chrome/browser/chromeos/gdata/gdata_files.cc
+++ b/chrome/browser/chromeos/gdata/gdata_files.cc
@@ -380,7 +380,7 @@ void GDataEntry::ConvertPlatformFileInfoToProto(
proto->set_creation_time(file_info.creation_time.ToInternalValue());
}
-bool GDataEntry::FromProto(const GDataEntryProto& proto) {
+void GDataEntry::FromProto(const GDataEntryProto& proto) {
ConvertProtoToPlatformFileInfo(proto.file_info(), &file_info_);
// Don't copy from proto.base_name() as base_name_ is computed in
@@ -392,16 +392,6 @@ bool GDataEntry::FromProto(const GDataEntryProto& proto) {
content_url_ = GURL(proto.content_url());
upload_url_ = GURL(proto.upload_url());
SetBaseNameFromTitle();
-
- // Reject older protobuf that does not contain the upload URL. This URL is
- // necessary for uploading files.
- if (!proto.has_upload_url()) {
- LOG(ERROR) << "Incompatible proto detected (no upload URL): "
- << proto.title();
- return false;
- }
-
- return true;
}
void GDataEntry::ToProto(GDataEntryProto* proto) const {
@@ -430,11 +420,10 @@ void GDataEntry::ToProtoFull(GDataEntryProto* proto) const {
}
}
-bool GDataFile::FromProto(const GDataEntryProto& proto) {
+void GDataFile::FromProto(const GDataEntryProto& proto) {
DCHECK(!proto.file_info().is_directory());
- if (!GDataEntry::FromProto(proto))
- return false;
+ GDataEntry::FromProto(proto);
thumbnail_url_ = GURL(proto.file_specific_info().thumbnail_url());
alternate_url_ = GURL(proto.file_specific_info().alternate_url());
@@ -442,8 +431,6 @@ bool GDataFile::FromProto(const GDataEntryProto& proto) {
file_md5_ = proto.file_specific_info().file_md5();
document_extension_ = proto.file_specific_info().document_extension();
is_hosted_document_ = proto.file_specific_info().is_hosted_document();
-
- return true;
}
void GDataFile::ToProto(GDataEntryProto* proto) const {
@@ -459,33 +446,24 @@ void GDataFile::ToProto(GDataEntryProto* proto) const {
file_specific_info->set_is_hosted_document(is_hosted_document_);
}
-bool GDataDirectory::FromProto(const GDataDirectoryProto& proto) {
+void GDataDirectory::FromProto(const GDataDirectoryProto& proto) {
DCHECK(proto.gdata_entry().file_info().is_directory());
DCHECK(!proto.gdata_entry().has_file_specific_info());
for (int i = 0; i < proto.child_files_size(); ++i) {
scoped_ptr<GDataFile> file(directory_service_->CreateGDataFile());
- if (!file->FromProto(proto.child_files(i))) {
- RemoveChildren();
- return false;
- }
+ file->FromProto(proto.child_files(i));
AddEntry(file.release());
}
for (int i = 0; i < proto.child_directories_size(); ++i) {
scoped_ptr<GDataDirectory> dir(directory_service_->CreateGDataDirectory());
- if (!dir->FromProto(proto.child_directories(i))) {
- RemoveChildren();
- return false;
- }
+ dir->FromProto(proto.child_directories(i));
AddEntry(dir.release());
}
// The states of the directory should be updated after children are
// handled successfully, so that incomplete states are not left.
- if (!GDataEntry::FromProto(proto.gdata_entry()))
- return false;
-
- return true;
+ GDataEntry::FromProto(proto.gdata_entry());
}
void GDataDirectory::ToProto(GDataDirectoryProto* proto) const {
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_files.h ('k') | chrome/browser/chromeos/gdata/gdata_files_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698