| 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_URL_REQUEST_URL_FETCHER_CORE_H_ | 5 #ifndef NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
| 6 #define NET_URL_REQUEST_URL_FETCHER_CORE_H_ | 6 #define NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // back-off when servers are having problems treat the current request as | 115 // back-off when servers are having problems treat the current request as |
| 116 // a failure. Your call to this method will be ignored if your request is | 116 // a failure. Your call to this method will be ignored if your request is |
| 117 // already considered a failure based on the HTTP response code or response | 117 // already considered a failure based on the HTTP response code or response |
| 118 // headers. | 118 // headers. |
| 119 void ReceivedContentWasMalformed(); | 119 void ReceivedContentWasMalformed(); |
| 120 bool GetResponseAsString(std::string* out_response_string) const; | 120 bool GetResponseAsString(std::string* out_response_string) const; |
| 121 bool GetResponseAsFilePath(bool take_ownership, | 121 bool GetResponseAsFilePath(bool take_ownership, |
| 122 base::FilePath* out_response_path); | 122 base::FilePath* out_response_path); |
| 123 | 123 |
| 124 // Overridden from URLRequest::Delegate: | 124 // Overridden from URLRequest::Delegate: |
| 125 virtual void OnReceivedRedirect(URLRequest* request, | 125 void OnReceivedRedirect(URLRequest* request, |
| 126 const RedirectInfo& redirect_info, | 126 const RedirectInfo& redirect_info, |
| 127 bool* defer_redirect) override; | 127 bool* defer_redirect) override; |
| 128 virtual void OnResponseStarted(URLRequest* request) override; | 128 void OnResponseStarted(URLRequest* request) override; |
| 129 virtual void OnReadCompleted(URLRequest* request, | 129 void OnReadCompleted(URLRequest* request, int bytes_read) override; |
| 130 int bytes_read) override; | 130 void OnCertificateRequested(URLRequest* request, |
| 131 virtual void OnCertificateRequested( | 131 SSLCertRequestInfo* cert_request_info) override; |
| 132 URLRequest* request, | |
| 133 SSLCertRequestInfo* cert_request_info) override; | |
| 134 | 132 |
| 135 URLFetcherDelegate* delegate() const { return delegate_; } | 133 URLFetcherDelegate* delegate() const { return delegate_; } |
| 136 static void CancelAll(); | 134 static void CancelAll(); |
| 137 static int GetNumFetcherCores(); | 135 static int GetNumFetcherCores(); |
| 138 static void SetEnableInterceptionForTests(bool enabled); | 136 static void SetEnableInterceptionForTests(bool enabled); |
| 139 static void SetIgnoreCertificateRequests(bool ignored); | 137 static void SetIgnoreCertificateRequests(bool ignored); |
| 140 | 138 |
| 141 private: | 139 private: |
| 142 friend class base::RefCountedThreadSafe<URLFetcherCore>; | 140 friend class base::RefCountedThreadSafe<URLFetcherCore>; |
| 143 | 141 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 154 int size() const { | 152 int size() const { |
| 155 return fetchers_.size(); | 153 return fetchers_.size(); |
| 156 } | 154 } |
| 157 | 155 |
| 158 private: | 156 private: |
| 159 std::set<URLFetcherCore*> fetchers_; | 157 std::set<URLFetcherCore*> fetchers_; |
| 160 | 158 |
| 161 DISALLOW_COPY_AND_ASSIGN(Registry); | 159 DISALLOW_COPY_AND_ASSIGN(Registry); |
| 162 }; | 160 }; |
| 163 | 161 |
| 164 virtual ~URLFetcherCore(); | 162 ~URLFetcherCore() override; |
| 165 | 163 |
| 166 // Wrapper functions that allow us to ensure actions happen on the right | 164 // Wrapper functions that allow us to ensure actions happen on the right |
| 167 // thread. | 165 // thread. |
| 168 void StartOnIOThread(); | 166 void StartOnIOThread(); |
| 169 void StartURLRequest(); | 167 void StartURLRequest(); |
| 170 void DidInitializeWriter(int result); | 168 void DidInitializeWriter(int result); |
| 171 void StartURLRequestWhenAppropriate(); | 169 void StartURLRequestWhenAppropriate(); |
| 172 void CancelURLRequest(int error); | 170 void CancelURLRequest(int error); |
| 173 void OnCompletedURLRequest(base::TimeDelta backoff_delay); | 171 void OnCompletedURLRequest(base::TimeDelta backoff_delay); |
| 174 void InformDelegateFetchIsComplete(); | 172 void InformDelegateFetchIsComplete(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 base::debug::StackTrace stack_trace_; | 314 base::debug::StackTrace stack_trace_; |
| 317 | 315 |
| 318 static base::LazyInstance<Registry> g_registry; | 316 static base::LazyInstance<Registry> g_registry; |
| 319 | 317 |
| 320 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); | 318 DISALLOW_COPY_AND_ASSIGN(URLFetcherCore); |
| 321 }; | 319 }; |
| 322 | 320 |
| 323 } // namespace net | 321 } // namespace net |
| 324 | 322 |
| 325 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ | 323 #endif // NET_URL_REQUEST_URL_FETCHER_CORE_H_ |
| OLD | NEW |