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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/copy_operation.cc

Issue 278273002: drive: Change the return type of ResourceMetadata's methods to FileError (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/file_system/copy_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/copy_operation.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 return error; 180 return error;
181 entry.set_parent_local_id(parent_local_id); 181 entry.set_parent_local_id(parent_local_id);
182 182
183 std::string local_id; 183 std::string local_id;
184 error = metadata->AddEntry(entry, &local_id); 184 error = metadata->AddEntry(entry, &local_id);
185 // Depending on timing, the metadata may have inserted via change list 185 // Depending on timing, the metadata may have inserted via change list
186 // already. So, FILE_ERROR_EXISTS is not an error. 186 // already. So, FILE_ERROR_EXISTS is not an error.
187 if (error == FILE_ERROR_EXISTS) 187 if (error == FILE_ERROR_EXISTS)
188 error = metadata->GetIdByResourceId(entry.resource_id(), &local_id); 188 error = metadata->GetIdByResourceId(entry.resource_id(), &local_id);
189 189
190 if (error == FILE_ERROR_OK) 190 if (error != FILE_ERROR_OK)
191 *file_path = metadata->GetFilePath(local_id); 191 return error;
192 192
193 return error; 193 return metadata->GetFilePath(local_id, file_path);
194 } 194 }
195 195
196 // Stores the file at |local_file_path| to the cache as a content of entry at 196 // Stores the file at |local_file_path| to the cache as a content of entry at
197 // |remote_dest_path|, and marks it dirty. 197 // |remote_dest_path|, and marks it dirty.
198 FileError UpdateLocalStateForScheduleTransfer( 198 FileError UpdateLocalStateForScheduleTransfer(
199 internal::ResourceMetadata* metadata, 199 internal::ResourceMetadata* metadata,
200 internal::FileCache* cache, 200 internal::FileCache* cache,
201 const base::FilePath& local_src_path, 201 const base::FilePath& local_src_path,
202 const base::FilePath& remote_dest_path, 202 const base::FilePath& remote_dest_path,
203 std::string* local_id) { 203 std::string* local_id) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return error; 256 return error;
257 params->local_id = entry.local_id(); 257 params->local_id = entry.local_id();
258 258
259 if (entry.parent_local_id() == util::kDriveOtherDirLocalId) { 259 if (entry.parent_local_id() == util::kDriveOtherDirLocalId) {
260 params->location_type = IS_ORPHAN; 260 params->location_type = IS_ORPHAN;
261 entry.set_title(params->new_title); 261 entry.set_title(params->new_title);
262 entry.set_parent_local_id(params->parent_local_id); 262 entry.set_parent_local_id(params->parent_local_id);
263 entry.set_metadata_edit_state(ResourceEntry::DIRTY); 263 entry.set_metadata_edit_state(ResourceEntry::DIRTY);
264 entry.set_modification_date(base::Time::Now().ToInternalValue()); 264 entry.set_modification_date(base::Time::Now().ToInternalValue());
265 error = metadata->RefreshEntry(entry); 265 error = metadata->RefreshEntry(entry);
266 if (error == FILE_ERROR_OK) 266 if (error != FILE_ERROR_OK)
267 params->changed_path = metadata->GetFilePath(local_id); 267 return error;
268 return error; 268 return metadata->GetFilePath(local_id, &params->changed_path);
269 } 269 }
270 270
271 params->location_type = HAS_PARENT; 271 params->location_type = HAS_PARENT;
272 return FILE_ERROR_OK; 272 return FILE_ERROR_OK;
273 } 273 }
274 274
275 } // namespace 275 } // namespace
276 276
277 CopyOperation::CopyOperation(base::SequencedTaskRunner* blocking_task_runner, 277 CopyOperation::CopyOperation(base::SequencedTaskRunner* blocking_task_runner,
278 OperationObserver* observer, 278 OperationObserver* observer,
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 580
581 if (error == FILE_ERROR_OK) { 581 if (error == FILE_ERROR_OK) {
582 observer_->OnDirectoryChangedByOperation(remote_dest_path.DirName()); 582 observer_->OnDirectoryChangedByOperation(remote_dest_path.DirName());
583 observer_->OnEntryUpdatedByOperation(*local_id); 583 observer_->OnEntryUpdatedByOperation(*local_id);
584 } 584 }
585 callback.Run(error); 585 callback.Run(error);
586 } 586 }
587 587
588 } // namespace file_system 588 } // namespace file_system
589 } // namespace drive 589 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system.cc ('k') | chrome/browser/chromeos/drive/file_system/create_directory_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698