| 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 COMPONENTS_DRIVE_JOB_SCHEDULER_H_ | 5 #ifndef COMPONENTS_DRIVE_JOB_SCHEDULER_H_ |
| 6 #define COMPONENTS_DRIVE_JOB_SCHEDULER_H_ | 6 #define COMPONENTS_DRIVE_JOB_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 14 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 14 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 15 #include "components/drive/drive_uploader.h" | 18 #include "components/drive/drive_uploader.h" |
| 16 #include "components/drive/job_list.h" | 19 #include "components/drive/job_list.h" |
| 17 #include "components/drive/job_queue.h" | 20 #include "components/drive/job_queue.h" |
| 18 #include "components/drive/service/drive_service_interface.h" | 21 #include "components/drive/service/drive_service_interface.h" |
| 19 #include "net/base/network_change_notifier.h" | 22 #include "net/base/network_change_notifier.h" |
| 20 | 23 |
| 21 class PrefService; | 24 class PrefService; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 void GetFileListInDirectory(const std::string& directory_resource_id, | 97 void GetFileListInDirectory(const std::string& directory_resource_id, |
| 95 const google_apis::FileListCallback& callback); | 98 const google_apis::FileListCallback& callback); |
| 96 | 99 |
| 97 // Adds a Search operation to the queue. | 100 // Adds a Search operation to the queue. |
| 98 // |callback| must not be null. | 101 // |callback| must not be null. |
| 99 void Search(const std::string& search_query, | 102 void Search(const std::string& search_query, |
| 100 const google_apis::FileListCallback& callback); | 103 const google_apis::FileListCallback& callback); |
| 101 | 104 |
| 102 // Adds a GetChangeList operation to the queue. | 105 // Adds a GetChangeList operation to the queue. |
| 103 // |callback| must not be null. | 106 // |callback| must not be null. |
| 104 void GetChangeList(int64 start_changestamp, | 107 void GetChangeList(int64_t start_changestamp, |
| 105 const google_apis::ChangeListCallback& callback); | 108 const google_apis::ChangeListCallback& callback); |
| 106 | 109 |
| 107 // Adds GetRemainingChangeList operation to the queue. | 110 // Adds GetRemainingChangeList operation to the queue. |
| 108 // |callback| must not be null. | 111 // |callback| must not be null. |
| 109 void GetRemainingChangeList(const GURL& next_link, | 112 void GetRemainingChangeList(const GURL& next_link, |
| 110 const google_apis::ChangeListCallback& callback); | 113 const google_apis::ChangeListCallback& callback); |
| 111 | 114 |
| 112 // Adds GetRemainingFileList operation to the queue. | 115 // Adds GetRemainingFileList operation to the queue. |
| 113 // |callback| must not be null. | 116 // |callback| must not be null. |
| 114 void GetRemainingFileList(const GURL& next_link, | 117 void GetRemainingFileList(const GURL& next_link, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 const AddNewDirectoryOptions& options, | 168 const AddNewDirectoryOptions& options, |
| 166 const ClientContext& context, | 169 const ClientContext& context, |
| 167 const google_apis::FileResourceCallback& callback); | 170 const google_apis::FileResourceCallback& callback); |
| 168 | 171 |
| 169 // Adds a DownloadFile operation to the queue. | 172 // Adds a DownloadFile operation to the queue. |
| 170 // 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 |
| 171 // 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 |
| 172 // detail. The actual operation never refers these values. | 175 // detail. The actual operation never refers these values. |
| 173 JobID DownloadFile( | 176 JobID DownloadFile( |
| 174 const base::FilePath& virtual_path, | 177 const base::FilePath& virtual_path, |
| 175 int64 expected_file_size, | 178 int64_t expected_file_size, |
| 176 const base::FilePath& local_cache_path, | 179 const base::FilePath& local_cache_path, |
| 177 const std::string& resource_id, | 180 const std::string& resource_id, |
| 178 const ClientContext& context, | 181 const ClientContext& context, |
| 179 const google_apis::DownloadActionCallback& download_action_callback, | 182 const google_apis::DownloadActionCallback& download_action_callback, |
| 180 const google_apis::GetContentCallback& get_content_callback); | 183 const google_apis::GetContentCallback& get_content_callback); |
| 181 | 184 |
| 182 // Adds an UploadNewFile operation to the queue. | 185 // Adds an UploadNewFile operation to the queue. |
| 183 void UploadNewFile(const std::string& parent_resource_id, | 186 void UploadNewFile(const std::string& parent_resource_id, |
| 184 int64 expected_file_size, | 187 int64_t expected_file_size, |
| 185 const base::FilePath& drive_file_path, | 188 const base::FilePath& drive_file_path, |
| 186 const base::FilePath& local_file_path, | 189 const base::FilePath& local_file_path, |
| 187 const std::string& title, | 190 const std::string& title, |
| 188 const std::string& content_type, | 191 const std::string& content_type, |
| 189 const UploadNewFileOptions& options, | 192 const UploadNewFileOptions& options, |
| 190 const ClientContext& context, | 193 const ClientContext& context, |
| 191 const google_apis::FileResourceCallback& callback); | 194 const google_apis::FileResourceCallback& callback); |
| 192 | 195 |
| 193 // Adds an UploadExistingFile operation to the queue. | 196 // Adds an UploadExistingFile operation to the queue. |
| 194 void UploadExistingFile(const std::string& resource_id, | 197 void UploadExistingFile(const std::string& resource_id, |
| 195 int64 expected_file_size, | 198 int64_t expected_file_size, |
| 196 const base::FilePath& drive_file_path, | 199 const base::FilePath& drive_file_path, |
| 197 const base::FilePath& local_file_path, | 200 const base::FilePath& local_file_path, |
| 198 const std::string& content_type, | 201 const std::string& content_type, |
| 199 const UploadExistingFileOptions& options, | 202 const UploadExistingFileOptions& options, |
| 200 const ClientContext& context, | 203 const ClientContext& context, |
| 201 const google_apis::FileResourceCallback& callback); | 204 const google_apis::FileResourceCallback& callback); |
| 202 | 205 |
| 203 // Adds AddPermission operation to the queue. |callback| must not be null. | 206 // Adds AddPermission operation to the queue. |callback| must not be null. |
| 204 void AddPermission(const std::string& resource_id, | 207 void AddPermission(const std::string& resource_id, |
| 205 const std::string& email, | 208 const std::string& email, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // Callback for DriveUploader::ResumeUploadFile(). | 339 // Callback for DriveUploader::ResumeUploadFile(). |
| 337 void OnResumeUploadFileDone( | 340 void OnResumeUploadFileDone( |
| 338 JobID job_id, | 341 JobID job_id, |
| 339 const base::Callback<google_apis::CancelCallback()>& original_task, | 342 const base::Callback<google_apis::CancelCallback()>& original_task, |
| 340 const google_apis::FileResourceCallback& callback, | 343 const google_apis::FileResourceCallback& callback, |
| 341 google_apis::DriveApiErrorCode error, | 344 google_apis::DriveApiErrorCode error, |
| 342 const GURL& upload_location, | 345 const GURL& upload_location, |
| 343 scoped_ptr<google_apis::FileResource> entry); | 346 scoped_ptr<google_apis::FileResource> entry); |
| 344 | 347 |
| 345 // Updates the progress status of the specified job. | 348 // Updates the progress status of the specified job. |
| 346 void UpdateProgress(JobID job_id, int64 progress, int64 total); | 349 void UpdateProgress(JobID job_id, int64_t progress, int64_t total); |
| 347 | 350 |
| 348 // net::NetworkChangeNotifier::ConnectionTypeObserver override. | 351 // net::NetworkChangeNotifier::ConnectionTypeObserver override. |
| 349 void OnConnectionTypeChanged( | 352 void OnConnectionTypeChanged( |
| 350 net::NetworkChangeNotifier::ConnectionType type) override; | 353 net::NetworkChangeNotifier::ConnectionType type) override; |
| 351 | 354 |
| 352 // Get the type of queue the specified job should be put in. | 355 // Get the type of queue the specified job should be put in. |
| 353 QueueType GetJobQueueType(JobType type); | 356 QueueType GetJobQueueType(JobType type); |
| 354 | 357 |
| 355 // For testing only. Disables throttling so that testing is faster. | 358 // For testing only. Disables throttling so that testing is faster. |
| 356 void SetDisableThrottling(bool disable) { disable_throttling_ = disable; } | 359 void SetDisableThrottling(bool disable) { disable_throttling_ = disable; } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 405 |
| 403 // Note: This should remain the last member so it'll be destroyed and | 406 // Note: This should remain the last member so it'll be destroyed and |
| 404 // invalidate its weak pointers before any other members are destroyed. | 407 // invalidate its weak pointers before any other members are destroyed. |
| 405 base::WeakPtrFactory<JobScheduler> weak_ptr_factory_; | 408 base::WeakPtrFactory<JobScheduler> weak_ptr_factory_; |
| 406 DISALLOW_COPY_AND_ASSIGN(JobScheduler); | 409 DISALLOW_COPY_AND_ASSIGN(JobScheduler); |
| 407 }; | 410 }; |
| 408 | 411 |
| 409 } // namespace drive | 412 } // namespace drive |
| 410 | 413 |
| 411 #endif // COMPONENTS_DRIVE_JOB_SCHEDULER_H_ | 414 #endif // COMPONENTS_DRIVE_JOB_SCHEDULER_H_ |
| OLD | NEW |