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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 // specified request context. | 26 // specified request context. |
27 class ProxyScriptFetcherImpl : public ProxyScriptFetcher, | 27 class ProxyScriptFetcherImpl : public ProxyScriptFetcher, |
28 public net::URLRequest::Delegate { | 28 public net::URLRequest::Delegate { |
29 public: | 29 public: |
30 // Creates a ProxyScriptFetcher that issues requests through | 30 // Creates a ProxyScriptFetcher that issues requests through |
31 // |url_request_context|. |url_request_context| must remain valid for the | 31 // |url_request_context|. |url_request_context| must remain valid for the |
32 // lifetime of ProxyScriptFetcherImpl. | 32 // lifetime of ProxyScriptFetcherImpl. |
33 // Note that while a request is in progress, we will be holding a reference | 33 // Note that while a request is in progress, we will be holding a reference |
34 // to |url_request_context|. Be careful not to create cycles between the | 34 // to |url_request_context|. Be careful not to create cycles between the |
35 // fetcher and the context; you can break such cycles by calling Cancel(). | 35 // fetcher and the context; you can break such cycles by calling Cancel(). |
36 explicit ProxyScriptFetcherImpl(URLRequestContext* url_request_context); | 36 explicit ProxyScriptFetcherImpl(net::URLRequestContext* url_request_context); |
wtc
2011/01/15 17:54:23
Undo the changes to this file, because it's alread
| |
37 | 37 |
38 virtual ~ProxyScriptFetcherImpl(); | 38 virtual ~ProxyScriptFetcherImpl(); |
39 | 39 |
40 // ProxyScriptFetcher methods: | 40 // ProxyScriptFetcher methods: |
41 | 41 |
42 virtual int Fetch(const GURL& url, string16* text, | 42 virtual int Fetch(const GURL& url, string16* text, |
43 CompletionCallback* callback); | 43 CompletionCallback* callback); |
44 virtual void Cancel(); | 44 virtual void Cancel(); |
45 virtual URLRequestContext* GetRequestContext(); | 45 virtual net::URLRequestContext* GetRequestContext(); |
46 | 46 |
47 // net::URLRequest::Delegate methods: | 47 // net::URLRequest::Delegate methods: |
48 virtual void OnAuthRequired(net::URLRequest* request, | 48 virtual void OnAuthRequired(net::URLRequest* request, |
49 AuthChallengeInfo* auth_info); | 49 AuthChallengeInfo* auth_info); |
50 virtual void OnSSLCertificateError(net::URLRequest* request, int cert_error, | 50 virtual void OnSSLCertificateError(net::URLRequest* request, int cert_error, |
51 X509Certificate* cert); | 51 X509Certificate* cert); |
52 virtual void OnResponseStarted(net::URLRequest* request); | 52 virtual void OnResponseStarted(net::URLRequest* request); |
53 virtual void OnReadCompleted(net::URLRequest* request, int num_bytes); | 53 virtual void OnReadCompleted(net::URLRequest* request, int num_bytes); |
54 virtual void OnResponseCompleted(net::URLRequest* request); | 54 virtual void OnResponseCompleted(net::URLRequest* request); |
55 | 55 |
(...skipping 17 matching lines...) Expand all Loading... | |
73 void ResetCurRequestState(); | 73 void ResetCurRequestState(); |
74 | 74 |
75 // Callback for time-out task of request with id |id|. | 75 // Callback for time-out task of request with id |id|. |
76 void OnTimeout(int id); | 76 void OnTimeout(int id); |
77 | 77 |
78 // Factory for creating the time-out task. This takes care of revoking | 78 // Factory for creating the time-out task. This takes care of revoking |
79 // outstanding tasks when |this| is deleted. | 79 // outstanding tasks when |this| is deleted. |
80 ScopedRunnableMethodFactory<ProxyScriptFetcherImpl> task_factory_; | 80 ScopedRunnableMethodFactory<ProxyScriptFetcherImpl> task_factory_; |
81 | 81 |
82 // The context used for making network requests. | 82 // The context used for making network requests. |
83 URLRequestContext* url_request_context_; | 83 net::URLRequestContext* url_request_context_; |
84 | 84 |
85 // Buffer that net::URLRequest writes into. | 85 // Buffer that net::URLRequest writes into. |
86 enum { kBufSize = 4096 }; | 86 enum { kBufSize = 4096 }; |
87 scoped_refptr<net::IOBuffer> buf_; | 87 scoped_refptr<net::IOBuffer> buf_; |
88 | 88 |
89 // The next ID to use for |cur_request_| (monotonically increasing). | 89 // The next ID to use for |cur_request_| (monotonically increasing). |
90 int next_id_; | 90 int next_id_; |
91 | 91 |
92 // The current (in progress) request, or NULL. | 92 // The current (in progress) request, or NULL. |
93 scoped_ptr<net::URLRequest> cur_request_; | 93 scoped_ptr<net::URLRequest> cur_request_; |
(...skipping 21 matching lines...) Expand all Loading... | |
115 | 115 |
116 // The maximum amount of time to wait for download to complete. | 116 // The maximum amount of time to wait for download to complete. |
117 base::TimeDelta max_duration_; | 117 base::TimeDelta max_duration_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(ProxyScriptFetcherImpl); | 119 DISALLOW_COPY_AND_ASSIGN(ProxyScriptFetcherImpl); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace net | 122 } // namespace net |
123 | 123 |
124 #endif // NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ | 124 #endif // NET_PROXY_PROXY_SCRIPT_FETCHER_IMPL_H_ |
OLD | NEW |