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