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

Unified Diff: chrome/browser/chromeos/drive/drive_scheduler.cc

Issue 14235015: Fill JobInfo in DriveScheduler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/drive/drive_scheduler.cc
diff --git a/chrome/browser/chromeos/drive/drive_scheduler.cc b/chrome/browser/chromeos/drive/drive_scheduler.cc
index 6150f7681cc3af245bdfe5804c24e38ba8ca921d..1d5220ee375b3ad8b2a615d9d56f29d99b1e137a 100644
--- a/chrome/browser/chromeos/drive/drive_scheduler.cc
+++ b/chrome/browser/chromeos/drive/drive_scheduler.cc
@@ -305,8 +305,8 @@ void DriveScheduler::DownloadFile(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
scoped_ptr<QueueEntry> new_job(new QueueEntry);
- new_job->virtual_path = virtual_path;
- new_job->local_cache_path = local_cache_path;
+ new_job->drive_file_path = virtual_path;
+ new_job->local_file_path = local_cache_path;
new_job->download_url = download_url;
new_job->context = context;
new_job->download_action_callback = download_action_callback;
@@ -363,6 +363,7 @@ void DriveScheduler::StartNewJob(scoped_ptr<QueueEntry> job, JobType type) {
// job_info is owned by job_map_ and released when it is removed in OnJobDone.
JobInfo* job_info = new JobInfo(type);
job->job_id = job_info->job_id = job_map_.Add(job_info);
+ job_info->file_path = job->drive_file_path;
hidehiko 2013/04/17 06:23:21 drive_file_path is only available for Upload/Downl
kinaba 2013/04/17 06:41:01 Thanks, good catch. I haven't deeply thought about
QueueJob(job.Pass());
StartJobLoop(GetJobQueueType(type));
@@ -556,14 +557,16 @@ void DriveScheduler::DoJobLoop(QueueType queue_type) {
case TYPE_DOWNLOAD_FILE: {
drive_service_->DownloadFile(
- entry->virtual_path,
- entry->local_cache_path,
+ entry->drive_file_path,
+ entry->local_file_path,
entry->download_url,
base::Bind(&DriveScheduler::OnDownloadActionJobDone,
weak_ptr_factory_.GetWeakPtr(),
base::Passed(&queue_entry)),
entry->get_content_callback,
- google_apis::ProgressCallback());
+ base::Bind(&DriveScheduler::UpdateProgress,
+ weak_ptr_factory_.GetWeakPtr(),
+ job_info->job_id));
}
break;
@@ -577,7 +580,9 @@ void DriveScheduler::DoJobLoop(QueueType queue_type) {
base::Bind(&DriveScheduler::OnUploadCompletionJobDone,
weak_ptr_factory_.GetWeakPtr(),
base::Passed(&queue_entry)),
- google_apis::ProgressCallback());
+ base::Bind(&DriveScheduler::UpdateProgress,
+ weak_ptr_factory_.GetWeakPtr(),
+ job_info->job_id));
}
break;
@@ -591,7 +596,9 @@ void DriveScheduler::DoJobLoop(QueueType queue_type) {
base::Bind(&DriveScheduler::OnUploadCompletionJobDone,
weak_ptr_factory_.GetWeakPtr(),
base::Passed(&queue_entry)),
- google_apis::ProgressCallback());
+ base::Bind(&DriveScheduler::UpdateProgress,
+ weak_ptr_factory_.GetWeakPtr(),
+ job_info->job_id));
}
break;
@@ -850,6 +857,14 @@ void DriveScheduler::OnUploadCompletionJobDone(
error, drive_path, file_path, resource_entry.Pass());
}
+void DriveScheduler::UpdateProgress(JobID job_id, int64 progress, int64 total) {
+ JobInfo* job_info = job_map_.Lookup(job_id);
+ DCHECK(job_info);
+
+ job_info->num_completed_bytes = progress;
+ job_info->num_total_bytes = total;
+}
+
void DriveScheduler::OnConnectionTypeChanged(
net::NetworkChangeNotifier::ConnectionType type) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
« no previous file with comments | « chrome/browser/chromeos/drive/drive_scheduler.h ('k') | chrome/browser/chromeos/drive/drive_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698