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_BASE_NETWORK_DELEGATE_H_ | 5 #ifndef NET_BASE_NETWORK_DELEGATE_H_ |
6 #define NET_BASE_NETWORK_DELEGATE_H_ | 6 #define NET_BASE_NETWORK_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 const base::FilePath& path) const; | 102 const base::FilePath& path) const; |
103 bool CanThrottleRequest(const URLRequest& request) const; | 103 bool CanThrottleRequest(const URLRequest& request) const; |
104 bool CanEnablePrivacyMode(const GURL& url, | 104 bool CanEnablePrivacyMode(const GURL& url, |
105 const GURL& first_party_for_cookies) const; | 105 const GURL& first_party_for_cookies) const; |
106 | 106 |
107 bool CancelURLRequestWithPolicyViolatingReferrerHeader( | 107 bool CancelURLRequestWithPolicyViolatingReferrerHeader( |
108 const URLRequest& request, | 108 const URLRequest& request, |
109 const GURL& target_url, | 109 const GURL& target_url, |
110 const GURL& referrer_url) const; | 110 const GURL& referrer_url) const; |
111 | 111 |
| 112 // If we get a response with GZIP encoding, we check if the response mime |
| 113 // type is one of the supported mime types. If it is supported, we will |
| 114 // decompress response to allow it to be displayed directly in browser, |
| 115 // otherwise we'll leave it compressed. |
| 116 bool IsSupportedMimeType(const std::string& mime_type) const; |
| 117 |
112 private: | 118 private: |
113 // This is the interface for subclasses of NetworkDelegate to implement. These | 119 // This is the interface for subclasses of NetworkDelegate to implement. These |
114 // member functions will be called by the respective public notification | 120 // member functions will be called by the respective public notification |
115 // member function, which will perform basic sanity checking. | 121 // member function, which will perform basic sanity checking. |
116 | 122 |
117 // Called before a request is sent. Allows the delegate to rewrite the URL | 123 // Called before a request is sent. Allows the delegate to rewrite the URL |
118 // being fetched by modifying |new_url|. If set, the URL must be valid. The | 124 // being fetched by modifying |new_url|. If set, the URL must be valid. The |
119 // reference fragment from the original URL is not automatically appended to | 125 // reference fragment from the original URL is not automatically appended to |
120 // |new_url|; callers are responsible for copying the reference fragment if | 126 // |new_url|; callers are responsible for copying the reference fragment if |
121 // desired. | 127 // desired. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 274 |
269 // Called when the |referrer_url| for requesting |target_url| during handling | 275 // Called when the |referrer_url| for requesting |target_url| during handling |
270 // of the |request| is does not comply with the referrer policy (e.g. a | 276 // of the |request| is does not comply with the referrer policy (e.g. a |
271 // secure referrer for an insecure initial target). | 277 // secure referrer for an insecure initial target). |
272 // Returns true if the request should be cancelled. Otherwise, the referrer | 278 // Returns true if the request should be cancelled. Otherwise, the referrer |
273 // header is stripped from the request. | 279 // header is stripped from the request. |
274 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 280 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
275 const URLRequest& request, | 281 const URLRequest& request, |
276 const GURL& target_url, | 282 const GURL& target_url, |
277 const GURL& referrer_url) const = 0; | 283 const GURL& referrer_url) const = 0; |
| 284 |
| 285 virtual bool OnIsSupportedMimeType(const std::string& mime_type) const = 0; |
278 }; | 286 }; |
279 | 287 |
280 } // namespace net | 288 } // namespace net |
281 | 289 |
282 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 290 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |