OLD | NEW |
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/job_scheduler.h" | 5 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 574 |
575 void JobScheduler::CreateFile( | 575 void JobScheduler::CreateFile( |
576 const std::string& parent_resource_id, | 576 const std::string& parent_resource_id, |
577 const base::FilePath& drive_file_path, | 577 const base::FilePath& drive_file_path, |
578 const std::string& title, | 578 const std::string& title, |
579 const std::string& content_type, | 579 const std::string& content_type, |
580 const DriveClientContext& context, | 580 const DriveClientContext& context, |
581 const google_apis::GetResourceEntryCallback& callback) { | 581 const google_apis::GetResourceEntryCallback& callback) { |
582 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 582 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
583 | 583 |
| 584 const base::FilePath kDevNull(FILE_PATH_LITERAL("/dev/null")); |
| 585 |
584 JobEntry* new_job = CreateNewJob(TYPE_CREATE_FILE); | 586 JobEntry* new_job = CreateNewJob(TYPE_CREATE_FILE); |
585 new_job->job_info.file_path = drive_file_path; | 587 new_job->job_info.file_path = drive_file_path; |
586 new_job->context = context; | 588 new_job->context = context; |
587 | 589 |
588 UploadNewFileParams params; | 590 UploadNewFileParams params; |
589 params.parent_resource_id = parent_resource_id; | 591 params.parent_resource_id = parent_resource_id; |
590 params.drive_file_path = drive_file_path; | 592 params.drive_file_path = drive_file_path; |
591 params.local_file_path = base::FilePath(util::kSymLinkToDevNull); | 593 params.local_file_path = kDevNull; // Upload an empty file. |
592 params.title = title; | 594 params.title = title; |
593 params.content_type = content_type; | 595 params.content_type = content_type; |
594 | 596 |
595 ResumeUploadParams resume_params; | 597 ResumeUploadParams resume_params; |
596 resume_params.drive_file_path = params.drive_file_path; | 598 resume_params.drive_file_path = params.drive_file_path; |
597 resume_params.local_file_path = params.local_file_path; | 599 resume_params.local_file_path = params.local_file_path; |
598 resume_params.content_type = params.content_type; | 600 resume_params.content_type = params.content_type; |
599 | 601 |
600 params.callback = base::Bind(&JobScheduler::OnUploadCompletionJobDone, | 602 params.callback = base::Bind(&JobScheduler::OnUploadCompletionJobDone, |
601 weak_ptr_factory_.GetWeakPtr(), | 603 weak_ptr_factory_.GetWeakPtr(), |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 case FILE_QUEUE: | 958 case FILE_QUEUE: |
957 return "FILE_QUEUE"; | 959 return "FILE_QUEUE"; |
958 case NUM_QUEUES: | 960 case NUM_QUEUES: |
959 break; // This value is just a sentinel. Should never be used. | 961 break; // This value is just a sentinel. Should never be used. |
960 } | 962 } |
961 NOTREACHED(); | 963 NOTREACHED(); |
962 return ""; | 964 return ""; |
963 } | 965 } |
964 | 966 |
965 } // namespace drive | 967 } // namespace drive |
OLD | NEW |