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 #include "google_apis/drive/request_sender.h" | 5 #include "google_apis/drive/request_sender.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "google_apis/drive/auth_service.h" | 10 #include "google_apis/drive/auth_service.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 custom_user_agent_, | 55 custom_user_agent_, |
56 base::Bind(&RequestSender::RetryRequest, | 56 base::Bind(&RequestSender::RetryRequest, |
57 weak_ptr_factory_.GetWeakPtr())); | 57 weak_ptr_factory_.GetWeakPtr())); |
58 } | 58 } |
59 | 59 |
60 return cancel_closure; | 60 return cancel_closure; |
61 } | 61 } |
62 | 62 |
63 void RequestSender::OnAccessTokenFetched( | 63 void RequestSender::OnAccessTokenFetched( |
64 const base::WeakPtr<AuthenticatedRequestInterface>& request, | 64 const base::WeakPtr<AuthenticatedRequestInterface>& request, |
65 GDataErrorCode code, | 65 DriveApiErrorCode code, |
66 const std::string& /* access_token */) { | 66 const std::string& /* access_token */) { |
67 DCHECK(thread_checker_.CalledOnValidThread()); | 67 DCHECK(thread_checker_.CalledOnValidThread()); |
68 | 68 |
69 // Do nothing if the request is canceled during authentication. | 69 // Do nothing if the request is canceled during authentication. |
70 if (!request.get()) | 70 if (!request.get()) |
71 return; | 71 return; |
72 | 72 |
73 if (code == HTTP_SUCCESS) { | 73 if (code == HTTP_SUCCESS) { |
74 DCHECK(auth_service_->HasAccessToken()); | 74 DCHECK(auth_service_->HasAccessToken()); |
75 StartRequestWithRetry(request.get()); | 75 StartRequestWithRetry(request.get()); |
(...skipping 20 matching lines...) Expand all Loading... |
96 return; | 96 return; |
97 request->Cancel(); | 97 request->Cancel(); |
98 } | 98 } |
99 | 99 |
100 void RequestSender::RequestFinished(AuthenticatedRequestInterface* request) { | 100 void RequestSender::RequestFinished(AuthenticatedRequestInterface* request) { |
101 in_flight_requests_.erase(request); | 101 in_flight_requests_.erase(request); |
102 delete request; | 102 delete request; |
103 } | 103 } |
104 | 104 |
105 } // namespace google_apis | 105 } // namespace google_apis |
OLD | NEW |