Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: extensions/browser/api/web_request/web_request_api.h

Issue 2204363002: [Extensions] Remove SyncIOThreadExtensionFunction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ; Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | extensions/browser/api/web_request/web_request_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 // respective rules registry. 469 // respective rules registry.
470 std::map<RulesRegistryKey, 470 std::map<RulesRegistryKey,
471 scoped_refptr<extensions::WebRequestRulesRegistry> > rules_registries_; 471 scoped_refptr<extensions::WebRequestRulesRegistry> > rules_registries_;
472 472
473 std::unique_ptr<extensions::WebRequestEventRouterDelegate> 473 std::unique_ptr<extensions::WebRequestEventRouterDelegate>
474 web_request_event_router_delegate_; 474 web_request_event_router_delegate_;
475 475
476 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter); 476 DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter);
477 }; 477 };
478 478
479 class WebRequestInternalFunction : public SyncIOThreadExtensionFunction { 479 class WebRequestInternalFunction : public IOThreadExtensionFunction {
480 public: 480 public:
481 WebRequestInternalFunction() {} 481 WebRequestInternalFunction() {}
482 482
483 protected: 483 protected:
484 ~WebRequestInternalFunction() override {} 484 ~WebRequestInternalFunction() override {}
485 485
486 const std::string& extension_id_safe() const { 486 const std::string& extension_id_safe() const {
487 return extension() ? extension_id() : base::EmptyString(); 487 return extension() ? extension_id() : base::EmptyString();
488 } 488 }
489 }; 489 };
490 490
491 class WebRequestInternalAddEventListenerFunction 491 class WebRequestInternalAddEventListenerFunction
492 : public WebRequestInternalFunction { 492 : public WebRequestInternalFunction {
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 ~WebRequestInternalAddEventListenerFunction() override {} 498 ~WebRequestInternalAddEventListenerFunction() override {}
499 499
500 // ExtensionFunction: 500 // ExtensionFunction:
501 bool RunSync() override; 501 ResponseAction Run() override;
502 }; 502 };
503 503
504 class WebRequestInternalEventHandledFunction 504 class WebRequestInternalEventHandledFunction
505 : public WebRequestInternalFunction { 505 : public WebRequestInternalFunction {
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 ~WebRequestInternalEventHandledFunction() override {} 511 ~WebRequestInternalEventHandledFunction() override {}
512 512
513 // Unblocks the network request and sets |error_| such that the developer 513 // Unblocks the network request. Use this function when handling incorrect
514 // console will show the respective error message. Use this function to handle 514 // 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. 515 // validator.
517 void RespondWithError( 516 void OnError(
lazyboy 2016/08/03 23:10:37 this can/should be private:
Devlin 2016/08/04 16:32:42 Done.
518 const std::string& event_name, 517 const std::string& event_name,
519 const std::string& sub_event_name, 518 const std::string& sub_event_name,
520 uint64_t request_id, 519 uint64_t request_id,
521 std::unique_ptr<ExtensionWebRequestEventRouter::EventResponse> response, 520 std::unique_ptr<ExtensionWebRequestEventRouter::EventResponse> response);
522 const std::string& error);
523 521
524 // ExtensionFunction: 522 // ExtensionFunction:
525 bool RunSync() override; 523 ResponseAction Run() override;
526 }; 524 };
527 525
528 class WebRequestHandlerBehaviorChangedFunction 526 class WebRequestHandlerBehaviorChangedFunction
529 : public WebRequestInternalFunction { 527 : public WebRequestInternalFunction {
530 public: 528 public:
531 DECLARE_EXTENSION_FUNCTION("webRequest.handlerBehaviorChanged", 529 DECLARE_EXTENSION_FUNCTION("webRequest.handlerBehaviorChanged",
532 WEBREQUEST_HANDLERBEHAVIORCHANGED) 530 WEBREQUEST_HANDLERBEHAVIORCHANGED)
533 531
534 protected: 532 protected:
535 ~WebRequestHandlerBehaviorChangedFunction() override {} 533 ~WebRequestHandlerBehaviorChangedFunction() override {}
536 534
537 // ExtensionFunction: 535 // ExtensionFunction:
538 void GetQuotaLimitHeuristics( 536 void GetQuotaLimitHeuristics(
539 extensions::QuotaLimitHeuristics* heuristics) const override; 537 extensions::QuotaLimitHeuristics* heuristics) const override;
540 // Handle quota exceeded gracefully: Only warn the user but still execute the 538 // Handle quota exceeded gracefully: Only warn the user but still execute the
541 // function. 539 // function.
542 void OnQuotaExceeded(const std::string& error) override; 540 void OnQuotaExceeded(const std::string& error) override;
543 bool RunSync() override; 541 ResponseAction Run() override;
544 }; 542 };
545 543
546 } // namespace extensions 544 } // namespace extensions
547 545
548 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_ 546 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/api/web_request/web_request_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698