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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 typedef std::pair<void*, extensions::RulesRegistryService::WebViewKey> | 460 typedef std::pair<void*, extensions::RulesRegistryService::WebViewKey> |
461 RulesRegistryKey; | 461 RulesRegistryKey; |
462 // Maps each profile (and OTRProfile) and a webview key to its respective | 462 // Maps each profile (and OTRProfile) and a webview key to its respective |
463 // rules registry. | 463 // rules registry. |
464 std::map<RulesRegistryKey, | 464 std::map<RulesRegistryKey, |
465 scoped_refptr<extensions::WebRequestRulesRegistry> > rules_registries_; | 465 scoped_refptr<extensions::WebRequestRulesRegistry> > rules_registries_; |
466 | 466 |
467 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter); | 467 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter); |
468 }; | 468 }; |
469 | 469 |
470 class WebRequestAddEventListener : public SyncIOThreadExtensionFunction { | 470 class WebRequestInternalAddEventListenerFunction |
| 471 : public SyncIOThreadExtensionFunction { |
471 public: | 472 public: |
472 DECLARE_EXTENSION_FUNCTION("webRequestInternal.addEventListener", | 473 DECLARE_EXTENSION_FUNCTION("webRequestInternal.addEventListener", |
473 WEBREQUESTINTERNAL_ADDEVENTLISTENER) | 474 WEBREQUESTINTERNAL_ADDEVENTLISTENER) |
474 | 475 |
475 protected: | 476 protected: |
476 virtual ~WebRequestAddEventListener() {} | 477 virtual ~WebRequestInternalAddEventListenerFunction() {} |
477 | 478 |
478 // ExtensionFunction: | 479 // ExtensionFunction: |
479 virtual bool RunImpl() OVERRIDE; | 480 virtual bool RunImpl() OVERRIDE; |
480 }; | 481 }; |
481 | 482 |
482 class WebRequestEventHandled : public SyncIOThreadExtensionFunction { | 483 class WebRequestInternalEventHandledFunction |
| 484 : public SyncIOThreadExtensionFunction { |
483 public: | 485 public: |
484 DECLARE_EXTENSION_FUNCTION("webRequestInternal.eventHandled", | 486 DECLARE_EXTENSION_FUNCTION("webRequestInternal.eventHandled", |
485 WEBREQUESTINTERNAL_EVENTHANDLED) | 487 WEBREQUESTINTERNAL_EVENTHANDLED) |
486 | 488 |
487 protected: | 489 protected: |
488 virtual ~WebRequestEventHandled() {} | 490 virtual ~WebRequestInternalEventHandledFunction() {} |
489 | 491 |
490 // Unblocks the network request and sets |error_| such that the developer | 492 // Unblocks the network request and sets |error_| such that the developer |
491 // 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 |
492 // 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 |
493 // validator. | 495 // validator. |
494 void RespondWithError( | 496 void RespondWithError( |
495 const std::string& event_name, | 497 const std::string& event_name, |
496 const std::string& sub_event_name, | 498 const std::string& sub_event_name, |
497 uint64 request_id, | 499 uint64 request_id, |
498 scoped_ptr<ExtensionWebRequestEventRouter::EventResponse> response, | 500 scoped_ptr<ExtensionWebRequestEventRouter::EventResponse> response, |
(...skipping 20 matching lines...) Expand all Loading... |
519 virtual void OnQuotaExceeded(const std::string& error) OVERRIDE; | 521 virtual void OnQuotaExceeded(const std::string& error) OVERRIDE; |
520 virtual bool RunImpl() OVERRIDE; | 522 virtual bool RunImpl() OVERRIDE; |
521 }; | 523 }; |
522 | 524 |
523 // Send updates to |host| with information about what webRequest-related | 525 // Send updates to |host| with information about what webRequest-related |
524 // extensions are installed. | 526 // extensions are installed. |
525 // TODO(mpcomplete): remove. http://crbug.com/100411 | 527 // TODO(mpcomplete): remove. http://crbug.com/100411 |
526 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); | 528 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); |
527 | 529 |
528 #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 |