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 <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 uint64 request_id, | 203 uint64 request_id, |
204 EventResponse* response); | 204 EventResponse* response); |
205 | 205 |
206 // Adds a listener to the given event. |event_name| specifies the event being | 206 // Adds a listener to the given event. |event_name| specifies the event being |
207 // listened to. |sub_event_name| is an internal event uniquely generated in | 207 // listened to. |sub_event_name| is an internal event uniquely generated in |
208 // the extension process to correspond to the given filter and | 208 // the extension process to correspond to the given filter and |
209 // extra_info_spec. | 209 // extra_info_spec. |
210 void AddEventListener( | 210 void AddEventListener( |
211 void* profile, | 211 void* profile, |
212 const std::string& extension_id, | 212 const std::string& extension_id, |
| 213 const std::string& extension_name, |
213 const std::string& event_name, | 214 const std::string& event_name, |
214 const std::string& sub_event_name, | 215 const std::string& sub_event_name, |
215 const RequestFilter& filter, | 216 const RequestFilter& filter, |
216 int extra_info_spec, | 217 int extra_info_spec, |
217 base::WeakPtr<IPC::Message::Sender> ipc_sender); | 218 base::WeakPtr<IPC::Message::Sender> ipc_sender); |
218 | 219 |
219 // Removes the listener for the given sub-event. | 220 // Removes the listener for the given sub-event. |
220 void RemoveEventListener( | 221 void RemoveEventListener( |
221 void* profile, | 222 void* profile, |
222 const std::string& extension_id, | 223 const std::string& extension_id, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 ResourceType::Type resource_type, | 284 ResourceType::Type resource_type, |
284 int* extra_info_spec, | 285 int* extra_info_spec, |
285 std::vector<const ExtensionWebRequestEventRouter::EventListener*>* | 286 std::vector<const ExtensionWebRequestEventRouter::EventListener*>* |
286 matching_listeners); | 287 matching_listeners); |
287 | 288 |
288 // Decrements the count of event handlers blocking the given request. When the | 289 // Decrements the count of event handlers blocking the given request. When the |
289 // count reaches 0, we stop blocking the request and proceed it using the | 290 // count reaches 0, we stop blocking the request and proceed it using the |
290 // method requested by the extension with the highest precedence. Precedence | 291 // method requested by the extension with the highest precedence. Precedence |
291 // is decided by extension install time. If |response| is non-NULL, this | 292 // is decided by extension install time. If |response| is non-NULL, this |
292 // method assumes ownership. | 293 // method assumes ownership. |
293 void DecrementBlockCount(uint64 request_id, EventResponse* response); | 294 void DecrementBlockCount( |
| 295 void* profile, |
| 296 const std::string& event_name, |
| 297 uint64 request_id, |
| 298 EventResponse* response); |
294 | 299 |
295 // Sets the flag that |event_type| has been signaled for |request_id|. | 300 // Sets the flag that |event_type| has been signaled for |request_id|. |
296 // Returns the value of the flag before setting it. | 301 // Returns the value of the flag before setting it. |
297 bool GetAndSetSignaled(uint64 request_id, EventTypes event_type); | 302 bool GetAndSetSignaled(uint64 request_id, EventTypes event_type); |
298 | 303 |
299 // Clears the flag that |event_type| has been signaled for |request_id|. | 304 // Clears the flag that |event_type| has been signaled for |request_id|. |
300 void ClearSignaled(uint64 request_id, EventTypes event_type); | 305 void ClearSignaled(uint64 request_id, EventTypes event_type); |
301 | 306 |
302 // Returns the difference between the original request properties stored | 307 // Returns the difference between the original request properties stored |
303 // in |blocked_request| and the EventResponse in |response|. | 308 // in |blocked_request| and the EventResponse in |response|. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.addEventListener"); | 350 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.addEventListener"); |
346 }; | 351 }; |
347 | 352 |
348 class WebRequestEventHandled : public SyncIOThreadExtensionFunction { | 353 class WebRequestEventHandled : public SyncIOThreadExtensionFunction { |
349 public: | 354 public: |
350 virtual bool RunImpl(); | 355 virtual bool RunImpl(); |
351 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.eventHandled"); | 356 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.eventHandled"); |
352 }; | 357 }; |
353 | 358 |
354 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ | 359 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ |
OLD | NEW |