| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 uint64 request_id, | 211 uint64 request_id, |
| 212 EventResponse* response); | 212 EventResponse* response); |
| 213 | 213 |
| 214 // Adds a listener to the given event. |event_name| specifies the event being | 214 // Adds a listener to the given event. |event_name| specifies the event being |
| 215 // listened to. |sub_event_name| is an internal event uniquely generated in | 215 // listened to. |sub_event_name| is an internal event uniquely generated in |
| 216 // the extension process to correspond to the given filter and | 216 // the extension process to correspond to the given filter and |
| 217 // extra_info_spec. | 217 // extra_info_spec. |
| 218 void AddEventListener( | 218 void AddEventListener( |
| 219 void* profile, | 219 void* profile, |
| 220 const std::string& extension_id, | 220 const std::string& extension_id, |
| 221 const std::string& extension_name, |
| 221 const std::string& event_name, | 222 const std::string& event_name, |
| 222 const std::string& sub_event_name, | 223 const std::string& sub_event_name, |
| 223 const RequestFilter& filter, | 224 const RequestFilter& filter, |
| 224 int extra_info_spec, | 225 int extra_info_spec, |
| 225 base::WeakPtr<IPC::Message::Sender> ipc_sender); | 226 base::WeakPtr<IPC::Message::Sender> ipc_sender); |
| 226 | 227 |
| 227 // Removes the listener for the given sub-event. | 228 // Removes the listener for the given sub-event. |
| 228 void RemoveEventListener( | 229 void RemoveEventListener( |
| 229 void* profile, | 230 void* profile, |
| 230 const std::string& extension_id, | 231 const std::string& extension_id, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 ResourceType::Type resource_type, | 292 ResourceType::Type resource_type, |
| 292 int* extra_info_spec, | 293 int* extra_info_spec, |
| 293 std::vector<const ExtensionWebRequestEventRouter::EventListener*>* | 294 std::vector<const ExtensionWebRequestEventRouter::EventListener*>* |
| 294 matching_listeners); | 295 matching_listeners); |
| 295 | 296 |
| 296 // Decrements the count of event handlers blocking the given request. When the | 297 // Decrements the count of event handlers blocking the given request. When the |
| 297 // count reaches 0, we stop blocking the request and proceed it using the | 298 // count reaches 0, we stop blocking the request and proceed it using the |
| 298 // method requested by the extension with the highest precedence. Precedence | 299 // method requested by the extension with the highest precedence. Precedence |
| 299 // is decided by extension install time. If |response| is non-NULL, this | 300 // is decided by extension install time. If |response| is non-NULL, this |
| 300 // method assumes ownership. | 301 // method assumes ownership. |
| 301 void DecrementBlockCount(uint64 request_id, EventResponse* response); | 302 void DecrementBlockCount( |
| 303 void* profile, |
| 304 const std::string& event_name, |
| 305 uint64 request_id, |
| 306 EventResponse* response); |
| 302 | 307 |
| 303 // Sets the flag that |event_type| has been signaled for |request_id|. | 308 // Sets the flag that |event_type| has been signaled for |request_id|. |
| 304 // Returns the value of the flag before setting it. | 309 // Returns the value of the flag before setting it. |
| 305 bool GetAndSetSignaled(uint64 request_id, EventTypes event_type); | 310 bool GetAndSetSignaled(uint64 request_id, EventTypes event_type); |
| 306 | 311 |
| 307 // Clears the flag that |event_type| has been signaled for |request_id|. | 312 // Clears the flag that |event_type| has been signaled for |request_id|. |
| 308 void ClearSignaled(uint64 request_id, EventTypes event_type); | 313 void ClearSignaled(uint64 request_id, EventTypes event_type); |
| 309 | 314 |
| 310 // Returns the difference between the original request properties stored | 315 // Returns the difference between the original request properties stored |
| 311 // in |blocked_request| and the EventResponse in |response|. | 316 // in |blocked_request| and the EventResponse in |response|. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.addEventListener"); | 358 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.addEventListener"); |
| 354 }; | 359 }; |
| 355 | 360 |
| 356 class WebRequestEventHandled : public SyncIOThreadExtensionFunction { | 361 class WebRequestEventHandled : public SyncIOThreadExtensionFunction { |
| 357 public: | 362 public: |
| 358 virtual bool RunImpl(); | 363 virtual bool RunImpl(); |
| 359 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.eventHandled"); | 364 DECLARE_EXTENSION_FUNCTION_NAME("experimental.webRequest.eventHandled"); |
| 360 }; | 365 }; |
| 361 | 366 |
| 362 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ | 367 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ |
| OLD | NEW |