| 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_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 class WebRequestInternalAddEventListenerFunction | 470 class WebRequestInternalAddEventListenerFunction |
| 471 : public SyncIOThreadExtensionFunction { | 471 : public SyncIOThreadExtensionFunction { |
| 472 public: | 472 public: |
| 473 DECLARE_EXTENSION_FUNCTION("webRequestInternal.addEventListener", | 473 DECLARE_EXTENSION_FUNCTION("webRequestInternal.addEventListener", |
| 474 WEBREQUESTINTERNAL_ADDEVENTLISTENER) | 474 WEBREQUESTINTERNAL_ADDEVENTLISTENER) |
| 475 | 475 |
| 476 protected: | 476 protected: |
| 477 virtual ~WebRequestInternalAddEventListenerFunction() {} | 477 virtual ~WebRequestInternalAddEventListenerFunction() {} |
| 478 | 478 |
| 479 // ExtensionFunction: | 479 // ExtensionFunction: |
| 480 virtual bool RunImpl() OVERRIDE; | 480 virtual bool RunSync() OVERRIDE; |
| 481 }; | 481 }; |
| 482 | 482 |
| 483 class WebRequestInternalEventHandledFunction | 483 class WebRequestInternalEventHandledFunction |
| 484 : public SyncIOThreadExtensionFunction { | 484 : public SyncIOThreadExtensionFunction { |
| 485 public: | 485 public: |
| 486 DECLARE_EXTENSION_FUNCTION("webRequestInternal.eventHandled", | 486 DECLARE_EXTENSION_FUNCTION("webRequestInternal.eventHandled", |
| 487 WEBREQUESTINTERNAL_EVENTHANDLED) | 487 WEBREQUESTINTERNAL_EVENTHANDLED) |
| 488 | 488 |
| 489 protected: | 489 protected: |
| 490 virtual ~WebRequestInternalEventHandledFunction() {} | 490 virtual ~WebRequestInternalEventHandledFunction() {} |
| 491 | 491 |
| 492 // Unblocks the network request and sets |error_| such that the developer | 492 // Unblocks the network request and sets |error_| such that the developer |
| 493 // console will show the respective error message. Use this function to handle | 493 // console will show the respective error message. Use this function to handle |
| 494 // incorrect requests from the extension that cannot be detected by the schema | 494 // incorrect requests from the extension that cannot be detected by the schema |
| 495 // validator. | 495 // validator. |
| 496 void RespondWithError( | 496 void RespondWithError( |
| 497 const std::string& event_name, | 497 const std::string& event_name, |
| 498 const std::string& sub_event_name, | 498 const std::string& sub_event_name, |
| 499 uint64 request_id, | 499 uint64 request_id, |
| 500 scoped_ptr<ExtensionWebRequestEventRouter::EventResponse> response, | 500 scoped_ptr<ExtensionWebRequestEventRouter::EventResponse> response, |
| 501 const std::string& error); | 501 const std::string& error); |
| 502 | 502 |
| 503 // ExtensionFunction: | 503 // ExtensionFunction: |
| 504 virtual bool RunImpl() OVERRIDE; | 504 virtual bool RunSync() OVERRIDE; |
| 505 }; | 505 }; |
| 506 | 506 |
| 507 class WebRequestHandlerBehaviorChangedFunction | 507 class WebRequestHandlerBehaviorChangedFunction |
| 508 : public SyncIOThreadExtensionFunction { | 508 : public SyncIOThreadExtensionFunction { |
| 509 public: | 509 public: |
| 510 DECLARE_EXTENSION_FUNCTION("webRequest.handlerBehaviorChanged", | 510 DECLARE_EXTENSION_FUNCTION("webRequest.handlerBehaviorChanged", |
| 511 WEBREQUEST_HANDLERBEHAVIORCHANGED) | 511 WEBREQUEST_HANDLERBEHAVIORCHANGED) |
| 512 | 512 |
| 513 protected: | 513 protected: |
| 514 virtual ~WebRequestHandlerBehaviorChangedFunction() {} | 514 virtual ~WebRequestHandlerBehaviorChangedFunction() {} |
| 515 | 515 |
| 516 // ExtensionFunction: | 516 // ExtensionFunction: |
| 517 virtual void GetQuotaLimitHeuristics( | 517 virtual void GetQuotaLimitHeuristics( |
| 518 extensions::QuotaLimitHeuristics* heuristics) const OVERRIDE; | 518 extensions::QuotaLimitHeuristics* heuristics) const OVERRIDE; |
| 519 // Handle quota exceeded gracefully: Only warn the user but still execute the | 519 // Handle quota exceeded gracefully: Only warn the user but still execute the |
| 520 // function. | 520 // function. |
| 521 virtual void OnQuotaExceeded(const std::string& error) OVERRIDE; | 521 virtual void OnQuotaExceeded(const std::string& error) OVERRIDE; |
| 522 virtual bool RunImpl() OVERRIDE; | 522 virtual bool RunSync() OVERRIDE; |
| 523 }; | 523 }; |
| 524 | 524 |
| 525 // Send updates to |host| with information about what webRequest-related | 525 // Send updates to |host| with information about what webRequest-related |
| 526 // extensions are installed. | 526 // extensions are installed. |
| 527 // TODO(mpcomplete): remove. http://crbug.com/100411 | 527 // TODO(mpcomplete): remove. http://crbug.com/100411 |
| 528 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); | 528 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); |
| 529 | 529 |
| 530 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 530 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
| OLD | NEW |