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

Side by Side Diff: chrome/browser/chromeos/drive/job_scheduler.cc

Issue 17227003: Change google_apis::DriveUploader interface to return CancelCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/google_apis/drive_uploader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 24 matching lines...) Expand all
35 std::string title; 35 std::string title;
36 std::string content_type; 36 std::string content_type;
37 google_apis::UploadCompletionCallback callback; 37 google_apis::UploadCompletionCallback callback;
38 google_apis::ProgressCallback progress_callback; 38 google_apis::ProgressCallback progress_callback;
39 }; 39 };
40 40
41 // Helper function to work around the arity limitation of base::Bind. 41 // Helper function to work around the arity limitation of base::Bind.
42 google_apis::CancelCallback RunUploadNewFile( 42 google_apis::CancelCallback RunUploadNewFile(
43 google_apis::DriveUploaderInterface* uploader, 43 google_apis::DriveUploaderInterface* uploader,
44 const UploadNewFileParams& params) { 44 const UploadNewFileParams& params) {
45 uploader->UploadNewFile(params.parent_resource_id, 45 return uploader->UploadNewFile(params.parent_resource_id,
46 params.drive_file_path, 46 params.drive_file_path,
47 params.local_file_path, 47 params.local_file_path,
48 params.title, 48 params.title,
49 params.content_type, 49 params.content_type,
50 params.callback, 50 params.callback,
51 params.progress_callback); 51 params.progress_callback);
52 // TODO(kinaba): crbug.com/231209 Return a proper CancelCallback.
53 return google_apis::CancelCallback();
54 } 52 }
55 53
56 // Parameter struct for RunUploadExistingFile. 54 // Parameter struct for RunUploadExistingFile.
57 struct UploadExistingFileParams { 55 struct UploadExistingFileParams {
58 std::string resource_id; 56 std::string resource_id;
59 base::FilePath drive_file_path; 57 base::FilePath drive_file_path;
60 base::FilePath local_file_path; 58 base::FilePath local_file_path;
61 std::string content_type; 59 std::string content_type;
62 std::string etag; 60 std::string etag;
63 google_apis::UploadCompletionCallback callback; 61 google_apis::UploadCompletionCallback callback;
64 google_apis::ProgressCallback progress_callback; 62 google_apis::ProgressCallback progress_callback;
65 }; 63 };
66 64
67 // Helper function to work around the arity limitation of base::Bind. 65 // Helper function to work around the arity limitation of base::Bind.
68 google_apis::CancelCallback RunUploadExistingFile( 66 google_apis::CancelCallback RunUploadExistingFile(
69 google_apis::DriveUploaderInterface* uploader, 67 google_apis::DriveUploaderInterface* uploader,
70 const UploadExistingFileParams& params) { 68 const UploadExistingFileParams& params) {
71 uploader->UploadExistingFile(params.resource_id, 69 return uploader->UploadExistingFile(params.resource_id,
72 params.drive_file_path, 70 params.drive_file_path,
73 params.local_file_path, 71 params.local_file_path,
74 params.content_type, 72 params.content_type,
75 params.etag, 73 params.etag,
76 params.callback, 74 params.callback,
77 params.progress_callback); 75 params.progress_callback);
78 // TODO(kinaba): crbug.com/231209 Return a proper CancelCallback.
79 return google_apis::CancelCallback();
80 } 76 }
81 77
82 // Parameter struct for RunResumeUploadFile. 78 // Parameter struct for RunResumeUploadFile.
83 struct ResumeUploadFileParams { 79 struct ResumeUploadFileParams {
84 GURL upload_location; 80 GURL upload_location;
85 base::FilePath drive_file_path; 81 base::FilePath drive_file_path;
86 base::FilePath local_file_path; 82 base::FilePath local_file_path;
87 std::string content_type; 83 std::string content_type;
88 google_apis::UploadCompletionCallback callback; 84 google_apis::UploadCompletionCallback callback;
89 google_apis::ProgressCallback progress_callback; 85 google_apis::ProgressCallback progress_callback;
90 }; 86 };
91 87
92 // Helper function to adjust the return type. 88 // Helper function to adjust the return type.
93 google_apis::CancelCallback RunResumeUploadFile( 89 google_apis::CancelCallback RunResumeUploadFile(
94 google_apis::DriveUploaderInterface* uploader, 90 google_apis::DriveUploaderInterface* uploader,
95 const ResumeUploadFileParams& params) { 91 const ResumeUploadFileParams& params) {
96 uploader->ResumeUploadFile(params.upload_location, 92 return uploader->ResumeUploadFile(params.upload_location,
97 params.drive_file_path, 93 params.drive_file_path,
98 params.local_file_path, 94 params.local_file_path,
99 params.content_type, 95 params.content_type,
100 params.callback, 96 params.callback,
101 params.progress_callback); 97 params.progress_callback);
102 // TODO(kinaba): crbug.com/231209 Return a proper CancelCallback.
103 return google_apis::CancelCallback();
104 } 98 }
105 99
106 } // namespace 100 } // namespace
107 101
108 const int JobScheduler::kMaxJobCount[] = { 102 const int JobScheduler::kMaxJobCount[] = {
109 5, // METADATA_QUEUE 103 5, // METADATA_QUEUE
110 1, // FILE_QUEUE 104 1, // FILE_QUEUE
111 }; 105 };
112 106
113 JobScheduler::JobEntry::JobEntry(JobType type) 107 JobScheduler::JobEntry::JobEntry(JobType type)
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 case FILE_QUEUE: 982 case FILE_QUEUE:
989 return "FILE_QUEUE"; 983 return "FILE_QUEUE";
990 case NUM_QUEUES: 984 case NUM_QUEUES:
991 break; // This value is just a sentinel. Should never be used. 985 break; // This value is just a sentinel. Should never be used.
992 } 986 }
993 NOTREACHED(); 987 NOTREACHED();
994 return ""; 988 return "";
995 } 989 }
996 990
997 } // namespace drive 991 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/google_apis/drive_uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698