OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/net/url_request_slow_download_job.h" | 5 #include "content/browser/net/url_request_slow_download_job.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
11 #include "base/string_util.h" | 12 #include "content/public/browser/browser_thread.h" |
12 #include "content/browser/browser_thread.h" | |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
15 #include "net/http/http_response_headers.h" | 15 #include "net/http/http_response_headers.h" |
16 #include "net/url_request/url_request.h" | 16 #include "net/url_request/url_request.h" |
17 #include "net/url_request/url_request_filter.h" | 17 #include "net/url_request/url_request_filter.h" |
18 | 18 |
19 const char URLRequestSlowDownloadJob::kUnknownSizeUrl[] = | 19 const char URLRequestSlowDownloadJob::kUnknownSizeUrl[] = |
20 "http://url.handled.by.slow.download/download-unknown-size"; | 20 "http://url.handled.by.slow.download/download-unknown-size"; |
21 const char URLRequestSlowDownloadJob::kKnownSizeUrl[] = | 21 const char URLRequestSlowDownloadJob::kKnownSizeUrl[] = |
22 "http://url.handled.by.slow.download/download-known-size"; | 22 "http://url.handled.by.slow.download/download-known-size"; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // ParseRawHeaders expects \0 to end each header line. | 185 // ParseRawHeaders expects \0 to end each header line. |
186 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); | 186 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); |
187 info->headers = new net::HttpResponseHeaders(raw_headers); | 187 info->headers = new net::HttpResponseHeaders(raw_headers); |
188 } | 188 } |
189 | 189 |
190 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) const { | 190 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) const { |
191 net::HttpResponseInfo info; | 191 net::HttpResponseInfo info; |
192 GetResponseInfoConst(&info); | 192 GetResponseInfoConst(&info); |
193 return info.headers && info.headers->GetMimeType(mime_type); | 193 return info.headers && info.headers->GetMimeType(mime_type); |
194 } | 194 } |
OLD | NEW |