OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/file_system/create_directory_operation.h
" | 5 #include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h
" |
6 | 6 |
7 #include "chrome/browser/chromeos/drive/drive.pb.h" | 7 #include "chrome/browser/chromeos/drive/drive.pb.h" |
8 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 8 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
9 #include "chrome/browser/chromeos/drive/file_system_util.h" | 9 #include "chrome/browser/chromeos/drive/file_system_util.h" |
10 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 10 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 std::string resource_id = util::kDriveGrandRootSpecialResourceId; | 99 std::string resource_id = util::kDriveGrandRootSpecialResourceId; |
100 for (size_t i = 1; i < components.size(); ++i) { | 100 for (size_t i = 1; i < components.size(); ++i) { |
101 std::string child_resource_id = | 101 std::string child_resource_id = |
102 metadata->GetChildResourceId(resource_id, components[i]); | 102 metadata->GetChildResourceId(resource_id, components[i]); |
103 if (child_resource_id.empty()) | 103 if (child_resource_id.empty()) |
104 break; | 104 break; |
105 resource_id = child_resource_id; | 105 resource_id = child_resource_id; |
106 } | 106 } |
107 | 107 |
108 FileError error = metadata->GetResourceEntryById(resource_id, NULL, entry); | 108 FileError error = metadata->GetResourceEntryById(resource_id, entry); |
109 DCHECK_EQ(FILE_ERROR_OK, error); | 109 DCHECK_EQ(FILE_ERROR_OK, error); |
110 | 110 |
111 if (!entry->file_info().is_directory()) | 111 if (!entry->file_info().is_directory()) |
112 return base::FilePath(); | 112 return base::FilePath(); |
113 | 113 |
114 return metadata->GetFilePath(resource_id); | 114 return metadata->GetFilePath(resource_id); |
115 } | 115 } |
116 | 116 |
117 void CreateDirectoryOperation::CreateDirectoryAfterGetExistingDeepestDirectory( | 117 void CreateDirectoryOperation::CreateDirectoryAfterGetExistingDeepestDirectory( |
118 const base::FilePath& directory_path, | 118 const base::FilePath& directory_path, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 callback.Run(FILE_ERROR_OK); | 229 callback.Run(FILE_ERROR_OK); |
230 return; | 230 return; |
231 } | 231 } |
232 | 232 |
233 // Create descendent directories. | 233 // Create descendent directories. |
234 CreateDirectoryRecursively(resource_id, remaining_path, callback); | 234 CreateDirectoryRecursively(resource_id, remaining_path, callback); |
235 } | 235 } |
236 | 236 |
237 } // namespace file_system | 237 } // namespace file_system |
238 } // namespace drive | 238 } // namespace drive |
OLD | NEW |