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 "net/test/url_request/url_request_slow_download_job.h" | 5 #include "net/test/url_request/url_request_slow_download_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 base::ThreadTaskRunnerHandle::Get()->PostTask( | 65 base::ThreadTaskRunnerHandle::Get()->PostTask( |
66 FROM_HERE, base::Bind(&URLRequestSlowDownloadJob::StartAsync, | 66 FROM_HERE, base::Bind(&URLRequestSlowDownloadJob::StartAsync, |
67 weak_factory_.GetWeakPtr())); | 67 weak_factory_.GetWeakPtr())); |
68 } | 68 } |
69 | 69 |
70 // static | 70 // static |
71 void URLRequestSlowDownloadJob::AddUrlHandler() { | 71 void URLRequestSlowDownloadJob::AddUrlHandler() { |
72 URLRequestFilter* filter = URLRequestFilter::GetInstance(); | 72 URLRequestFilter* filter = URLRequestFilter::GetInstance(); |
73 filter->AddUrlInterceptor( | 73 filter->AddUrlInterceptor( |
74 GURL(kUnknownSizeUrl), | 74 GURL(kUnknownSizeUrl), |
75 scoped_ptr<URLRequestInterceptor>(new Interceptor())); | 75 std::unique_ptr<URLRequestInterceptor>(new Interceptor())); |
76 filter->AddUrlInterceptor( | 76 filter->AddUrlInterceptor( |
77 GURL(kKnownSizeUrl), | 77 GURL(kKnownSizeUrl), |
78 scoped_ptr<URLRequestInterceptor>(new Interceptor())); | 78 std::unique_ptr<URLRequestInterceptor>(new Interceptor())); |
79 filter->AddUrlInterceptor( | 79 filter->AddUrlInterceptor( |
80 GURL(kFinishDownloadUrl), | 80 GURL(kFinishDownloadUrl), |
81 scoped_ptr<URLRequestInterceptor>(new Interceptor())); | 81 std::unique_ptr<URLRequestInterceptor>(new Interceptor())); |
82 filter->AddUrlInterceptor( | 82 filter->AddUrlInterceptor( |
83 GURL(kErrorDownloadUrl), | 83 GURL(kErrorDownloadUrl), |
84 scoped_ptr<URLRequestInterceptor>(new Interceptor())); | 84 std::unique_ptr<URLRequestInterceptor>(new Interceptor())); |
85 } | 85 } |
86 | 86 |
87 // static | 87 // static |
88 size_t URLRequestSlowDownloadJob::NumberOutstandingRequests() { | 88 size_t URLRequestSlowDownloadJob::NumberOutstandingRequests() { |
89 return pending_requests_.Get().size(); | 89 return pending_requests_.Get().size(); |
90 } | 90 } |
91 | 91 |
92 // static | 92 // static |
93 void URLRequestSlowDownloadJob::FinishPendingRequests() { | 93 void URLRequestSlowDownloadJob::FinishPendingRequests() { |
94 typedef std::set<URLRequestSlowDownloadJob*> JobList; | 94 typedef std::set<URLRequestSlowDownloadJob*> JobList; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 info->headers = new HttpResponseHeaders(raw_headers); | 272 info->headers = new HttpResponseHeaders(raw_headers); |
273 } | 273 } |
274 | 274 |
275 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) const { | 275 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) const { |
276 HttpResponseInfo info; | 276 HttpResponseInfo info; |
277 GetResponseInfoConst(&info); | 277 GetResponseInfoConst(&info); |
278 return info.headers.get() && info.headers->GetMimeType(mime_type); | 278 return info.headers.get() && info.headers->GetMimeType(mime_type); |
279 } | 279 } |
280 | 280 |
281 } // namespace net | 281 } // namespace net |
OLD | NEW |