| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/download_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/download_operation.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/task_runner_util.h" | 12 #include "base/task_runner_util.h" |
| 13 #include "chrome/browser/chromeos/drive/drive.pb.h" | 13 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 14 #include "chrome/browser/chromeos/drive/file_cache.h" | 14 #include "chrome/browser/chromeos/drive/file_cache.h" |
| 15 #include "chrome/browser/chromeos/drive/file_change.h" |
| 15 #include "chrome/browser/chromeos/drive/file_errors.h" | 16 #include "chrome/browser/chromeos/drive/file_errors.h" |
| 16 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 17 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
| 17 #include "chrome/browser/chromeos/drive/file_system_util.h" | 18 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 18 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 19 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
| 19 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" | 20 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" |
| 20 #include "chrome/browser/chromeos/drive/resource_metadata.h" | 21 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
| 21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 22 #include "google_apis/drive/gdata_errorcode.h" | 23 #include "google_apis/drive/gdata_errorcode.h" |
| 23 | 24 |
| 24 using content::BrowserThread; | 25 using content::BrowserThread; |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 scoped_ptr<ResourceEntry> entry_after_update, | 522 scoped_ptr<ResourceEntry> entry_after_update, |
| 522 base::FilePath* cache_file_path, | 523 base::FilePath* cache_file_path, |
| 523 FileError error) { | 524 FileError error) { |
| 524 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 525 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 525 | 526 |
| 526 if (error != FILE_ERROR_OK) { | 527 if (error != FILE_ERROR_OK) { |
| 527 params->OnError(error); | 528 params->OnError(error); |
| 528 return; | 529 return; |
| 529 } | 530 } |
| 530 | 531 |
| 532 FileChange changed_files; |
| 533 changed_files.Update(file_path, |
| 534 FileChange::FILE_TYPE_FILE, |
| 535 FileChange::ADD_OR_UPDATE); |
| 531 // Storing to cache changes the "offline available" status, hence notify. | 536 // Storing to cache changes the "offline available" status, hence notify. |
| 532 observer_->OnDirectoryChangedByOperation(file_path.DirName()); | 537 observer_->OnDirectoryChangedByOperation(changed_files); |
| 533 params->OnDownloadCompleted(*cache_file_path, entry_after_update.Pass()); | 538 params->OnDownloadCompleted(*cache_file_path, entry_after_update.Pass()); |
| 534 } | 539 } |
| 535 | 540 |
| 536 void DownloadOperation::CancelJob(JobID job_id) { | 541 void DownloadOperation::CancelJob(JobID job_id) { |
| 537 scheduler_->CancelJob(job_id); | 542 scheduler_->CancelJob(job_id); |
| 538 } | 543 } |
| 539 | 544 |
| 540 } // namespace file_system | 545 } // namespace file_system |
| 541 } // namespace drive | 546 } // namespace drive |
| OLD | NEW |