Index: content/browser/frame_host/render_frame_host_impl.h |
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h |
index 84c579d8a494dc03e44a932f6250579806aacbf8..69cf33fd50c7e5926f31c035047f23a9a09e7515 100644 |
--- a/content/browser/frame_host/render_frame_host_impl.h |
+++ b/content/browser/frame_host/render_frame_host_impl.h |
@@ -16,6 +16,7 @@ |
#include "base/time/time.h" |
#include "content/browser/accessibility/browser_accessibility_manager.h" |
#include "content/browser/site_instance_impl.h" |
+#include "content/browser/webui/web_ui_impl.h" |
#include "content/common/accessibility_mode_enums.h" |
#include "content/common/ax_content_node_data.h" |
#include "content/common/content_export.h" |
@@ -213,6 +214,14 @@ class CONTENT_EXPORT RenderFrameHostImpl |
RenderFrameHostDelegate* delegate() { return delegate_; } |
FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
+ // Returns the associated active WebUI or nullptr if none applies. |
+ WebUIImpl* web_ui() const { return web_ui_.get(); } |
+ |
+ // Returns the pending WebUI, or nullptr of none applies. |
+ WebUIImpl* pending_web_ui() const { |
+ return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); |
+ } |
+ |
// Returns this RenderFrameHost's loading state. This method is only used by |
// FrameTreeNode. The proper way to check whether a frame is loading is to |
// call FrameTreeNode::IsLoading. |
@@ -468,13 +477,35 @@ class CONTENT_EXPORT RenderFrameHostImpl |
// addition, its associated RenderWidgetHost has to be focused. |
bool IsFocused(); |
+ // Updates the pending WebUI data of this RenderFrameHost depending on the |
+ // provided |dest_url|. If it doesn't demand a WebUI, the pending one is |
nasko
2015/10/07 23:49:33
nit: s/demand/require/
carlosk
2015/10/09 17:29:10
Done.
|
+ // cleared. If a new WebUI is required and its type matches the existing |
+ // pending one it will be reused. If the type matches the active one then the |
+ // pending is cleared and the current one is set to be reused. Otherwise a new |
+ // pending WebUI instance is set. |
+ // If this is a history navigation its bindings from the NavigationEntry |
+ // should be provided through |entry_bindings|. It will allow verifying that |
+ // bindings are not being set differently this time around. Otherwise |
+ // |entry_bindings| should be set to NavigationEntryImpl::kInvalidBindings. |
+ void UpdatePendingWebUI(const GURL& dest_url, int entry_bindings); |
+ |
+ // Updates the active WebUI with the pending data set by the last call to |
nasko
2015/10/07 23:49:33
nit: s/data/one/
carlosk
2015/10/09 17:29:10
Done.
|
+ // UpdatePendingWebUI and then clears any pending data. If UpdatePendingWebUI |
+ // was not called the active WebUI will simply be cleared. |
+ void CommitPendingWebUI(); |
+ |
+ // Destroys the pending WebUI and cleans up any related data. |
+ void DiscardPendingWebUI(); |
+ |
// Returns the Mojo ImageDownloader service. |
const image_downloader::ImageDownloaderPtr& GetMojoImageDownloader(); |
protected: |
friend class RenderFrameHostFactory; |
- // |flags| is a combination of CreateRenderFrameFlags. |
+ // |flags| is a combination of CreateRenderFrameFlags. The |dest_url| and |
+ // |entry_bindings| parameters are used to create an associated WebUI if one |
+ // is required (see UpdatePendingWebUI for further details). |
// TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
// should be the abstraction needed here, but we need RenderViewHost to pass |
// into WebContentsObserver::FrameDetached for now. |
@@ -486,7 +517,9 @@ class CONTENT_EXPORT RenderFrameHostImpl |
FrameTreeNode* frame_tree_node, |
int32 routing_id, |
int32 widget_routing_id, |
- int flags); |
+ int flags, |
+ const GURL& dest_url, |
+ int entry_bindings); |
private: |
friend class TestRenderFrameHost; |
@@ -622,6 +655,15 @@ class CONTENT_EXPORT RenderFrameHostImpl |
const content::StartNavigationParams& start_params, |
const content::RequestNavigationParams& request_params); |
+ // Creates a WebUI object for the given URL if one applies and sets |
+ // |web_ui_type| to its type, also ensuring that its bindings match |
+ // |entry_bindings| (if provided and different than |
+ // NavigationEntryImpl::kInvalidBindings). If no WebUI applies, returns |
+ // nullptr and resets web_ui_type to WebUI::kNoWebUI. . |
+ scoped_ptr<WebUIImpl> CreateWebUI(const GURL& dest_url, |
+ int entry_bindings, |
+ WebUI::TypeID* web_ui_type); |
+ |
// For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
// refcount that calls Shutdown when it reaches zero. This allows each |
// RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
@@ -790,6 +832,21 @@ class CONTENT_EXPORT RenderFrameHostImpl |
// NavigationHandle for it is owned by the NavigationRequest. |
scoped_ptr<NavigationHandleImpl> navigation_handle_; |
+ // The associated WebUIImpl and its type. They will be set if the current page |
+ // is a WebUI page. Otherwise they will be nullptr and WebUI::kNoWebUI, |
+ // respectively. |
+ scoped_ptr<WebUIImpl> web_ui_; |
+ WebUI::TypeID web_ui_type_; |
+ |
+ // Stores a pending WebUIImpl and its type. These will only be set during a |
+ // same-site navigation to a WebUI page (reusing this RenderFrameHost). |
+ scoped_ptr<WebUIImpl> pending_web_ui_; |
+ WebUI::TypeID pending_web_ui_type_; |
+ |
+ // If true at commit time the current WebUI will simply be reused (no pending |
+ // one will exist to be committed). |
+ bool should_reuse_web_ui_; |
+ |
// NOTE: This must be the last member. |
base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |