| 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 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/property_bag.h" | 15 #include "base/property_bag.h" |
| 16 #include "content/browser/browser_plugin/browser_plugin_host.h" |
| 16 #include "content/browser/browser_plugin/old/old_browser_plugin_host.h" | 17 #include "content/browser/browser_plugin/old/old_browser_plugin_host.h" |
| 17 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 18 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" |
| 18 #include "content/browser/renderer_host/render_view_host_delegate.h" | 19 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 19 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 20 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 20 #include "content/browser/web_contents/navigation_controller_impl.h" | 21 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 21 #include "content/browser/web_contents/render_view_host_manager.h" | 22 #include "content/browser/web_contents/render_view_host_manager.h" |
| 22 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
| 23 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
| 24 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
| 25 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // | 115 // |
| 115 // If this method returns false, then the navigation is discarded (equivalent | 116 // If this method returns false, then the navigation is discarded (equivalent |
| 116 // to calling DiscardPendingEntry on the NavigationController). | 117 // to calling DiscardPendingEntry on the NavigationController). |
| 117 bool NavigateToPendingEntry( | 118 bool NavigateToPendingEntry( |
| 118 content::NavigationController::ReloadType reload_type); | 119 content::NavigationController::ReloadType reload_type); |
| 119 | 120 |
| 120 // Called by InterstitialPageImpl when it creates a RenderViewHost. | 121 // Called by InterstitialPageImpl when it creates a RenderViewHost. |
| 121 void RenderViewForInterstitialPageCreated( | 122 void RenderViewForInterstitialPageCreated( |
| 122 content::RenderViewHost* render_view_host); | 123 content::RenderViewHost* render_view_host); |
| 123 | 124 |
| 125 // Finds the new RenderWidgetHost and returns it. Note that this can only be |
| 126 // called once as this call also removes it from the internal map. |
| 127 content::RenderWidgetHostView* GetCreatedWidget(int route_id); |
| 128 |
| 124 // Sets the passed passed interstitial as the currently showing interstitial. | 129 // Sets the passed passed interstitial as the currently showing interstitial. |
| 125 // |interstitial_page| should be non NULL (use the remove_interstitial_page | 130 // |interstitial_page| should be non NULL (use the remove_interstitial_page |
| 126 // method to unset the interstitial) and no interstitial page should be set | 131 // method to unset the interstitial) and no interstitial page should be set |
| 127 // when there is already a non NULL interstitial page set. | 132 // when there is already a non NULL interstitial page set. |
| 128 void set_interstitial_page(InterstitialPageImpl* interstitial_page) { | 133 void set_interstitial_page(InterstitialPageImpl* interstitial_page) { |
| 129 render_manager_.set_interstitial_page(interstitial_page); | 134 render_manager_.set_interstitial_page(interstitial_page); |
| 130 } | 135 } |
| 131 | 136 |
| 132 // Unsets the currently showing interstitial. | 137 // Unsets the currently showing interstitial. |
| 133 void remove_interstitial_page() { | 138 void remove_interstitial_page() { |
| 134 render_manager_.remove_interstitial_page(); | 139 render_manager_.remove_interstitial_page(); |
| 135 } | 140 } |
| 136 | 141 |
| 137 void set_opener_web_ui_type(content::WebUI::TypeID opener_web_ui_type) { | 142 void set_opener_web_ui_type(content::WebUI::TypeID opener_web_ui_type) { |
| 138 opener_web_ui_type_ = opener_web_ui_type; | 143 opener_web_ui_type_ = opener_web_ui_type; |
| 139 } | 144 } |
| 140 | 145 |
| 141 JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const { | 146 JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const { |
| 142 return java_bridge_dispatcher_host_manager_.get(); | 147 return java_bridge_dispatcher_host_manager_.get(); |
| 143 } | 148 } |
| 144 | 149 |
| 145 content::old::BrowserPluginHost* old_browser_plugin_host() const { | 150 content::old::BrowserPluginHost* old_browser_plugin_host() const { |
| 146 return old_browser_plugin_host_.get(); | 151 return old_browser_plugin_host_.get(); |
| 147 } | 152 } |
| 148 | 153 |
| 154 content::BrowserPluginHost* browser_plugin_host() const { |
| 155 return browser_plugin_host_.get(); |
| 156 } |
| 157 |
| 149 // Like GetController from WebContents, but returns the concrete object. | 158 // Like GetController from WebContents, but returns the concrete object. |
| 150 NavigationControllerImpl& GetControllerImpl(); | 159 NavigationControllerImpl& GetControllerImpl(); |
| 151 | 160 |
| 152 // Expose the render manager for testing. | 161 // Expose the render manager for testing. |
| 153 RenderViewHostManager* GetRenderManagerForTesting(); | 162 RenderViewHostManager* GetRenderManagerForTesting(); |
| 154 | 163 |
| 155 // content::WebContents ------------------------------------------------------ | 164 // content::WebContents ------------------------------------------------------ |
| 156 virtual const base::PropertyBag* GetPropertyBag() const OVERRIDE; | 165 virtual const base::PropertyBag* GetPropertyBag() const OVERRIDE; |
| 157 virtual base::PropertyBag* GetPropertyBag() OVERRIDE; | 166 virtual base::PropertyBag* GetPropertyBag() OVERRIDE; |
| 158 virtual content::WebContentsDelegate* GetDelegate() OVERRIDE; | 167 virtual content::WebContentsDelegate* GetDelegate() OVERRIDE; |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 // Helper for CreateNewWidget/CreateNewFullscreenWidget. | 597 // Helper for CreateNewWidget/CreateNewFullscreenWidget. |
| 589 void CreateNewWidget(int route_id, | 598 void CreateNewWidget(int route_id, |
| 590 bool is_fullscreen, | 599 bool is_fullscreen, |
| 591 WebKit::WebPopupType popup_type); | 600 WebKit::WebPopupType popup_type); |
| 592 | 601 |
| 593 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget. | 602 // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget. |
| 594 void ShowCreatedWidget(int route_id, | 603 void ShowCreatedWidget(int route_id, |
| 595 bool is_fullscreen, | 604 bool is_fullscreen, |
| 596 const gfx::Rect& initial_pos); | 605 const gfx::Rect& initial_pos); |
| 597 | 606 |
| 598 // Finds the new RenderWidgetHost and returns it. Note that this can only be | |
| 599 // called once as this call also removes it from the internal map. | |
| 600 content::RenderWidgetHostView* GetCreatedWidget(int route_id); | |
| 601 | |
| 602 // Finds the new WebContentsImpl by route_id, initializes it for | 607 // Finds the new WebContentsImpl by route_id, initializes it for |
| 603 // renderer-initiated creation, and returns it. Note that this can only be | 608 // renderer-initiated creation, and returns it. Note that this can only be |
| 604 // called once as this call also removes it from the internal map. | 609 // called once as this call also removes it from the internal map. |
| 605 WebContentsImpl* GetCreatedWindow(int route_id); | 610 WebContentsImpl* GetCreatedWindow(int route_id); |
| 606 | 611 |
| 607 // Misc non-view stuff ------------------------------------------------------- | 612 // Misc non-view stuff ------------------------------------------------------- |
| 608 | 613 |
| 609 // Helper functions for sending notifications. | 614 // Helper functions for sending notifications. |
| 610 void NotifySwapped(); | 615 void NotifySwapped(); |
| 611 void NotifyConnected(); | 616 void NotifyConnected(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 | 673 |
| 669 // Manages creation and swapping of render views. | 674 // Manages creation and swapping of render views. |
| 670 RenderViewHostManager render_manager_; | 675 RenderViewHostManager render_manager_; |
| 671 | 676 |
| 672 // Manages injecting Java objects into all RenderViewHosts associated with | 677 // Manages injecting Java objects into all RenderViewHosts associated with |
| 673 // this WebContentsImpl. | 678 // this WebContentsImpl. |
| 674 scoped_ptr<JavaBridgeDispatcherHostManager> | 679 scoped_ptr<JavaBridgeDispatcherHostManager> |
| 675 java_bridge_dispatcher_host_manager_; | 680 java_bridge_dispatcher_host_manager_; |
| 676 | 681 |
| 677 // TODO(fsamuel): Remove this once upstreaming of the new browser plugin | 682 // TODO(fsamuel): Remove this once upstreaming of the new browser plugin |
| 678 // implmentation is complete. | 683 // implementation is complete. |
| 679 // Manages the browser plugin instances hosted by this WebContents. | 684 // Manages the browser plugin instances hosted by this WebContents. |
| 680 scoped_ptr<content::old::BrowserPluginHost> old_browser_plugin_host_; | 685 scoped_ptr<content::old::BrowserPluginHost> old_browser_plugin_host_; |
| 681 | 686 |
| 687 // Manages the browser plugin instances hosted by this WebContents. |
| 688 scoped_ptr<content::BrowserPluginHost> browser_plugin_host_; |
| 689 |
| 682 // SavePackage, lazily created. | 690 // SavePackage, lazily created. |
| 683 scoped_refptr<SavePackage> save_package_; | 691 scoped_refptr<SavePackage> save_package_; |
| 684 | 692 |
| 685 // Data for loading state ---------------------------------------------------- | 693 // Data for loading state ---------------------------------------------------- |
| 686 | 694 |
| 687 // Indicates whether we're currently loading a resource. | 695 // Indicates whether we're currently loading a resource. |
| 688 bool is_loading_; | 696 bool is_loading_; |
| 689 | 697 |
| 690 // Indicates if the tab is considered crashed. | 698 // Indicates if the tab is considered crashed. |
| 691 base::TerminationStatus crashed_status_; | 699 base::TerminationStatus crashed_status_; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 content::NotificationRegistrar registrar_; | 807 content::NotificationRegistrar registrar_; |
| 800 | 808 |
| 801 // Used during IPC message dispatching so that the handlers can get a pointer | 809 // Used during IPC message dispatching so that the handlers can get a pointer |
| 802 // to the RVH through which the message was received. | 810 // to the RVH through which the message was received. |
| 803 content::RenderViewHost* message_source_; | 811 content::RenderViewHost* message_source_; |
| 804 | 812 |
| 805 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 813 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
| 806 }; | 814 }; |
| 807 | 815 |
| 808 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 816 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |