| 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 static ExtensionWebRequestEventRouter* GetInstance(); | 127 static ExtensionWebRequestEventRouter* GetInstance(); |
| 128 | 128 |
| 129 // Dispatches the OnBeforeRequest event to any extensions whose filters match | 129 // Dispatches the OnBeforeRequest event to any extensions whose filters match |
| 130 // the given request. Returns net::ERR_IO_PENDING if an extension is | 130 // the given request. Returns net::ERR_IO_PENDING if an extension is |
| 131 // intercepting the request, OK otherwise. | 131 // intercepting the request, OK otherwise. |
| 132 int OnBeforeRequest(void* profile, | 132 int OnBeforeRequest(void* profile, |
| 133 ExtensionInfoMap* extension_info_map, | 133 ExtensionInfoMap* extension_info_map, |
| 134 net::URLRequest* request, | 134 net::URLRequest* request, |
| 135 net::OldCompletionCallback* callback, | 135 const net::CompletionCallback& callback, |
| 136 GURL* new_url); | 136 GURL* new_url); |
| 137 | 137 |
| 138 // Dispatches the onBeforeSendHeaders event. This is fired for HTTP(s) | 138 // Dispatches the onBeforeSendHeaders event. This is fired for HTTP(s) |
| 139 // requests only, and allows modification of the outgoing request headers. | 139 // requests only, and allows modification of the outgoing request headers. |
| 140 // Returns net::ERR_IO_PENDING if an extension is intercepting the request, OK | 140 // Returns net::ERR_IO_PENDING if an extension is intercepting the request, OK |
| 141 // otherwise. | 141 // otherwise. |
| 142 int OnBeforeSendHeaders(void* profile, | 142 int OnBeforeSendHeaders(void* profile, |
| 143 ExtensionInfoMap* extension_info_map, | 143 ExtensionInfoMap* extension_info_map, |
| 144 net::URLRequest* request, | 144 net::URLRequest* request, |
| 145 net::OldCompletionCallback* callback, | 145 const net::CompletionCallback& callback, |
| 146 net::HttpRequestHeaders* headers); | 146 net::HttpRequestHeaders* headers); |
| 147 | 147 |
| 148 // Dispatches the onSendHeaders event. This is fired for HTTP(s) requests | 148 // Dispatches the onSendHeaders event. This is fired for HTTP(s) requests |
| 149 // only. | 149 // only. |
| 150 void OnSendHeaders(void* profile, | 150 void OnSendHeaders(void* profile, |
| 151 ExtensionInfoMap* extension_info_map, | 151 ExtensionInfoMap* extension_info_map, |
| 152 net::URLRequest* request, | 152 net::URLRequest* request, |
| 153 const net::HttpRequestHeaders& headers); | 153 const net::HttpRequestHeaders& headers); |
| 154 | 154 |
| 155 // Dispatches the onHeadersReceived event. This is fired for HTTP(s) | 155 // Dispatches the onHeadersReceived event. This is fired for HTTP(s) |
| 156 // requests only, and allows modification of incoming response headers. | 156 // requests only, and allows modification of incoming response headers. |
| 157 // Returns net::ERR_IO_PENDING if an extension is intercepting the request, | 157 // Returns net::ERR_IO_PENDING if an extension is intercepting the request, |
| 158 // OK otherwise. |original_response_headers| is reference counted. |callback| | 158 // OK otherwise. |original_response_headers| is reference counted. |callback| |
| 159 // and |override_response_headers| are owned by a URLRequestJob. They are | 159 // and |override_response_headers| are owned by a URLRequestJob. They are |
| 160 // guaranteed to be valid until |callback| is called or OnURLRequestDestroyed | 160 // guaranteed to be valid until |callback| is called or OnURLRequestDestroyed |
| 161 // is called (whatever comes first). | 161 // is called (whatever comes first). |
| 162 // Do not modify |original_response_headers| directly but write new ones | 162 // Do not modify |original_response_headers| directly but write new ones |
| 163 // into |override_response_headers|. | 163 // into |override_response_headers|. |
| 164 int OnHeadersReceived( | 164 int OnHeadersReceived( |
| 165 void* profile, | 165 void* profile, |
| 166 ExtensionInfoMap* extension_info_map, | 166 ExtensionInfoMap* extension_info_map, |
| 167 net::URLRequest* request, | 167 net::URLRequest* request, |
| 168 net::OldCompletionCallback* callback, | 168 const net::CompletionCallback& callback, |
| 169 net::HttpResponseHeaders* original_response_headers, | 169 net::HttpResponseHeaders* original_response_headers, |
| 170 scoped_refptr<net::HttpResponseHeaders>* override_response_headers); | 170 scoped_refptr<net::HttpResponseHeaders>* override_response_headers); |
| 171 | 171 |
| 172 // Dispatches the OnAuthRequired event to any extensions whose filters match | 172 // Dispatches the OnAuthRequired event to any extensions whose filters match |
| 173 // the given request. If the listener is not registered as "blocking", then | 173 // the given request. If the listener is not registered as "blocking", then |
| 174 // AUTH_REQUIRED_RESPONSE_OK is returned. Otherwise, | 174 // AUTH_REQUIRED_RESPONSE_OK is returned. Otherwise, |
| 175 // AUTH_REQUIRED_RESPONSE_IO_PENDING is returned and |callback| will be | 175 // AUTH_REQUIRED_RESPONSE_IO_PENDING is returned and |callback| will be |
| 176 // invoked later. | 176 // invoked later. |
| 177 net::NetworkDelegate::AuthRequiredResponse OnAuthRequired( | 177 net::NetworkDelegate::AuthRequiredResponse OnAuthRequired( |
| 178 void* profile, | 178 void* profile, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 // function. | 368 // function. |
| 369 virtual void OnQuotaExceeded() OVERRIDE; | 369 virtual void OnQuotaExceeded() OVERRIDE; |
| 370 }; | 370 }; |
| 371 | 371 |
| 372 // Send updates to |host| with information about what webRequest-related | 372 // Send updates to |host| with information about what webRequest-related |
| 373 // extensions are installed. | 373 // extensions are installed. |
| 374 // TODO(mpcomplete): remove. http://crbug.com/100411 | 374 // TODO(mpcomplete): remove. http://crbug.com/100411 |
| 375 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); | 375 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); |
| 376 | 376 |
| 377 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ | 377 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ |
| OLD | NEW |