| 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 #ifndef NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ | 5 #ifndef NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ |
| 6 #define NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ | 6 #define NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 virtual ~ProxyScriptFetcherImpl(); | 39 virtual ~ProxyScriptFetcherImpl(); |
| 40 | 40 |
| 41 // Used by unit-tests to modify the default limits. | 41 // Used by unit-tests to modify the default limits. |
| 42 base::TimeDelta SetTimeoutConstraint(base::TimeDelta timeout); | 42 base::TimeDelta SetTimeoutConstraint(base::TimeDelta timeout); |
| 43 size_t SetSizeConstraint(size_t size_bytes); | 43 size_t SetSizeConstraint(size_t size_bytes); |
| 44 | 44 |
| 45 void OnResponseCompleted(URLRequest* request); | 45 void OnResponseCompleted(URLRequest* request); |
| 46 | 46 |
| 47 // ProxyScriptFetcher methods: | 47 // ProxyScriptFetcher methods: |
| 48 virtual int Fetch(const GURL& url, base::string16* text, | 48 virtual int Fetch(const GURL& url, base::string16* text, |
| 49 const net::CompletionCallback& callback) OVERRIDE; | 49 const net::CompletionCallback& callback) override; |
| 50 virtual void Cancel() OVERRIDE; | 50 virtual void Cancel() override; |
| 51 virtual URLRequestContext* GetRequestContext() const OVERRIDE; | 51 virtual URLRequestContext* GetRequestContext() const override; |
| 52 | 52 |
| 53 // URLRequest::Delegate methods: | 53 // URLRequest::Delegate methods: |
| 54 virtual void OnAuthRequired(URLRequest* request, | 54 virtual void OnAuthRequired(URLRequest* request, |
| 55 AuthChallengeInfo* auth_info) OVERRIDE; | 55 AuthChallengeInfo* auth_info) override; |
| 56 virtual void OnSSLCertificateError(URLRequest* request, | 56 virtual void OnSSLCertificateError(URLRequest* request, |
| 57 const SSLInfo& ssl_info, | 57 const SSLInfo& ssl_info, |
| 58 bool is_hsts_ok) OVERRIDE; | 58 bool is_hsts_ok) override; |
| 59 virtual void OnResponseStarted(URLRequest* request) OVERRIDE; | 59 virtual void OnResponseStarted(URLRequest* request) override; |
| 60 virtual void OnReadCompleted(URLRequest* request, int num_bytes) OVERRIDE; | 60 virtual void OnReadCompleted(URLRequest* request, int num_bytes) override; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 enum { kBufSize = 4096 }; | 63 enum { kBufSize = 4096 }; |
| 64 | 64 |
| 65 // Read more bytes from the response. | 65 // Read more bytes from the response. |
| 66 void ReadBody(URLRequest* request); | 66 void ReadBody(URLRequest* request); |
| 67 | 67 |
| 68 // Handles a response from Read(). Returns true if we should continue trying | 68 // Handles a response from Read(). Returns true if we should continue trying |
| 69 // to read. |num_bytes| is 0 for EOF, and < 0 on errors. | 69 // to read. |num_bytes| is 0 for EOF, and < 0 on errors. |
| 70 bool ConsumeBytesRead(URLRequest* request, int num_bytes); | 70 bool ConsumeBytesRead(URLRequest* request, int num_bytes); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // Factory for creating the time-out task. This takes care of revoking | 118 // Factory for creating the time-out task. This takes care of revoking |
| 119 // outstanding tasks when |this| is deleted. | 119 // outstanding tasks when |this| is deleted. |
| 120 base::WeakPtrFactory<ProxyScriptFetcherImpl> weak_factory_; | 120 base::WeakPtrFactory<ProxyScriptFetcherImpl> weak_factory_; |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(ProxyScriptFetcherImpl); | 122 DISALLOW_COPY_AND_ASSIGN(ProxyScriptFetcherImpl); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 } // namespace net | 125 } // namespace net |
| 126 | 126 |
| 127 #endif // NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ | 127 #endif // NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ |
| OLD | NEW |