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 "chrome/browser/google_apis/request_sender.h" | 5 #include "chrome/browser/google_apis/request_sender.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/google_apis/auth_service.h" | 9 #include "chrome/browser/google_apis/auth_service.h" |
10 #include "chrome/browser/google_apis/base_requests.h" | 10 #include "chrome/browser/google_apis/base_requests.h" |
11 | 11 |
12 namespace google_apis { | 12 namespace google_apis { |
13 | 13 |
14 RequestSender::RequestSender( | 14 RequestSender::RequestSender( |
15 Profile* profile, | 15 Profile* profile, |
16 net::URLRequestContextGetter* url_request_context_getter, | 16 net::URLRequestContextGetter* url_request_context_getter, |
| 17 base::TaskRunner* blocking_task_runner, |
17 const std::vector<std::string>& scopes, | 18 const std::vector<std::string>& scopes, |
18 const std::string& custom_user_agent) | 19 const std::string& custom_user_agent) |
19 : profile_(profile), | 20 : profile_(profile), |
20 url_request_context_getter_(url_request_context_getter), | 21 url_request_context_getter_(url_request_context_getter), |
| 22 blocking_task_runner_(blocking_task_runner), |
21 auth_service_(new AuthService(url_request_context_getter, scopes)), | 23 auth_service_(new AuthService(url_request_context_getter, scopes)), |
22 custom_user_agent_(custom_user_agent), | 24 custom_user_agent_(custom_user_agent), |
23 weak_ptr_factory_(this) { | 25 weak_ptr_factory_(this) { |
24 DCHECK(thread_checker_.CalledOnValidThread()); | 26 DCHECK(thread_checker_.CalledOnValidThread()); |
25 } | 27 } |
26 | 28 |
27 RequestSender::~RequestSender() { | 29 RequestSender::~RequestSender() { |
28 DCHECK(thread_checker_.CalledOnValidThread()); | 30 DCHECK(thread_checker_.CalledOnValidThread()); |
29 STLDeleteContainerPointers(in_flight_requests_.begin(), | 31 STLDeleteContainerPointers(in_flight_requests_.begin(), |
30 in_flight_requests_.end()); | 32 in_flight_requests_.end()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return; | 102 return; |
101 request->Cancel(); | 103 request->Cancel(); |
102 } | 104 } |
103 | 105 |
104 void RequestSender::RequestFinished(AuthenticatedRequestInterface* request) { | 106 void RequestSender::RequestFinished(AuthenticatedRequestInterface* request) { |
105 in_flight_requests_.erase(request); | 107 in_flight_requests_.erase(request); |
106 delete request; | 108 delete request; |
107 } | 109 } |
108 | 110 |
109 } // namespace google_apis | 111 } // namespace google_apis |
OLD | NEW |