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 EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
6 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 6 #define EXTENSIONS_BROWSER_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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 class WebRequestAPI : public BrowserContextKeyedAPI, | 62 class WebRequestAPI : public BrowserContextKeyedAPI, |
63 public EventRouter::Observer { | 63 public EventRouter::Observer { |
64 public: | 64 public: |
65 explicit WebRequestAPI(content::BrowserContext* context); | 65 explicit WebRequestAPI(content::BrowserContext* context); |
66 virtual ~WebRequestAPI(); | 66 virtual ~WebRequestAPI(); |
67 | 67 |
68 // BrowserContextKeyedAPI support: | 68 // BrowserContextKeyedAPI support: |
69 static BrowserContextKeyedAPIFactory<WebRequestAPI>* GetFactoryInstance(); | 69 static BrowserContextKeyedAPIFactory<WebRequestAPI>* GetFactoryInstance(); |
70 | 70 |
71 // EventRouter::Observer overrides: | 71 // EventRouter::Observer overrides: |
72 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; | 72 virtual void OnListenerRemoved(const EventListenerInfo& details) override; |
73 | 73 |
74 private: | 74 private: |
75 friend class BrowserContextKeyedAPIFactory<WebRequestAPI>; | 75 friend class BrowserContextKeyedAPIFactory<WebRequestAPI>; |
76 | 76 |
77 // BrowserContextKeyedAPI support: | 77 // BrowserContextKeyedAPI support: |
78 static const char* service_name() { return "WebRequestAPI"; } | 78 static const char* service_name() { return "WebRequestAPI"; } |
79 static const bool kServiceRedirectedInIncognito = true; | 79 static const bool kServiceRedirectedInIncognito = true; |
80 static const bool kServiceIsNULLWhileTesting = true; | 80 static const bool kServiceIsNULLWhileTesting = true; |
81 | 81 |
82 content::BrowserContext* browser_context_; | 82 content::BrowserContext* browser_context_; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 class WebRequestInternalAddEventListenerFunction | 491 class WebRequestInternalAddEventListenerFunction |
492 : public SyncIOThreadExtensionFunction { | 492 : public SyncIOThreadExtensionFunction { |
493 public: | 493 public: |
494 DECLARE_EXTENSION_FUNCTION("webRequestInternal.addEventListener", | 494 DECLARE_EXTENSION_FUNCTION("webRequestInternal.addEventListener", |
495 WEBREQUESTINTERNAL_ADDEVENTLISTENER) | 495 WEBREQUESTINTERNAL_ADDEVENTLISTENER) |
496 | 496 |
497 protected: | 497 protected: |
498 virtual ~WebRequestInternalAddEventListenerFunction() {} | 498 virtual ~WebRequestInternalAddEventListenerFunction() {} |
499 | 499 |
500 // ExtensionFunction: | 500 // ExtensionFunction: |
501 virtual bool RunSync() OVERRIDE; | 501 virtual bool RunSync() override; |
502 }; | 502 }; |
503 | 503 |
504 class WebRequestInternalEventHandledFunction | 504 class WebRequestInternalEventHandledFunction |
505 : public SyncIOThreadExtensionFunction { | 505 : public SyncIOThreadExtensionFunction { |
506 public: | 506 public: |
507 DECLARE_EXTENSION_FUNCTION("webRequestInternal.eventHandled", | 507 DECLARE_EXTENSION_FUNCTION("webRequestInternal.eventHandled", |
508 WEBREQUESTINTERNAL_EVENTHANDLED) | 508 WEBREQUESTINTERNAL_EVENTHANDLED) |
509 | 509 |
510 protected: | 510 protected: |
511 virtual ~WebRequestInternalEventHandledFunction() {} | 511 virtual ~WebRequestInternalEventHandledFunction() {} |
512 | 512 |
513 // Unblocks the network request and sets |error_| such that the developer | 513 // Unblocks the network request and sets |error_| such that the developer |
514 // console will show the respective error message. Use this function to handle | 514 // console will show the respective error message. Use this function to handle |
515 // incorrect requests from the extension that cannot be detected by the schema | 515 // incorrect requests from the extension that cannot be detected by the schema |
516 // validator. | 516 // validator. |
517 void RespondWithError( | 517 void RespondWithError( |
518 const std::string& event_name, | 518 const std::string& event_name, |
519 const std::string& sub_event_name, | 519 const std::string& sub_event_name, |
520 uint64 request_id, | 520 uint64 request_id, |
521 scoped_ptr<ExtensionWebRequestEventRouter::EventResponse> response, | 521 scoped_ptr<ExtensionWebRequestEventRouter::EventResponse> response, |
522 const std::string& error); | 522 const std::string& error); |
523 | 523 |
524 // ExtensionFunction: | 524 // ExtensionFunction: |
525 virtual bool RunSync() OVERRIDE; | 525 virtual bool RunSync() override; |
526 }; | 526 }; |
527 | 527 |
528 class WebRequestHandlerBehaviorChangedFunction | 528 class WebRequestHandlerBehaviorChangedFunction |
529 : public SyncIOThreadExtensionFunction { | 529 : public SyncIOThreadExtensionFunction { |
530 public: | 530 public: |
531 DECLARE_EXTENSION_FUNCTION("webRequest.handlerBehaviorChanged", | 531 DECLARE_EXTENSION_FUNCTION("webRequest.handlerBehaviorChanged", |
532 WEBREQUEST_HANDLERBEHAVIORCHANGED) | 532 WEBREQUEST_HANDLERBEHAVIORCHANGED) |
533 | 533 |
534 protected: | 534 protected: |
535 virtual ~WebRequestHandlerBehaviorChangedFunction() {} | 535 virtual ~WebRequestHandlerBehaviorChangedFunction() {} |
536 | 536 |
537 // ExtensionFunction: | 537 // ExtensionFunction: |
538 virtual void GetQuotaLimitHeuristics( | 538 virtual void GetQuotaLimitHeuristics( |
539 extensions::QuotaLimitHeuristics* heuristics) const OVERRIDE; | 539 extensions::QuotaLimitHeuristics* heuristics) const override; |
540 // Handle quota exceeded gracefully: Only warn the user but still execute the | 540 // Handle quota exceeded gracefully: Only warn the user but still execute the |
541 // function. | 541 // function. |
542 virtual void OnQuotaExceeded(const std::string& error) OVERRIDE; | 542 virtual void OnQuotaExceeded(const std::string& error) override; |
543 virtual bool RunSync() OVERRIDE; | 543 virtual bool RunSync() override; |
544 }; | 544 }; |
545 | 545 |
546 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ | 546 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ |
OLD | NEW |