| 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/proxy/proxy_script_fetcher_impl.h" | 5 #include "net/proxy/proxy_script_fetcher_impl.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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // Responses exceeding this will fail with ERR_TIMED_OUT. | 33 // Responses exceeding this will fail with ERR_TIMED_OUT. |
| 34 const int kDefaultMaxDurationMs = 300000; // 5 minutes | 34 const int kDefaultMaxDurationMs = 300000; // 5 minutes |
| 35 | 35 |
| 36 // Returns true if |mime_type| is one of the known PAC mime type. | 36 // Returns true if |mime_type| is one of the known PAC mime type. |
| 37 bool IsPacMimeType(const std::string& mime_type) { | 37 bool IsPacMimeType(const std::string& mime_type) { |
| 38 static const char * const kSupportedPacMimeTypes[] = { | 38 static const char * const kSupportedPacMimeTypes[] = { |
| 39 "application/x-ns-proxy-autoconfig", | 39 "application/x-ns-proxy-autoconfig", |
| 40 "application/x-javascript-config", | 40 "application/x-javascript-config", |
| 41 }; | 41 }; |
| 42 for (size_t i = 0; i < arraysize(kSupportedPacMimeTypes); ++i) { | 42 for (size_t i = 0; i < arraysize(kSupportedPacMimeTypes); ++i) { |
| 43 if (LowerCaseEqualsASCII(mime_type, kSupportedPacMimeTypes[i])) | 43 if (base::LowerCaseEqualsASCII(mime_type, kSupportedPacMimeTypes[i])) |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 return false; | 46 return false; |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Converts |bytes| (which is encoded by |charset|) to UTF16, saving the resul | 49 // Converts |bytes| (which is encoded by |charset|) to UTF16, saving the resul |
| 50 // to |*utf16|. | 50 // to |*utf16|. |
| 51 // If |charset| is empty, then we don't know what it was and guess. | 51 // If |charset| is empty, then we don't know what it was and guess. |
| 52 void ConvertResponseToUTF16(const std::string& charset, | 52 void ConvertResponseToUTF16(const std::string& charset, |
| 53 const std::string& bytes, | 53 const std::string& bytes, |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // is still applicable. | 311 // is still applicable. |
| 312 if (cur_request_id_ != id) | 312 if (cur_request_id_ != id) |
| 313 return; | 313 return; |
| 314 | 314 |
| 315 DCHECK(cur_request_.get()); | 315 DCHECK(cur_request_.get()); |
| 316 result_code_ = ERR_TIMED_OUT; | 316 result_code_ = ERR_TIMED_OUT; |
| 317 cur_request_->Cancel(); | 317 cur_request_->Cancel(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace net | 320 } // namespace net |
| OLD | NEW |