| 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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Adds GetRemainingChangeList operation to the queue. | 105 // Adds GetRemainingChangeList operation to the queue. |
| 106 // |callback| must not be null. | 106 // |callback| must not be null. |
| 107 void GetRemainingChangeList(const GURL& next_link, | 107 void GetRemainingChangeList(const GURL& next_link, |
| 108 const google_apis::ChangeListCallback& callback); | 108 const google_apis::ChangeListCallback& callback); |
| 109 | 109 |
| 110 // Adds GetRemainingFileList operation to the queue. | 110 // Adds GetRemainingFileList operation to the queue. |
| 111 // |callback| must not be null. | 111 // |callback| must not be null. |
| 112 void GetRemainingFileList(const GURL& next_link, | 112 void GetRemainingFileList(const GURL& next_link, |
| 113 const google_apis::FileListCallback& callback); | 113 const google_apis::FileListCallback& callback); |
| 114 | 114 |
| 115 // Adds a GetResourceEntry operation to the queue. | 115 // Adds a GetFileResource operation to the queue. |
| 116 void GetResourceEntry(const std::string& resource_id, | 116 void GetFileResource(const std::string& resource_id, |
| 117 const ClientContext& context, | 117 const ClientContext& context, |
| 118 const google_apis::GetResourceEntryCallback& callback); | 118 const google_apis::FileResourceCallback& callback); |
| 119 | 119 |
| 120 // Adds a GetShareUrl operation to the queue. | 120 // Adds a GetShareUrl operation to the queue. |
| 121 void GetShareUrl(const std::string& resource_id, | 121 void GetShareUrl(const std::string& resource_id, |
| 122 const GURL& embed_origin, | 122 const GURL& embed_origin, |
| 123 const ClientContext& context, | 123 const ClientContext& context, |
| 124 const google_apis::GetShareUrlCallback& callback); | 124 const google_apis::GetShareUrlCallback& callback); |
| 125 | 125 |
| 126 // Adds a TrashResource operation to the queue. | 126 // Adds a TrashResource operation to the queue. |
| 127 void TrashResource(const std::string& resource_id, | 127 void TrashResource(const std::string& resource_id, |
| 128 const ClientContext& context, | 128 const ClientContext& context, |
| 129 const google_apis::EntryActionCallback& callback); | 129 const google_apis::EntryActionCallback& callback); |
| 130 | 130 |
| 131 // Adds a CopyResource operation to the queue. | 131 // Adds a CopyResource operation to the queue. |
| 132 void CopyResource( | 132 void CopyResource(const std::string& resource_id, |
| 133 const std::string& resource_id, | 133 const std::string& parent_resource_id, |
| 134 const std::string& parent_resource_id, | 134 const std::string& new_title, |
| 135 const std::string& new_title, | 135 const base::Time& last_modified, |
| 136 const base::Time& last_modified, | 136 const google_apis::FileResourceCallback& callback); |
| 137 const google_apis::GetResourceEntryCallback& callback); | |
| 138 | 137 |
| 139 // Adds a UpdateResource operation to the queue. | 138 // Adds a UpdateResource operation to the queue. |
| 140 void UpdateResource( | 139 void UpdateResource(const std::string& resource_id, |
| 141 const std::string& resource_id, | 140 const std::string& parent_resource_id, |
| 142 const std::string& parent_resource_id, | 141 const std::string& new_title, |
| 143 const std::string& new_title, | 142 const base::Time& last_modified, |
| 144 const base::Time& last_modified, | 143 const base::Time& last_viewed_by_me, |
| 145 const base::Time& last_viewed_by_me, | 144 const ClientContext& context, |
| 146 const ClientContext& context, | 145 const google_apis::FileResourceCallback& callback); |
| 147 const google_apis::GetResourceEntryCallback& callback); | |
| 148 | 146 |
| 149 // Adds a RenameResource operation to the queue. | 147 // Adds a RenameResource operation to the queue. |
| 150 void RenameResource(const std::string& resource_id, | 148 void RenameResource(const std::string& resource_id, |
| 151 const std::string& new_title, | 149 const std::string& new_title, |
| 152 const google_apis::EntryActionCallback& callback); | 150 const google_apis::EntryActionCallback& callback); |
| 153 | 151 |
| 154 // Adds a AddResourceToDirectory operation to the queue. | 152 // Adds a AddResourceToDirectory operation to the queue. |
| 155 void AddResourceToDirectory(const std::string& parent_resource_id, | 153 void AddResourceToDirectory(const std::string& parent_resource_id, |
| 156 const std::string& resource_id, | 154 const std::string& resource_id, |
| 157 const google_apis::EntryActionCallback& callback); | 155 const google_apis::EntryActionCallback& callback); |
| 158 | 156 |
| 159 // Adds a RemoveResourceFromDirectory operation to the queue. | 157 // Adds a RemoveResourceFromDirectory operation to the queue. |
| 160 void RemoveResourceFromDirectory( | 158 void RemoveResourceFromDirectory( |
| 161 const std::string& parent_resource_id, | 159 const std::string& parent_resource_id, |
| 162 const std::string& resource_id, | 160 const std::string& resource_id, |
| 163 const ClientContext& context, | 161 const ClientContext& context, |
| 164 const google_apis::EntryActionCallback& callback); | 162 const google_apis::EntryActionCallback& callback); |
| 165 | 163 |
| 166 // Adds a AddNewDirectory operation to the queue. | 164 // Adds a AddNewDirectory operation to the queue. |
| 167 void AddNewDirectory( | 165 void AddNewDirectory( |
| 168 const std::string& parent_resource_id, | 166 const std::string& parent_resource_id, |
| 169 const std::string& directory_title, | 167 const std::string& directory_title, |
| 170 const DriveServiceInterface::AddNewDirectoryOptions& options, | 168 const DriveServiceInterface::AddNewDirectoryOptions& options, |
| 171 const ClientContext& context, | 169 const ClientContext& context, |
| 172 const google_apis::GetResourceEntryCallback& callback); | 170 const google_apis::FileResourceCallback& callback); |
| 173 | 171 |
| 174 // Adds a DownloadFile operation to the queue. | 172 // Adds a DownloadFile operation to the queue. |
| 175 // The first two arguments |virtual_path| and |expected_file_size| are used | 173 // The first two arguments |virtual_path| and |expected_file_size| are used |
| 176 // only for filling JobInfo for the operation so that observers can get the | 174 // only for filling JobInfo for the operation so that observers can get the |
| 177 // detail. The actual operation never refers these values. | 175 // detail. The actual operation never refers these values. |
| 178 JobID DownloadFile( | 176 JobID DownloadFile( |
| 179 const base::FilePath& virtual_path, | 177 const base::FilePath& virtual_path, |
| 180 int64 expected_file_size, | 178 int64 expected_file_size, |
| 181 const base::FilePath& local_cache_path, | 179 const base::FilePath& local_cache_path, |
| 182 const std::string& resource_id, | 180 const std::string& resource_id, |
| 183 const ClientContext& context, | 181 const ClientContext& context, |
| 184 const google_apis::DownloadActionCallback& download_action_callback, | 182 const google_apis::DownloadActionCallback& download_action_callback, |
| 185 const google_apis::GetContentCallback& get_content_callback); | 183 const google_apis::GetContentCallback& get_content_callback); |
| 186 | 184 |
| 187 // Adds an UploadNewFile operation to the queue. | 185 // Adds an UploadNewFile operation to the queue. |
| 188 void UploadNewFile(const std::string& parent_resource_id, | 186 void UploadNewFile(const std::string& parent_resource_id, |
| 189 const base::FilePath& drive_file_path, | 187 const base::FilePath& drive_file_path, |
| 190 const base::FilePath& local_file_path, | 188 const base::FilePath& local_file_path, |
| 191 const std::string& title, | 189 const std::string& title, |
| 192 const std::string& content_type, | 190 const std::string& content_type, |
| 193 const DriveUploader::UploadNewFileOptions& options, | 191 const DriveUploader::UploadNewFileOptions& options, |
| 194 const ClientContext& context, | 192 const ClientContext& context, |
| 195 const google_apis::GetResourceEntryCallback& callback); | 193 const google_apis::FileResourceCallback& callback); |
| 196 | 194 |
| 197 // Adds an UploadExistingFile operation to the queue. | 195 // Adds an UploadExistingFile operation to the queue. |
| 198 void UploadExistingFile( | 196 void UploadExistingFile( |
| 199 const std::string& resource_id, | 197 const std::string& resource_id, |
| 200 const base::FilePath& drive_file_path, | 198 const base::FilePath& drive_file_path, |
| 201 const base::FilePath& local_file_path, | 199 const base::FilePath& local_file_path, |
| 202 const std::string& content_type, | 200 const std::string& content_type, |
| 203 const DriveUploader::UploadExistingFileOptions& options, | 201 const DriveUploader::UploadExistingFileOptions& options, |
| 204 const ClientContext& context, | 202 const ClientContext& context, |
| 205 const google_apis::GetResourceEntryCallback& callback); | 203 const google_apis::FileResourceCallback& callback); |
| 206 | 204 |
| 207 // Adds AddPermission operation to the queue. |callback| must not be null. | 205 // Adds AddPermission operation to the queue. |callback| must not be null. |
| 208 void AddPermission(const std::string& resource_id, | 206 void AddPermission(const std::string& resource_id, |
| 209 const std::string& email, | 207 const std::string& email, |
| 210 google_apis::drive::PermissionRole role, | 208 google_apis::drive::PermissionRole role, |
| 211 const google_apis::EntryActionCallback& callback); | 209 const google_apis::EntryActionCallback& callback); |
| 212 | 210 |
| 213 private: | 211 private: |
| 214 friend class JobSchedulerTest; | 212 friend class JobSchedulerTest; |
| 215 | 213 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 // Callback for job finishing with a ChangeListCallback. | 280 // Callback for job finishing with a ChangeListCallback. |
| 283 void OnGetChangeListJobDone( | 281 void OnGetChangeListJobDone( |
| 284 JobID job_id, | 282 JobID job_id, |
| 285 const google_apis::ChangeListCallback& callback, | 283 const google_apis::ChangeListCallback& callback, |
| 286 google_apis::GDataErrorCode error, | 284 google_apis::GDataErrorCode error, |
| 287 scoped_ptr<google_apis::ChangeList> change_list); | 285 scoped_ptr<google_apis::ChangeList> change_list); |
| 288 | 286 |
| 289 // Callback for job finishing with a FileResourceCallback. | 287 // Callback for job finishing with a FileResourceCallback. |
| 290 void OnGetFileResourceJobDone( | 288 void OnGetFileResourceJobDone( |
| 291 JobID job_id, | 289 JobID job_id, |
| 292 const google_apis::GetResourceEntryCallback& callback, | 290 const google_apis::FileResourceCallback& callback, |
| 293 google_apis::GDataErrorCode error, | 291 google_apis::GDataErrorCode error, |
| 294 scoped_ptr<google_apis::FileResource> entry); | 292 scoped_ptr<google_apis::FileResource> entry); |
| 295 | 293 |
| 296 // Callback for job finishing with a AboutResourceCallback. | 294 // Callback for job finishing with a AboutResourceCallback. |
| 297 void OnGetAboutResourceJobDone( | 295 void OnGetAboutResourceJobDone( |
| 298 JobID job_id, | 296 JobID job_id, |
| 299 const google_apis::AboutResourceCallback& callback, | 297 const google_apis::AboutResourceCallback& callback, |
| 300 google_apis::GDataErrorCode error, | 298 google_apis::GDataErrorCode error, |
| 301 scoped_ptr<google_apis::AboutResource> about_resource); | 299 scoped_ptr<google_apis::AboutResource> about_resource); |
| 302 | 300 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 323 void OnDownloadActionJobDone( | 321 void OnDownloadActionJobDone( |
| 324 JobID job_id, | 322 JobID job_id, |
| 325 const google_apis::DownloadActionCallback& callback, | 323 const google_apis::DownloadActionCallback& callback, |
| 326 google_apis::GDataErrorCode error, | 324 google_apis::GDataErrorCode error, |
| 327 const base::FilePath& temp_file); | 325 const base::FilePath& temp_file); |
| 328 | 326 |
| 329 // Callback for job finishing with a UploadCompletionCallback. | 327 // Callback for job finishing with a UploadCompletionCallback. |
| 330 void OnUploadCompletionJobDone( | 328 void OnUploadCompletionJobDone( |
| 331 JobID job_id, | 329 JobID job_id, |
| 332 const ResumeUploadParams& resume_params, | 330 const ResumeUploadParams& resume_params, |
| 333 const google_apis::GetResourceEntryCallback& callback, | 331 const google_apis::FileResourceCallback& callback, |
| 334 google_apis::GDataErrorCode error, | 332 google_apis::GDataErrorCode error, |
| 335 const GURL& upload_location, | 333 const GURL& upload_location, |
| 336 scoped_ptr<google_apis::FileResource> entry); | 334 scoped_ptr<google_apis::FileResource> entry); |
| 337 | 335 |
| 338 // Callback for DriveUploader::ResumeUploadFile(). | 336 // Callback for DriveUploader::ResumeUploadFile(). |
| 339 void OnResumeUploadFileDone( | 337 void OnResumeUploadFileDone( |
| 340 JobID job_id, | 338 JobID job_id, |
| 341 const base::Callback<google_apis::CancelCallback()>& original_task, | 339 const base::Callback<google_apis::CancelCallback()>& original_task, |
| 342 const google_apis::GetResourceEntryCallback& callback, | 340 const google_apis::FileResourceCallback& callback, |
| 343 google_apis::GDataErrorCode error, | 341 google_apis::GDataErrorCode error, |
| 344 const GURL& upload_location, | 342 const GURL& upload_location, |
| 345 scoped_ptr<google_apis::FileResource> entry); | 343 scoped_ptr<google_apis::FileResource> entry); |
| 346 | 344 |
| 347 // Updates the progress status of the specified job. | 345 // Updates the progress status of the specified job. |
| 348 void UpdateProgress(JobID job_id, int64 progress, int64 total); | 346 void UpdateProgress(JobID job_id, int64 progress, int64 total); |
| 349 | 347 |
| 350 // net::NetworkChangeNotifier::ConnectionTypeObserver override. | 348 // net::NetworkChangeNotifier::ConnectionTypeObserver override. |
| 351 virtual void OnConnectionTypeChanged( | 349 virtual void OnConnectionTypeChanged( |
| 352 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; | 350 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 399 |
| 402 // Note: This should remain the last member so it'll be destroyed and | 400 // Note: This should remain the last member so it'll be destroyed and |
| 403 // invalidate its weak pointers before any other members are destroyed. | 401 // invalidate its weak pointers before any other members are destroyed. |
| 404 base::WeakPtrFactory<JobScheduler> weak_ptr_factory_; | 402 base::WeakPtrFactory<JobScheduler> weak_ptr_factory_; |
| 405 DISALLOW_COPY_AND_ASSIGN(JobScheduler); | 403 DISALLOW_COPY_AND_ASSIGN(JobScheduler); |
| 406 }; | 404 }; |
| 407 | 405 |
| 408 } // namespace drive | 406 } // namespace drive |
| 409 | 407 |
| 410 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ | 408 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ |
| OLD | NEW |