| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EXTENSION_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 } | 491 } |
| 492 | 492 |
| 493 void set_dispatcher(const base::WeakPtr< | 493 void set_dispatcher(const base::WeakPtr< |
| 494 extensions::ExtensionFunctionDispatcher>& dispatcher) { | 494 extensions::ExtensionFunctionDispatcher>& dispatcher) { |
| 495 dispatcher_ = dispatcher; | 495 dispatcher_ = dispatcher; |
| 496 } | 496 } |
| 497 extensions::ExtensionFunctionDispatcher* dispatcher() const { | 497 extensions::ExtensionFunctionDispatcher* dispatcher() const { |
| 498 return dispatcher_.get(); | 498 return dispatcher_.get(); |
| 499 } | 499 } |
| 500 | 500 |
| 501 void set_is_from_service_worker(bool value) { |
| 502 is_from_service_worker_ = value; |
| 503 } |
| 504 |
| 501 // Gets the "current" web contents if any. If there is no associated web | 505 // Gets the "current" web contents if any. If there is no associated web |
| 502 // contents then defaults to the foremost one. | 506 // contents then defaults to the foremost one. |
| 503 // NOTE: "current" can mean different things in different contexts. You | 507 // NOTE: "current" can mean different things in different contexts. You |
| 504 // probably want to use GetSenderWebContents(). | 508 // probably want to use GetSenderWebContents(). |
| 505 virtual content::WebContents* GetAssociatedWebContents(); | 509 virtual content::WebContents* GetAssociatedWebContents(); |
| 506 | 510 |
| 507 // Returns the web contents associated with the sending |render_frame_host_|. | 511 // Returns the web contents associated with the sending |render_frame_host_|. |
| 508 // This can be null. | 512 // This can be null. |
| 509 content::WebContents* GetSenderWebContents(); | 513 content::WebContents* GetSenderWebContents(); |
| 510 | 514 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 532 class RenderFrameHostTracker; | 536 class RenderFrameHostTracker; |
| 533 | 537 |
| 534 void Destruct() const override; | 538 void Destruct() const override; |
| 535 | 539 |
| 536 // The dispatcher that will service this extension function call. | 540 // The dispatcher that will service this extension function call. |
| 537 base::WeakPtr<extensions::ExtensionFunctionDispatcher> dispatcher_; | 541 base::WeakPtr<extensions::ExtensionFunctionDispatcher> dispatcher_; |
| 538 | 542 |
| 539 // The RenderFrameHost we will send responses to. | 543 // The RenderFrameHost we will send responses to. |
| 540 content::RenderFrameHost* render_frame_host_; | 544 content::RenderFrameHost* render_frame_host_; |
| 541 | 545 |
| 546 // Whether or not this ExtensionFunction was called by an extension Service |
| 547 // Worker. |
| 548 bool is_from_service_worker_; |
| 549 |
| 542 std::unique_ptr<RenderFrameHostTracker> tracker_; | 550 std::unique_ptr<RenderFrameHostTracker> tracker_; |
| 543 | 551 |
| 544 DelegateForTests* delegate_; | 552 DelegateForTests* delegate_; |
| 545 | 553 |
| 546 // The blobs transferred to the renderer process. | 554 // The blobs transferred to the renderer process. |
| 547 std::vector<std::string> transferred_blob_uuids_; | 555 std::vector<std::string> transferred_blob_uuids_; |
| 548 | 556 |
| 549 DISALLOW_COPY_AND_ASSIGN(UIThreadExtensionFunction); | 557 DISALLOW_COPY_AND_ASSIGN(UIThreadExtensionFunction); |
| 550 }; | 558 }; |
| 551 | 559 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 private: | 690 private: |
| 683 // If you're hitting a compile error here due to "final" - great! You're | 691 // If you're hitting a compile error here due to "final" - great! You're |
| 684 // doing the right thing, you just need to extend IOThreadExtensionFunction | 692 // doing the right thing, you just need to extend IOThreadExtensionFunction |
| 685 // instead of SyncIOExtensionFunction. | 693 // instead of SyncIOExtensionFunction. |
| 686 ResponseAction Run() final; | 694 ResponseAction Run() final; |
| 687 | 695 |
| 688 DISALLOW_COPY_AND_ASSIGN(SyncIOThreadExtensionFunction); | 696 DISALLOW_COPY_AND_ASSIGN(SyncIOThreadExtensionFunction); |
| 689 }; | 697 }; |
| 690 | 698 |
| 691 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 699 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| OLD | NEW |