| 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 #include "google_apis/drive/files_list_request_runner.h" | 5 #include "google_apis/drive/files_list_request_runner.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 DCHECK(!cancel_callback->is_null()); | 56 DCHECK(!cancel_callback->is_null()); |
| 57 cancel_callback->Run(); | 57 cancel_callback->Run(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void FilesListRequestRunner::OnCompleted(int max_results, | 60 void FilesListRequestRunner::OnCompleted(int max_results, |
| 61 const std::string& q, | 61 const std::string& q, |
| 62 const std::string& fields, | 62 const std::string& fields, |
| 63 const FileListCallback& callback, | 63 const FileListCallback& callback, |
| 64 CancelCallback* cancel_callback, | 64 CancelCallback* cancel_callback, |
| 65 DriveApiErrorCode error, | 65 DriveApiErrorCode error, |
| 66 scoped_ptr<FileList> entry) { | 66 std::unique_ptr<FileList> entry) { |
| 67 if (!request_completed_callback_for_testing_.is_null()) | 67 if (!request_completed_callback_for_testing_.is_null()) |
| 68 request_completed_callback_for_testing_.Run(); | 68 request_completed_callback_for_testing_.Run(); |
| 69 | 69 |
| 70 UMA_HISTOGRAM_SPARSE_SLOWLY( | 70 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 71 "Drive.FilesListRequestRunner.ApiErrorCode", error); | 71 "Drive.FilesListRequestRunner.ApiErrorCode", error); |
| 72 | 72 |
| 73 if (error == google_apis::DRIVE_RESPONSE_TOO_LARGE && max_results > 1) { | 73 if (error == google_apis::DRIVE_RESPONSE_TOO_LARGE && max_results > 1) { |
| 74 CreateAndStartWithSizeBackoff(max_results / 2, q, fields, callback); | 74 CreateAndStartWithSizeBackoff(max_results / 2, q, fields, callback); |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 | 77 |
| 78 callback.Run(error, std::move(entry)); | 78 callback.Run(error, std::move(entry)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void FilesListRequestRunner::SetRequestCompletedCallbackForTesting( | 81 void FilesListRequestRunner::SetRequestCompletedCallbackForTesting( |
| 82 const base::Closure& callback) { | 82 const base::Closure& callback) { |
| 83 request_completed_callback_for_testing_ = callback; | 83 request_completed_callback_for_testing_ = callback; |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace google_apis | 86 } // namespace google_apis |
| OLD | NEW |