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

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

Issue 445473002: Remove ResourceIdCanonicalizer from DriveServiceInterface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 params->location_type = HAS_PARENT; 272 params->location_type = HAS_PARENT;
273 return FILE_ERROR_OK; 273 return FILE_ERROR_OK;
274 } 274 }
275 275
276 } // namespace 276 } // namespace
277 277
278 CopyOperation::CopyOperation(base::SequencedTaskRunner* blocking_task_runner, 278 CopyOperation::CopyOperation(base::SequencedTaskRunner* blocking_task_runner,
279 OperationDelegate* delegate, 279 OperationDelegate* delegate,
280 JobScheduler* scheduler, 280 JobScheduler* scheduler,
281 internal::ResourceMetadata* metadata, 281 internal::ResourceMetadata* metadata,
282 internal::FileCache* cache, 282 internal::FileCache* cache)
283 const ResourceIdCanonicalizer& id_canonicalizer)
284 : blocking_task_runner_(blocking_task_runner), 283 : blocking_task_runner_(blocking_task_runner),
285 delegate_(delegate), 284 delegate_(delegate),
286 scheduler_(scheduler), 285 scheduler_(scheduler),
287 metadata_(metadata), 286 metadata_(metadata),
288 cache_(cache), 287 cache_(cache),
289 id_canonicalizer_(id_canonicalizer),
290 create_file_operation_(new CreateFileOperation(blocking_task_runner, 288 create_file_operation_(new CreateFileOperation(blocking_task_runner,
291 delegate, 289 delegate,
292 metadata)), 290 metadata)),
293 weak_ptr_factory_(this) { 291 weak_ptr_factory_(this) {
294 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 292 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
295 } 293 }
296 294
297 CopyOperation::~CopyOperation() { 295 CopyOperation::~CopyOperation() {
298 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 296 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
299 } 297 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 450 }
453 451
454 // For regular files, schedule the transfer. 452 // For regular files, schedule the transfer.
455 if (gdoc_resource_id->empty()) { 453 if (gdoc_resource_id->empty()) {
456 ScheduleTransferRegularFile(local_src_path, remote_dest_path, callback); 454 ScheduleTransferRegularFile(local_src_path, remote_dest_path, callback);
457 return; 455 return;
458 } 456 }
459 457
460 // GDoc file may contain a resource ID in the old format. 458 // GDoc file may contain a resource ID in the old format.
461 const std::string canonicalized_resource_id = 459 const std::string canonicalized_resource_id =
462 id_canonicalizer_.Run(*gdoc_resource_id); 460 util::CanonicalizeResourceId(*gdoc_resource_id);
463 461
464 // Drop the document extension, which should not be in the title. 462 // Drop the document extension, which should not be in the title.
465 // TODO(yoshiki): Remove this code with crbug.com/223304. 463 // TODO(yoshiki): Remove this code with crbug.com/223304.
466 const std::string new_title = 464 const std::string new_title =
467 remote_dest_path.BaseName().RemoveExtension().AsUTF8Unsafe(); 465 remote_dest_path.BaseName().RemoveExtension().AsUTF8Unsafe();
468 466
469 // This is uploading a JSON file representing a hosted document. 467 // This is uploading a JSON file representing a hosted document.
470 TransferJsonGdocParams* params = new TransferJsonGdocParams( 468 TransferJsonGdocParams* params = new TransferJsonGdocParams(
471 callback, canonicalized_resource_id, *parent_entry, new_title); 469 callback, canonicalized_resource_id, *parent_entry, new_title);
472 base::PostTaskAndReplyWithResult( 470 base::PostTaskAndReplyWithResult(
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 FileChange changed_file; 659 FileChange changed_file;
662 changed_file.Update(remote_dest_path, *entry, FileChange::ADD_OR_UPDATE); 660 changed_file.Update(remote_dest_path, *entry, FileChange::ADD_OR_UPDATE);
663 delegate_->OnFileChangedByOperation(changed_file); 661 delegate_->OnFileChangedByOperation(changed_file);
664 delegate_->OnEntryUpdatedByOperation(*local_id); 662 delegate_->OnEntryUpdatedByOperation(*local_id);
665 } 663 }
666 callback.Run(error); 664 callback.Run(error);
667 } 665 }
668 666
669 } // namespace file_system 667 } // namespace file_system
670 } // namespace drive 668 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698