| 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/drive/resource_metadata.h" | 5 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 ResourceEntry other_dir; | 131 ResourceEntry other_dir; |
| 132 other_dir.mutable_file_info()->set_is_directory(true); | 132 other_dir.mutable_file_info()->set_is_directory(true); |
| 133 // TODO(hashimoto): Stop setting dummy resource ID here. | 133 // TODO(hashimoto): Stop setting dummy resource ID here. |
| 134 other_dir.set_resource_id(util::kDriveOtherDirLocalId); | 134 other_dir.set_resource_id(util::kDriveOtherDirLocalId); |
| 135 other_dir.set_local_id(util::kDriveOtherDirLocalId); | 135 other_dir.set_local_id(util::kDriveOtherDirLocalId); |
| 136 other_dir.set_parent_local_id(util::kDriveGrandRootLocalId); | 136 other_dir.set_parent_local_id(util::kDriveGrandRootLocalId); |
| 137 other_dir.set_title(util::kDriveOtherDirName); | 137 other_dir.set_title(util::kDriveOtherDirName); |
| 138 if (!PutEntryUnderDirectory(other_dir)) | 138 if (!PutEntryUnderDirectory(other_dir)) |
| 139 return false; | 139 return false; |
| 140 } | 140 } |
| 141 if (!storage_->GetEntry(util::kDriveTrashDirLocalId, &entry)) { |
| 142 ResourceEntry trash_dir; |
| 143 trash_dir.mutable_file_info()->set_is_directory(true); |
| 144 trash_dir.set_local_id(util::kDriveTrashDirLocalId); |
| 145 trash_dir.set_parent_local_id(util::kDriveGrandRootLocalId); |
| 146 trash_dir.set_title(util::kDriveTrashDirName); |
| 147 if (!PutEntryUnderDirectory(trash_dir)) |
| 148 return false; |
| 149 } |
| 141 return true; | 150 return true; |
| 142 } | 151 } |
| 143 | 152 |
| 144 void ResourceMetadata::DestroyOnBlockingPool() { | 153 void ResourceMetadata::DestroyOnBlockingPool() { |
| 145 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); | 154 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); |
| 146 delete this; | 155 delete this; |
| 147 } | 156 } |
| 148 | 157 |
| 149 int64 ResourceMetadata::GetLargestChangestamp() { | 158 int64 ResourceMetadata::GetLargestChangestamp() { |
| 150 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); | 159 DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 for (size_t i = 0; i < children.size(); ++i) { | 466 for (size_t i = 0; i < children.size(); ++i) { |
| 458 if (!RemoveEntryRecursively(children[i])) | 467 if (!RemoveEntryRecursively(children[i])) |
| 459 return false; | 468 return false; |
| 460 } | 469 } |
| 461 } | 470 } |
| 462 return storage_->RemoveEntry(id); | 471 return storage_->RemoveEntry(id); |
| 463 } | 472 } |
| 464 | 473 |
| 465 } // namespace internal | 474 } // namespace internal |
| 466 } // namespace drive | 475 } // namespace drive |
| OLD | NEW |