OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/automation/url_request_slow_download_job.h" | 5 #include "chrome/browser/automation/url_request_slow_download_job.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "net/http/http_response_headers.h" |
10 #include "net/url_request/url_request.h" | 11 #include "net/url_request/url_request.h" |
11 #include "net/url_request/url_request_filter.h" | 12 #include "net/url_request/url_request_filter.h" |
12 | 13 |
13 const int kFirstDownloadSize = 1024 * 35; | 14 const int kFirstDownloadSize = 1024 * 35; |
14 const int kSecondDownloadSize = 1024 * 10; | 15 const int kSecondDownloadSize = 1024 * 10; |
15 | 16 |
16 const wchar_t URLRequestSlowDownloadJob::kUnknownSizeUrl[] = | 17 const wchar_t URLRequestSlowDownloadJob::kUnknownSizeUrl[] = |
17 L"http://url.handled.by.slow.download/download-unknown-size"; | 18 L"http://url.handled.by.slow.download/download-unknown-size"; |
18 const wchar_t URLRequestSlowDownloadJob::kKnownSizeUrl[] = | 19 const wchar_t URLRequestSlowDownloadJob::kKnownSizeUrl[] = |
19 L"http://url.handled.by.slow.download/download-known-size"; | 20 L"http://url.handled.by.slow.download/download-known-size"; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); | 155 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); |
155 info->headers = new net::HttpResponseHeaders(raw_headers); | 156 info->headers = new net::HttpResponseHeaders(raw_headers); |
156 } | 157 } |
157 | 158 |
158 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) { | 159 bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) { |
159 net::HttpResponseInfo info; | 160 net::HttpResponseInfo info; |
160 GetResponseInfo(&info); | 161 GetResponseInfo(&info); |
161 return info.headers && info.headers->GetMimeType(mime_type); | 162 return info.headers && info.headers->GetMimeType(mime_type); |
162 } | 163 } |
163 | 164 |
OLD | NEW |