| 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 CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "base/win/scoped_handle.h" | 32 #include "base/win/scoped_handle.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 class InterstitialPageImpl; | 35 class InterstitialPageImpl; |
| 36 class SavePackage; | 36 class SavePackage; |
| 37 class SessionStorageNamespaceImpl; | 37 class SessionStorageNamespaceImpl; |
| 38 class WebContentsImpl; | 38 class WebContentsImpl; |
| 39 struct ViewMsg_PostMessage_Params; | 39 struct ViewMsg_PostMessage_Params; |
| 40 | 40 |
| 41 namespace content { | 41 namespace content { |
| 42 class BrowserPluginEmbedder; | |
| 43 class BrowserPluginGuest; | |
| 44 class ColorChooser; | 42 class ColorChooser; |
| 45 class DownloadItem; | 43 class DownloadItem; |
| 46 class JavaScriptDialogCreator; | 44 class JavaScriptDialogCreator; |
| 47 class RenderViewHost; | 45 class RenderViewHost; |
| 48 class RenderViewHostDelegateView; | 46 class RenderViewHostDelegateView; |
| 49 class RenderViewHostImpl; | 47 class RenderViewHostImpl; |
| 50 class SiteInstance; | 48 class SiteInstance; |
| 51 class TestWebContents; | 49 class TestWebContents; |
| 52 class WebContentsDelegate; | 50 class WebContentsDelegate; |
| 53 class WebContentsObserver; | 51 class WebContentsObserver; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 84 int routing_id, | 82 int routing_id, |
| 85 const WebContentsImpl* base_web_contents); | 83 const WebContentsImpl* base_web_contents); |
| 86 | 84 |
| 87 static WebContentsImpl* CreateWithOpener( | 85 static WebContentsImpl* CreateWithOpener( |
| 88 content::BrowserContext* browser_context, | 86 content::BrowserContext* browser_context, |
| 89 content::SiteInstance* site_instance, | 87 content::SiteInstance* site_instance, |
| 90 int routing_id, | 88 int routing_id, |
| 91 const WebContentsImpl* base_web_contents, | 89 const WebContentsImpl* base_web_contents, |
| 92 WebContentsImpl* opener); | 90 WebContentsImpl* opener); |
| 93 | 91 |
| 94 // Creates a WebContents to be used as a browser plugin guest. | |
| 95 static WebContentsImpl* CreateGuest(content::BrowserContext* browser_context, | |
| 96 const std::string& host, | |
| 97 int guest_instance_id); | |
| 98 | |
| 99 // Returns the content specific prefs for the given RVH. | 92 // Returns the content specific prefs for the given RVH. |
| 100 static webkit_glue::WebPreferences GetWebkitPrefs( | 93 static webkit_glue::WebPreferences GetWebkitPrefs( |
| 101 content::RenderViewHost* rvh, const GURL& url); | 94 content::RenderViewHost* rvh, const GURL& url); |
| 102 | 95 |
| 103 // Complex initialization here. Specifically needed to avoid having | 96 // Complex initialization here. Specifically needed to avoid having |
| 104 // members call back into our virtual functions in the constructor. | 97 // members call back into our virtual functions in the constructor. |
| 105 virtual void Init(content::BrowserContext* browser_context, | 98 virtual void Init(content::BrowserContext* browser_context, |
| 106 content::SiteInstance* site_instance, | 99 content::SiteInstance* site_instance, |
| 107 int routing_id, | 100 int routing_id, |
| 108 const content::WebContents* base_web_contents); | 101 const content::WebContents* base_web_contents); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return java_bridge_dispatcher_host_manager_.get(); | 155 return java_bridge_dispatcher_host_manager_.get(); |
| 163 } | 156 } |
| 164 | 157 |
| 165 content::old::BrowserPluginHost* old_browser_plugin_host() const { | 158 content::old::BrowserPluginHost* old_browser_plugin_host() const { |
| 166 return old_browser_plugin_host_.get(); | 159 return old_browser_plugin_host_.get(); |
| 167 } | 160 } |
| 168 | 161 |
| 169 // Expose the render manager for testing. | 162 // Expose the render manager for testing. |
| 170 RenderViewHostManager* GetRenderManagerForTesting(); | 163 RenderViewHostManager* GetRenderManagerForTesting(); |
| 171 | 164 |
| 172 // Returns guest browser plugin object, or NULL if this WebContents is not a | |
| 173 // guest. | |
| 174 content::BrowserPluginGuest* GetBrowserPluginGuest(); | |
| 175 // Returns embedder browser plugin object, or NULL if this WebContents is not | |
| 176 // an embedder. | |
| 177 content::BrowserPluginEmbedder* GetBrowserPluginEmbedder(); | |
| 178 | |
| 179 // content::WebContents ------------------------------------------------------ | 165 // content::WebContents ------------------------------------------------------ |
| 180 virtual content::WebContentsDelegate* GetDelegate() OVERRIDE; | 166 virtual content::WebContentsDelegate* GetDelegate() OVERRIDE; |
| 181 virtual void SetDelegate(content::WebContentsDelegate* delegate) OVERRIDE; | 167 virtual void SetDelegate(content::WebContentsDelegate* delegate) OVERRIDE; |
| 182 virtual NavigationControllerImpl& GetController() OVERRIDE; | 168 virtual NavigationControllerImpl& GetController() OVERRIDE; |
| 183 virtual const NavigationControllerImpl& GetController() const OVERRIDE; | 169 virtual const NavigationControllerImpl& GetController() const OVERRIDE; |
| 184 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; | 170 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; |
| 185 virtual content::RenderProcessHost* GetRenderProcessHost() const OVERRIDE; | 171 virtual content::RenderProcessHost* GetRenderProcessHost() const OVERRIDE; |
| 186 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE; | 172 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE; |
| 187 virtual int GetRoutingID() const OVERRIDE; | 173 virtual int GetRoutingID() const OVERRIDE; |
| 188 virtual content::RenderWidgetHostView* | 174 virtual content::RenderWidgetHostView* |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); | 545 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); |
| 560 void OnPepperPluginHung(int plugin_child_id, | 546 void OnPepperPluginHung(int plugin_child_id, |
| 561 const FilePath& path, | 547 const FilePath& path, |
| 562 bool is_hung); | 548 bool is_hung); |
| 563 void OnWebUISend(const GURL& source_url, | 549 void OnWebUISend(const GURL& source_url, |
| 564 const std::string& name, | 550 const std::string& name, |
| 565 const base::ListValue& args); | 551 const base::ListValue& args); |
| 566 void OnRequestPpapiBrokerPermission(int request_id, | 552 void OnRequestPpapiBrokerPermission(int request_id, |
| 567 const GURL& url, | 553 const GURL& url, |
| 568 const FilePath& plugin_path); | 554 const FilePath& plugin_path); |
| 569 void OnBrowserPluginNavigateGuest(int instance_id, | |
| 570 int64 frame_id, | |
| 571 const std::string& src, | |
| 572 const gfx::Size& size); | |
| 573 | 555 |
| 574 // Changes the IsLoading state and notifies delegate as needed | 556 // Changes the IsLoading state and notifies delegate as needed |
| 575 // |details| is used to provide details on the load that just finished | 557 // |details| is used to provide details on the load that just finished |
| 576 // (but can be null if not applicable). Can be overridden. | 558 // (but can be null if not applicable). Can be overridden. |
| 577 void SetIsLoading(bool is_loading, | 559 void SetIsLoading(bool is_loading, |
| 578 content::LoadNotificationDetails* details); | 560 content::LoadNotificationDetails* details); |
| 579 | 561 |
| 580 // Called by derived classes to indicate that we're no longer waiting for a | 562 // Called by derived classes to indicate that we're no longer waiting for a |
| 581 // response. This won't actually update the throbber, but it will get picked | 563 // response. This won't actually update the throbber, but it will get picked |
| 582 // up at the next animation step if the throbber is going. | 564 // up at the next animation step if the throbber is going. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 void SaveURL(const GURL& url, | 650 void SaveURL(const GURL& url, |
| 669 const content::Referrer& referrer, | 651 const content::Referrer& referrer, |
| 670 bool is_main_frame); | 652 bool is_main_frame); |
| 671 | 653 |
| 672 content::RenderViewHostImpl* GetRenderViewHostImpl(); | 654 content::RenderViewHostImpl* GetRenderViewHostImpl(); |
| 673 | 655 |
| 674 void GetBrowserPluginEmbedderInfo(content::RenderViewHost* render_view_host, | 656 void GetBrowserPluginEmbedderInfo(content::RenderViewHost* render_view_host, |
| 675 std::string* embedder_channel_name, | 657 std::string* embedder_channel_name, |
| 676 int* embedder_container_id); | 658 int* embedder_container_id); |
| 677 | 659 |
| 678 // Removes browser plugin embedder if there is one. | |
| 679 void RemoveBrowserPluginEmbedder(); | |
| 680 | |
| 681 // Data for core operation --------------------------------------------------- | 660 // Data for core operation --------------------------------------------------- |
| 682 | 661 |
| 683 // Delegate for notifying our owner about stuff. Not owned by us. | 662 // Delegate for notifying our owner about stuff. Not owned by us. |
| 684 content::WebContentsDelegate* delegate_; | 663 content::WebContentsDelegate* delegate_; |
| 685 | 664 |
| 686 // Handles the back/forward list and loading. | 665 // Handles the back/forward list and loading. |
| 687 NavigationControllerImpl controller_; | 666 NavigationControllerImpl controller_; |
| 688 | 667 |
| 689 // The corresponding view. | 668 // The corresponding view. |
| 690 scoped_ptr<content::WebContentsView> view_; | 669 scoped_ptr<content::WebContentsView> view_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 718 | 697 |
| 719 // Manages creation and swapping of render views. | 698 // Manages creation and swapping of render views. |
| 720 RenderViewHostManager render_manager_; | 699 RenderViewHostManager render_manager_; |
| 721 | 700 |
| 722 // Manages injecting Java objects into all RenderViewHosts associated with | 701 // Manages injecting Java objects into all RenderViewHosts associated with |
| 723 // this WebContentsImpl. | 702 // this WebContentsImpl. |
| 724 scoped_ptr<JavaBridgeDispatcherHostManager> | 703 scoped_ptr<JavaBridgeDispatcherHostManager> |
| 725 java_bridge_dispatcher_host_manager_; | 704 java_bridge_dispatcher_host_manager_; |
| 726 | 705 |
| 727 // TODO(fsamuel): Remove this once upstreaming of the new browser plugin | 706 // TODO(fsamuel): Remove this once upstreaming of the new browser plugin |
| 728 // implementation is complete. | 707 // implmentation is complete. |
| 729 // Manages the browser plugin instances hosted by this WebContents. | 708 // Manages the browser plugin instances hosted by this WebContents. |
| 730 scoped_ptr<content::old::BrowserPluginHost> old_browser_plugin_host_; | 709 scoped_ptr<content::old::BrowserPluginHost> old_browser_plugin_host_; |
| 731 | 710 |
| 732 // SavePackage, lazily created. | 711 // SavePackage, lazily created. |
| 733 scoped_refptr<SavePackage> save_package_; | 712 scoped_refptr<SavePackage> save_package_; |
| 734 | 713 |
| 735 // Data for loading state ---------------------------------------------------- | 714 // Data for loading state ---------------------------------------------------- |
| 736 | 715 |
| 737 // Indicates whether we're currently loading a resource. | 716 // Indicates whether we're currently loading a resource. |
| 738 bool is_loading_; | 717 bool is_loading_; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 // The intrinsic size of the page. | 816 // The intrinsic size of the page. |
| 838 gfx::Size preferred_size_; | 817 gfx::Size preferred_size_; |
| 839 | 818 |
| 840 // Content restrictions, used to disable print/copy etc based on content's | 819 // Content restrictions, used to disable print/copy etc based on content's |
| 841 // (full-page plugins for now only) permissions. | 820 // (full-page plugins for now only) permissions. |
| 842 int content_restrictions_; | 821 int content_restrictions_; |
| 843 | 822 |
| 844 // Color chooser that was opened by this tab. | 823 // Color chooser that was opened by this tab. |
| 845 content::ColorChooser* color_chooser_; | 824 content::ColorChooser* color_chooser_; |
| 846 | 825 |
| 847 // Manages the embedder state for browser plugins, if this WebContents is an | |
| 848 // embedder; NULL otherwise. | |
| 849 scoped_ptr<content::BrowserPluginEmbedder> browser_plugin_embedder_; | |
| 850 // Manages the guest state for browser plugin, if this WebContents is a guest; | |
| 851 // NULL otherwise. | |
| 852 scoped_ptr<content::BrowserPluginGuest> browser_plugin_guest_; | |
| 853 | |
| 854 // This must be at the end, or else we might get notifications and use other | 826 // This must be at the end, or else we might get notifications and use other |
| 855 // member variables that are gone. | 827 // member variables that are gone. |
| 856 content::NotificationRegistrar registrar_; | 828 content::NotificationRegistrar registrar_; |
| 857 | 829 |
| 858 // Used during IPC message dispatching so that the handlers can get a pointer | 830 // Used during IPC message dispatching so that the handlers can get a pointer |
| 859 // to the RVH through which the message was received. | 831 // to the RVH through which the message was received. |
| 860 content::RenderViewHost* message_source_; | 832 content::RenderViewHost* message_source_; |
| 861 | 833 |
| 862 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 834 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
| 863 }; | 835 }; |
| 864 | 836 |
| 865 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 837 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |