| 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 CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 BooleanPrefMember* force_safe_search, | 141 BooleanPrefMember* force_safe_search, |
| 142 BooleanPrefMember* force_google_safe_search, | 142 BooleanPrefMember* force_google_safe_search, |
| 143 BooleanPrefMember* force_youtube_safety_mode, | 143 BooleanPrefMember* force_youtube_safety_mode, |
| 144 PrefService* pref_service); | 144 PrefService* pref_service); |
| 145 | 145 |
| 146 // When called, all file:// URLs will now be accessible. If this is not | 146 // When called, all file:// URLs will now be accessible. If this is not |
| 147 // called, then some platforms restrict access to file:// paths. | 147 // called, then some platforms restrict access to file:// paths. |
| 148 static void AllowAccessToAllFiles(); | 148 static void AllowAccessToAllFiles(); |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 friend class ChromeNetworkDelegateTest; | 151 friend class ChromeNetworkDelegateThrottlingTest; |
| 152 | 152 |
| 153 // NetworkDelegate implementation. | 153 // NetworkDelegate implementation. |
| 154 int OnBeforeURLRequest(net::URLRequest* request, | 154 int OnBeforeURLRequest(net::URLRequest* request, |
| 155 const net::CompletionCallback& callback, | 155 const net::CompletionCallback& callback, |
| 156 GURL* new_url) override; | 156 GURL* new_url) override; |
| 157 int OnBeforeSendHeaders(net::URLRequest* request, | 157 int OnBeforeSendHeaders(net::URLRequest* request, |
| 158 const net::CompletionCallback& callback, | 158 const net::CompletionCallback& callback, |
| 159 net::HttpRequestHeaders* headers) override; | 159 net::HttpRequestHeaders* headers) override; |
| 160 void OnSendHeaders(net::URLRequest* request, | 160 void OnSendHeaders(net::URLRequest* request, |
| 161 const net::HttpRequestHeaders& headers) override; | 161 const net::HttpRequestHeaders& headers) override; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 181 const net::CookieList& cookie_list) override; | 181 const net::CookieList& cookie_list) override; |
| 182 bool OnCanSetCookie(const net::URLRequest& request, | 182 bool OnCanSetCookie(const net::URLRequest& request, |
| 183 const std::string& cookie_line, | 183 const std::string& cookie_line, |
| 184 net::CookieOptions* options) override; | 184 net::CookieOptions* options) override; |
| 185 bool OnCanAccessFile(const net::URLRequest& request, | 185 bool OnCanAccessFile(const net::URLRequest& request, |
| 186 const base::FilePath& path) const override; | 186 const base::FilePath& path) const override; |
| 187 bool OnCanThrottleRequest(const net::URLRequest& request) const override; | 187 bool OnCanThrottleRequest(const net::URLRequest& request) const override; |
| 188 bool OnCanEnablePrivacyMode( | 188 bool OnCanEnablePrivacyMode( |
| 189 const GURL& url, | 189 const GURL& url, |
| 190 const GURL& first_party_for_cookies) const override; | 190 const GURL& first_party_for_cookies) const override; |
| 191 bool OnFirstPartyOnlyCookieExperimentEnabled() const override; |
| 191 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 192 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 192 const net::URLRequest& request, | 193 const net::URLRequest& request, |
| 193 const GURL& target_url, | 194 const GURL& target_url, |
| 194 const GURL& referrer_url) const override; | 195 const GURL& referrer_url) const override; |
| 195 | 196 |
| 196 void AccumulateContentLength( | 197 void AccumulateContentLength( |
| 197 int64 received_payload_byte_count, | 198 int64 received_payload_byte_count, |
| 198 int64 original_payload_byte_count); | 199 int64 original_payload_byte_count); |
| 199 | 200 |
| 200 scoped_ptr<ChromeExtensionsNetworkDelegate> extensions_delegate_; | 201 scoped_ptr<ChromeExtensionsNetworkDelegate> extensions_delegate_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 223 | 224 |
| 224 // True if OnCanThrottleRequest should always return false. | 225 // True if OnCanThrottleRequest should always return false. |
| 225 // | 226 // |
| 226 // Note: This needs to be static as the instance of | 227 // Note: This needs to be static as the instance of |
| 227 // ChromeNetworkDelegate used may change over time, and we need to | 228 // ChromeNetworkDelegate used may change over time, and we need to |
| 228 // set this variable once at start-up time. It is effectively | 229 // set this variable once at start-up time. It is effectively |
| 229 // static anyway since it is based on a command-line flag. | 230 // static anyway since it is based on a command-line flag. |
| 230 static bool g_never_throttle_requests_; | 231 static bool g_never_throttle_requests_; |
| 231 | 232 |
| 232 scoped_ptr<ClientHints> client_hints_; | 233 scoped_ptr<ClientHints> client_hints_; |
| 234 bool experimental_web_platform_features_enabled_; |
| 233 | 235 |
| 234 bool first_request_; | 236 bool first_request_; |
| 235 | 237 |
| 236 prerender::PrerenderTracker* prerender_tracker_; | 238 prerender::PrerenderTracker* prerender_tracker_; |
| 237 | 239 |
| 238 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 240 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
| 239 }; | 241 }; |
| 240 | 242 |
| 241 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 243 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| OLD | NEW |