OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 GOOGLE_APIS_DRIVE_FILES_LIST_REQUEST_RUNNER_H_ | 5 #ifndef GOOGLE_APIS_DRIVE_FILES_LIST_REQUEST_RUNNER_H_ |
6 #define GOOGLE_APIS_DRIVE_FILES_LIST_REQUEST_RUNNER_H_ | 6 #define GOOGLE_APIS_DRIVE_FILES_LIST_REQUEST_RUNNER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 class FilesListRequestRunner { | 24 class FilesListRequestRunner { |
25 public: | 25 public: |
26 FilesListRequestRunner( | 26 FilesListRequestRunner( |
27 RequestSender* request_sender, | 27 RequestSender* request_sender, |
28 const google_apis::DriveApiUrlGenerator& url_generator); | 28 const google_apis::DriveApiUrlGenerator& url_generator); |
29 | 29 |
30 // Creates a FilesListRequest instance and starts the request with a backoff | 30 // Creates a FilesListRequest instance and starts the request with a backoff |
31 // retry in case of DRIVE_RESPONSE_TOO_LARGE error code. | 31 // retry in case of DRIVE_RESPONSE_TOO_LARGE error code. |
32 CancelCallback CreateAndStartWithSizeBackoff( | 32 CancelCallback CreateAndStartWithSizeBackoff( |
33 int max_results, | 33 int max_results, |
| 34 FilesListCorpora corpora, |
| 35 const std::string& team_drive_id, |
34 const std::string& q, | 36 const std::string& q, |
35 const std::string& fields, | 37 const std::string& fields, |
36 const FileListCallback& callback); | 38 const FileListCallback& callback); |
37 | 39 |
38 ~FilesListRequestRunner(); | 40 ~FilesListRequestRunner(); |
39 | 41 |
40 void SetRequestCompletedCallbackForTesting(const base::Closure& callback); | 42 void SetRequestCompletedCallbackForTesting(const base::Closure& callback); |
41 | 43 |
42 private: | 44 private: |
43 // Called when the cancelling callback returned by | 45 // Called when the cancelling callback returned by |
44 // CreateAndStartWithSizeBackoff is invoked. Once called cancels the current | 46 // CreateAndStartWithSizeBackoff is invoked. Once called cancels the current |
45 // request. | 47 // request. |
46 void OnCancel(CancelCallback* cancel_callback); | 48 void OnCancel(CancelCallback* cancel_callback); |
47 | 49 |
48 // Called when a single request is completed with either a success or an | 50 // Called when a single request is completed with either a success or an |
49 // error. In case of DRIVE_RESPONSE_TOO_LARGE it will retry the request with | 51 // error. In case of DRIVE_RESPONSE_TOO_LARGE it will retry the request with |
50 // half of the requests. | 52 // half of the requests. |
51 void OnCompleted(int max_results, | 53 void OnCompleted(int max_results, |
| 54 FilesListCorpora corpora, |
| 55 const std::string& team_drive_id, |
52 const std::string& q, | 56 const std::string& q, |
53 const std::string& fields, | 57 const std::string& fields, |
54 const FileListCallback& callback, | 58 const FileListCallback& callback, |
55 CancelCallback* cancel_callback, | 59 CancelCallback* cancel_callback, |
56 DriveApiErrorCode error, | 60 DriveApiErrorCode error, |
57 std::unique_ptr<FileList> entry); | 61 std::unique_ptr<FileList> entry); |
58 | 62 |
59 RequestSender* request_sender_; // Not owned. | 63 RequestSender* request_sender_; // Not owned. |
60 const google_apis::DriveApiUrlGenerator url_generator_; // Not owned. | 64 const google_apis::DriveApiUrlGenerator url_generator_; // Not owned. |
61 base::Closure request_completed_callback_for_testing_; | 65 base::Closure request_completed_callback_for_testing_; |
62 | 66 |
63 // Note: This should remain the last member so it'll be destroyed and | 67 // Note: This should remain the last member so it'll be destroyed and |
64 // invalidate its weak pointers before any other members are destroyed. | 68 // invalidate its weak pointers before any other members are destroyed. |
65 base::WeakPtrFactory<FilesListRequestRunner> weak_ptr_factory_; | 69 base::WeakPtrFactory<FilesListRequestRunner> weak_ptr_factory_; |
66 DISALLOW_COPY_AND_ASSIGN(FilesListRequestRunner); | 70 DISALLOW_COPY_AND_ASSIGN(FilesListRequestRunner); |
67 }; | 71 }; |
68 | 72 |
69 } // namespace google_apis | 73 } // namespace google_apis |
70 | 74 |
71 #endif // GOOGLE_APIS_DRIVE_FILES_LIST_REQUEST_RUNNER_H_ | 75 #endif // GOOGLE_APIS_DRIVE_FILES_LIST_REQUEST_RUNNER_H_ |
OLD | NEW |