| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/gdata/drive_files.h" | 5 #include "chrome/browser/chromeos/gdata/drive_files.h" |
| 6 | 6 |
| 7 #include "base/platform_file.h" | 7 #include "base/platform_file.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/chromeos/gdata/drive.pb.h" | 11 #include "chrome/browser/chromeos/gdata/drive.pb.h" |
| 12 #include "chrome/browser/chromeos/gdata/gdata_directory_service.h" | 12 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h" |
| 13 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" | 13 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" |
| 14 #include "net/base/escape.h" | 14 #include "net/base/escape.h" |
| 15 | 15 |
| 16 namespace gdata { | 16 namespace gdata { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 const char kSlash[] = "/"; | 19 const char kSlash[] = "/"; |
| 20 const char kEscapedSlash[] = "\xE2\x88\x95"; | 20 const char kEscapedSlash[] = "\xE2\x88\x95"; |
| 21 | 21 |
| 22 // Extracts resource_id out of edit url. | 22 // Extracts resource_id out of edit url. |
| 23 std::string ExtractResourceId(const GURL& url) { | 23 std::string ExtractResourceId(const GURL& url) { |
| 24 return net::UnescapeURLComponent(url.ExtractFileName(), | 24 return net::UnescapeURLComponent(url.ExtractFileName(), |
| 25 net::UnescapeRule::URL_SPECIAL_CHARS); | 25 net::UnescapeRule::URL_SPECIAL_CHARS); |
| 26 } | 26 } |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 // DriveEntry class. | 30 // DriveEntry class. |
| 31 | 31 |
| 32 DriveEntry::DriveEntry(GDataDirectoryService* directory_service) | 32 DriveEntry::DriveEntry(DriveResourceMetadata* resource_metadata) |
| 33 : parent_(NULL), | 33 : parent_(NULL), |
| 34 directory_service_(directory_service), | 34 resource_metadata_(resource_metadata), |
| 35 deleted_(false) { | 35 deleted_(false) { |
| 36 DCHECK(directory_service); | 36 DCHECK(resource_metadata); |
| 37 } | 37 } |
| 38 | 38 |
| 39 DriveEntry::~DriveEntry() { | 39 DriveEntry::~DriveEntry() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 DriveFile* DriveEntry::AsDriveFile() { | 42 DriveFile* DriveEntry::AsDriveFile() { |
| 43 return NULL; | 43 return NULL; |
| 44 } | 44 } |
| 45 | 45 |
| 46 DriveDirectory* DriveEntry::AsDriveDirectory() { | 46 DriveDirectory* DriveEntry::AsDriveDirectory() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 // static | 112 // static |
| 113 std::string DriveEntry::UnescapeUtf8FileName(const std::string& input) { | 113 std::string DriveEntry::UnescapeUtf8FileName(const std::string& input) { |
| 114 std::string output = input; | 114 std::string output = input; |
| 115 ReplaceSubstringsAfterOffset(&output, 0, std::string(kEscapedSlash), kSlash); | 115 ReplaceSubstringsAfterOffset(&output, 0, std::string(kEscapedSlash), kSlash); |
| 116 return output; | 116 return output; |
| 117 } | 117 } |
| 118 | 118 |
| 119 // DriveFile class implementation. | 119 // DriveFile class implementation. |
| 120 | 120 |
| 121 DriveFile::DriveFile(GDataDirectoryService* directory_service) | 121 DriveFile::DriveFile(DriveResourceMetadata* resource_metadata) |
| 122 : DriveEntry(directory_service), | 122 : DriveEntry(resource_metadata), |
| 123 kind_(DocumentEntry::UNKNOWN), | 123 kind_(DocumentEntry::UNKNOWN), |
| 124 is_hosted_document_(false) { | 124 is_hosted_document_(false) { |
| 125 file_info_.is_directory = false; | 125 file_info_.is_directory = false; |
| 126 } | 126 } |
| 127 | 127 |
| 128 DriveFile::~DriveFile() { | 128 DriveFile::~DriveFile() { |
| 129 } | 129 } |
| 130 | 130 |
| 131 DriveFile* DriveFile::AsDriveFile() { | 131 DriveFile* DriveFile::AsDriveFile() { |
| 132 return this; | 132 return this; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 if (thumbnail_link) | 175 if (thumbnail_link) |
| 176 thumbnail_url_ = thumbnail_link->href(); | 176 thumbnail_url_ = thumbnail_link->href(); |
| 177 | 177 |
| 178 const Link* alternate_link = doc.GetLinkByType(Link::ALTERNATE); | 178 const Link* alternate_link = doc.GetLinkByType(Link::ALTERNATE); |
| 179 if (alternate_link) | 179 if (alternate_link) |
| 180 alternate_url_ = alternate_link->href(); | 180 alternate_url_ = alternate_link->href(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 // DriveDirectory class implementation. | 183 // DriveDirectory class implementation. |
| 184 | 184 |
| 185 DriveDirectory::DriveDirectory(GDataDirectoryService* directory_service) | 185 DriveDirectory::DriveDirectory(DriveResourceMetadata* resource_metadata) |
| 186 : DriveEntry(directory_service) { | 186 : DriveEntry(resource_metadata) { |
| 187 file_info_.is_directory = true; | 187 file_info_.is_directory = true; |
| 188 } | 188 } |
| 189 | 189 |
| 190 DriveDirectory::~DriveDirectory() { | 190 DriveDirectory::~DriveDirectory() { |
| 191 RemoveChildren(); | 191 RemoveChildren(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 DriveDirectory* DriveDirectory::AsDriveDirectory() { | 194 DriveDirectory* DriveDirectory::AsDriveDirectory() { |
| 195 return this; | 195 return this; |
| 196 } | 196 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 entry->set_base_name(full_file_name.value()); | 232 entry->set_base_name(full_file_name.value()); |
| 233 | 233 |
| 234 DVLOG(1) << "AddEntry: dir = " << GetFilePath().value() | 234 DVLOG(1) << "AddEntry: dir = " << GetFilePath().value() |
| 235 << ", file = " + entry->base_name() | 235 << ", file = " + entry->base_name() |
| 236 << ", parent resource = " << entry->parent_resource_id() | 236 << ", parent resource = " << entry->parent_resource_id() |
| 237 << ", resource = " + entry->resource_id(); | 237 << ", resource = " + entry->resource_id(); |
| 238 | 238 |
| 239 // Add entry to resource map. | 239 // Add entry to resource map. |
| 240 directory_service_->AddEntryToResourceMap(entry); | 240 resource_metadata_->AddEntryToResourceMap(entry); |
| 241 | 241 |
| 242 // Setup child and parent links. | 242 // Setup child and parent links. |
| 243 if (entry->AsDriveFile()) | 243 if (entry->AsDriveFile()) |
| 244 child_files_.insert(std::make_pair(entry->base_name(), | 244 child_files_.insert(std::make_pair(entry->base_name(), |
| 245 entry->resource_id())); | 245 entry->resource_id())); |
| 246 | 246 |
| 247 if (entry->AsDriveDirectory()) | 247 if (entry->AsDriveDirectory()) |
| 248 child_directories_.insert(std::make_pair(entry->base_name(), | 248 child_directories_.insert(std::make_pair(entry->base_name(), |
| 249 entry->resource_id())); | 249 entry->resource_id())); |
| 250 entry->SetParent(this); | 250 entry->SetParent(this); |
| 251 } | 251 } |
| 252 | 252 |
| 253 void DriveDirectory::TakeOverEntries(DriveDirectory* dir) { | 253 void DriveDirectory::TakeOverEntries(DriveDirectory* dir) { |
| 254 for (GDataChildMap::const_iterator iter = dir->child_files_.begin(); | 254 for (ChildMap::const_iterator iter = dir->child_files_.begin(); |
| 255 iter != dir->child_files_.end(); ++iter) { | 255 iter != dir->child_files_.end(); ++iter) { |
| 256 TakeOverEntry(iter->second); | 256 TakeOverEntry(iter->second); |
| 257 } | 257 } |
| 258 dir->child_files_.clear(); | 258 dir->child_files_.clear(); |
| 259 | 259 |
| 260 for (GDataChildMap::iterator iter = dir->child_directories_.begin(); | 260 for (ChildMap::iterator iter = dir->child_directories_.begin(); |
| 261 iter != dir->child_directories_.end(); ++iter) { | 261 iter != dir->child_directories_.end(); ++iter) { |
| 262 TakeOverEntry(iter->second); | 262 TakeOverEntry(iter->second); |
| 263 } | 263 } |
| 264 dir->child_directories_.clear(); | 264 dir->child_directories_.clear(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void DriveDirectory::TakeOverEntry(const std::string& resource_id) { | 267 void DriveDirectory::TakeOverEntry(const std::string& resource_id) { |
| 268 DriveEntry* entry = directory_service_->GetEntryByResourceId(resource_id); | 268 DriveEntry* entry = resource_metadata_->GetEntryByResourceId(resource_id); |
| 269 DCHECK(entry); | 269 DCHECK(entry); |
| 270 directory_service_->RemoveEntryFromResourceMap(resource_id); | 270 resource_metadata_->RemoveEntryFromResourceMap(resource_id); |
| 271 entry->SetParent(NULL); | 271 entry->SetParent(NULL); |
| 272 AddEntry(entry); | 272 AddEntry(entry); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void DriveDirectory::RemoveEntry(DriveEntry* entry) { | 275 void DriveDirectory::RemoveEntry(DriveEntry* entry) { |
| 276 DCHECK(entry); | 276 DCHECK(entry); |
| 277 | 277 |
| 278 RemoveChild(entry); | 278 RemoveChild(entry); |
| 279 delete entry; | 279 delete entry; |
| 280 } | 280 } |
| 281 | 281 |
| 282 std::string DriveDirectory::FindChild( | 282 std::string DriveDirectory::FindChild( |
| 283 const FilePath::StringType& file_name) const { | 283 const FilePath::StringType& file_name) const { |
| 284 GDataChildMap::const_iterator iter = child_files_.find(file_name); | 284 ChildMap::const_iterator iter = child_files_.find(file_name); |
| 285 if (iter != child_files_.end()) | 285 if (iter != child_files_.end()) |
| 286 return iter->second; | 286 return iter->second; |
| 287 | 287 |
| 288 iter = child_directories_.find(file_name); | 288 iter = child_directories_.find(file_name); |
| 289 if (iter != child_directories_.end()) | 289 if (iter != child_directories_.end()) |
| 290 return iter->second; | 290 return iter->second; |
| 291 | 291 |
| 292 return std::string(); | 292 return std::string(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void DriveDirectory::RemoveChild(DriveEntry* entry) { | 295 void DriveDirectory::RemoveChild(DriveEntry* entry) { |
| 296 DCHECK(entry); | 296 DCHECK(entry); |
| 297 | 297 |
| 298 const std::string& base_name(entry->base_name()); | 298 const std::string& base_name(entry->base_name()); |
| 299 // entry must be present in this directory. | 299 // entry must be present in this directory. |
| 300 DCHECK_EQ(entry->resource_id(), FindChild(base_name)); | 300 DCHECK_EQ(entry->resource_id(), FindChild(base_name)); |
| 301 // Remove entry from resource map first. | 301 // Remove entry from resource map first. |
| 302 directory_service_->RemoveEntryFromResourceMap(entry->resource_id()); | 302 resource_metadata_->RemoveEntryFromResourceMap(entry->resource_id()); |
| 303 | 303 |
| 304 // Then delete it from tree. | 304 // Then delete it from tree. |
| 305 child_files_.erase(base_name); | 305 child_files_.erase(base_name); |
| 306 child_directories_.erase(base_name); | 306 child_directories_.erase(base_name); |
| 307 | 307 |
| 308 entry->SetParent(NULL); | 308 entry->SetParent(NULL); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void DriveDirectory::RemoveChildren() { | 311 void DriveDirectory::RemoveChildren() { |
| 312 RemoveChildFiles(); | 312 RemoveChildFiles(); |
| 313 RemoveChildDirectories(); | 313 RemoveChildDirectories(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void DriveDirectory::RemoveChildFiles() { | 316 void DriveDirectory::RemoveChildFiles() { |
| 317 DVLOG(1) << "RemoveChildFiles " << resource_id(); | 317 DVLOG(1) << "RemoveChildFiles " << resource_id(); |
| 318 for (GDataChildMap::const_iterator iter = child_files_.begin(); | 318 for (ChildMap::const_iterator iter = child_files_.begin(); |
| 319 iter != child_files_.end(); ++iter) { | 319 iter != child_files_.end(); ++iter) { |
| 320 DriveEntry* child = directory_service_->GetEntryByResourceId(iter->second); | 320 DriveEntry* child = resource_metadata_->GetEntryByResourceId(iter->second); |
| 321 DCHECK(child); | 321 DCHECK(child); |
| 322 directory_service_->RemoveEntryFromResourceMap(iter->second); | 322 resource_metadata_->RemoveEntryFromResourceMap(iter->second); |
| 323 delete child; | 323 delete child; |
| 324 } | 324 } |
| 325 child_files_.clear(); | 325 child_files_.clear(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void DriveDirectory::RemoveChildDirectories() { | 328 void DriveDirectory::RemoveChildDirectories() { |
| 329 for (GDataChildMap::iterator iter = child_directories_.begin(); | 329 for (ChildMap::iterator iter = child_directories_.begin(); |
| 330 iter != child_directories_.end(); ++iter) { | 330 iter != child_directories_.end(); ++iter) { |
| 331 DriveDirectory* dir = directory_service_->GetEntryByResourceId( | 331 DriveDirectory* dir = resource_metadata_->GetEntryByResourceId( |
| 332 iter->second)->AsDriveDirectory(); | 332 iter->second)->AsDriveDirectory(); |
| 333 DCHECK(dir); | 333 DCHECK(dir); |
| 334 // Remove directories recursively. | 334 // Remove directories recursively. |
| 335 dir->RemoveChildren(); | 335 dir->RemoveChildren(); |
| 336 directory_service_->RemoveEntryFromResourceMap(iter->second); | 336 resource_metadata_->RemoveEntryFromResourceMap(iter->second); |
| 337 delete dir; | 337 delete dir; |
| 338 } | 338 } |
| 339 child_directories_.clear(); | 339 child_directories_.clear(); |
| 340 } | 340 } |
| 341 | 341 |
| 342 void DriveDirectory::GetChildDirectoryPaths(std::set<FilePath>* child_dirs) { | 342 void DriveDirectory::GetChildDirectoryPaths(std::set<FilePath>* child_dirs) { |
| 343 for (GDataChildMap::const_iterator iter = child_directories_.begin(); | 343 for (ChildMap::const_iterator iter = child_directories_.begin(); |
| 344 iter != child_directories_.end(); ++iter) { | 344 iter != child_directories_.end(); ++iter) { |
| 345 DriveDirectory* dir = directory_service_->GetEntryByResourceId( | 345 DriveDirectory* dir = resource_metadata_->GetEntryByResourceId( |
| 346 iter->second)->AsDriveDirectory(); | 346 iter->second)->AsDriveDirectory(); |
| 347 DCHECK(dir); | 347 DCHECK(dir); |
| 348 child_dirs->insert(dir->GetFilePath()); | 348 child_dirs->insert(dir->GetFilePath()); |
| 349 dir->GetChildDirectoryPaths(child_dirs); | 349 dir->GetChildDirectoryPaths(child_dirs); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 | 352 |
| 353 // Convert to/from proto. | 353 // Convert to/from proto. |
| 354 | 354 |
| 355 // static | 355 // static |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 file_specific_info->set_file_md5(file_md5_); | 443 file_specific_info->set_file_md5(file_md5_); |
| 444 file_specific_info->set_document_extension(document_extension_); | 444 file_specific_info->set_document_extension(document_extension_); |
| 445 file_specific_info->set_is_hosted_document(is_hosted_document_); | 445 file_specific_info->set_is_hosted_document(is_hosted_document_); |
| 446 } | 446 } |
| 447 | 447 |
| 448 void DriveDirectory::FromProto(const DriveDirectoryProto& proto) { | 448 void DriveDirectory::FromProto(const DriveDirectoryProto& proto) { |
| 449 DCHECK(proto.gdata_entry().file_info().is_directory()); | 449 DCHECK(proto.gdata_entry().file_info().is_directory()); |
| 450 DCHECK(!proto.gdata_entry().has_file_specific_info()); | 450 DCHECK(!proto.gdata_entry().has_file_specific_info()); |
| 451 | 451 |
| 452 for (int i = 0; i < proto.child_files_size(); ++i) { | 452 for (int i = 0; i < proto.child_files_size(); ++i) { |
| 453 scoped_ptr<DriveFile> file(directory_service_->CreateDriveFile()); | 453 scoped_ptr<DriveFile> file(resource_metadata_->CreateDriveFile()); |
| 454 file->FromProto(proto.child_files(i)); | 454 file->FromProto(proto.child_files(i)); |
| 455 AddEntry(file.release()); | 455 AddEntry(file.release()); |
| 456 } | 456 } |
| 457 for (int i = 0; i < proto.child_directories_size(); ++i) { | 457 for (int i = 0; i < proto.child_directories_size(); ++i) { |
| 458 scoped_ptr<DriveDirectory> dir(directory_service_->CreateDriveDirectory()); | 458 scoped_ptr<DriveDirectory> dir(resource_metadata_->CreateDriveDirectory()); |
| 459 dir->FromProto(proto.child_directories(i)); | 459 dir->FromProto(proto.child_directories(i)); |
| 460 AddEntry(dir.release()); | 460 AddEntry(dir.release()); |
| 461 } | 461 } |
| 462 | 462 |
| 463 // The states of the directory should be updated after children are | 463 // The states of the directory should be updated after children are |
| 464 // handled successfully, so that incomplete states are not left. | 464 // handled successfully, so that incomplete states are not left. |
| 465 DriveEntry::FromProto(proto.gdata_entry()); | 465 DriveEntry::FromProto(proto.gdata_entry()); |
| 466 } | 466 } |
| 467 | 467 |
| 468 void DriveDirectory::ToProto(DriveDirectoryProto* proto) const { | 468 void DriveDirectory::ToProto(DriveDirectoryProto* proto) const { |
| 469 DriveEntry::ToProto(proto->mutable_gdata_entry()); | 469 DriveEntry::ToProto(proto->mutable_gdata_entry()); |
| 470 DCHECK(proto->gdata_entry().file_info().is_directory()); | 470 DCHECK(proto->gdata_entry().file_info().is_directory()); |
| 471 | 471 |
| 472 for (GDataChildMap::const_iterator iter = child_files_.begin(); | 472 for (ChildMap::const_iterator iter = child_files_.begin(); |
| 473 iter != child_files_.end(); ++iter) { | 473 iter != child_files_.end(); ++iter) { |
| 474 DriveFile* file = directory_service_->GetEntryByResourceId( | 474 DriveFile* file = resource_metadata_->GetEntryByResourceId( |
| 475 iter->second)->AsDriveFile(); | 475 iter->second)->AsDriveFile(); |
| 476 DCHECK(file); | 476 DCHECK(file); |
| 477 file->ToProto(proto->add_child_files()); | 477 file->ToProto(proto->add_child_files()); |
| 478 } | 478 } |
| 479 for (GDataChildMap::const_iterator iter = child_directories_.begin(); | 479 for (ChildMap::const_iterator iter = child_directories_.begin(); |
| 480 iter != child_directories_.end(); ++iter) { | 480 iter != child_directories_.end(); ++iter) { |
| 481 DriveDirectory* dir = directory_service_->GetEntryByResourceId( | 481 DriveDirectory* dir = resource_metadata_->GetEntryByResourceId( |
| 482 iter->second)->AsDriveDirectory(); | 482 iter->second)->AsDriveDirectory(); |
| 483 DCHECK(dir); | 483 DCHECK(dir); |
| 484 dir->ToProto(proto->add_child_directories()); | 484 dir->ToProto(proto->add_child_directories()); |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 | 487 |
| 488 scoped_ptr<DriveEntryProtoVector> DriveDirectory::ToProtoVector() const { | 488 scoped_ptr<DriveEntryProtoVector> DriveDirectory::ToProtoVector() const { |
| 489 scoped_ptr<DriveEntryProtoVector> entries(new DriveEntryProtoVector); | 489 scoped_ptr<DriveEntryProtoVector> entries(new DriveEntryProtoVector); |
| 490 // Use ToProtoFull, as we don't want to include children in |proto|. | 490 // Use ToProtoFull, as we don't want to include children in |proto|. |
| 491 for (GDataChildMap::const_iterator iter = child_files_.begin(); | 491 for (ChildMap::const_iterator iter = child_files_.begin(); |
| 492 iter != child_files_.end(); ++iter) { | 492 iter != child_files_.end(); ++iter) { |
| 493 DriveEntryProto proto; | 493 DriveEntryProto proto; |
| 494 directory_service_->GetEntryByResourceId(iter->second)->ToProtoFull(&proto); | 494 resource_metadata_->GetEntryByResourceId(iter->second)->ToProtoFull(&proto); |
| 495 entries->push_back(proto); | 495 entries->push_back(proto); |
| 496 } | 496 } |
| 497 for (GDataChildMap::const_iterator iter = child_directories_.begin(); | 497 for (ChildMap::const_iterator iter = child_directories_.begin(); |
| 498 iter != child_directories_.end(); ++iter) { | 498 iter != child_directories_.end(); ++iter) { |
| 499 DriveEntryProto proto; | 499 DriveEntryProto proto; |
| 500 directory_service_->GetEntryByResourceId(iter->second)->ToProtoFull(&proto); | 500 resource_metadata_->GetEntryByResourceId(iter->second)->ToProtoFull(&proto); |
| 501 entries->push_back(proto); | 501 entries->push_back(proto); |
| 502 } | 502 } |
| 503 | 503 |
| 504 return entries.Pass(); | 504 return entries.Pass(); |
| 505 } | 505 } |
| 506 | 506 |
| 507 void DriveEntry::SerializeToString(std::string* serialized_proto) const { | 507 void DriveEntry::SerializeToString(std::string* serialized_proto) const { |
| 508 const DriveFile* file = AsDriveFileConst(); | 508 const DriveFile* file = AsDriveFileConst(); |
| 509 const DriveDirectory* dir = AsDriveDirectoryConst(); | 509 const DriveDirectory* dir = AsDriveDirectoryConst(); |
| 510 | 510 |
| 511 if (file) { | 511 if (file) { |
| 512 DriveEntryProto entry_proto; | 512 DriveEntryProto entry_proto; |
| 513 file->ToProto(&entry_proto); | 513 file->ToProto(&entry_proto); |
| 514 const bool ok = entry_proto.SerializeToString(serialized_proto); | 514 const bool ok = entry_proto.SerializeToString(serialized_proto); |
| 515 DCHECK(ok); | 515 DCHECK(ok); |
| 516 } else if (dir) { | 516 } else if (dir) { |
| 517 DriveDirectoryProto dir_proto; | 517 DriveDirectoryProto dir_proto; |
| 518 dir->ToProto(&dir_proto); | 518 dir->ToProto(&dir_proto); |
| 519 const bool ok = dir_proto.SerializeToString(serialized_proto); | 519 const bool ok = dir_proto.SerializeToString(serialized_proto); |
| 520 DCHECK(ok); | 520 DCHECK(ok); |
| 521 } | 521 } |
| 522 } | 522 } |
| 523 | 523 |
| 524 } // namespace gdata | 524 } // namespace gdata |
| OLD | NEW |