Browser Plugin: Implement autosize (Embedder-side code)
Snippet from bug:
"When using <webview> to embed widgets that change in size (e.g. the +1 button has various hover bubbles that can appear), it can be tedious (and inefficient) to make the contents monitor their size and inform the embedder that the <webview> needs to be resize."
This patch doesn't fully implement this feature, but in the interest of smaller, easier to review patches, this can stand alone.
This patch implements autoSize, minWidth, minHeight, maxWidth, maxHeight attributes on BrowserPlugin.
If these attributes are set before first navigation, they are propagated to the browser process on
BrowserPluginHostMsg_CreateGuest.
If these attributes or updated after navigation, they are propagated via BrowserPluginHostMsg_SetAutoSize.
BUG=157620
Review URL: https://chromiumcodereview.appspot.com/11361052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165817 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 3d3dfaed..c4bb81b 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -394,11 +394,11 @@
return new_contents;
}
-WebContentsImpl* WebContentsImpl::CreateGuest(BrowserContext* browser_context,
- const std::string& host_url,
- int guest_instance_id,
- bool focused,
- bool visible) {
+WebContentsImpl* WebContentsImpl::CreateGuest(
+ BrowserContext* browser_context,
+ const std::string& host_url,
+ int guest_instance_id,
+ const BrowserPluginHostMsg_CreateGuest_Params& params) {
// The SiteInstance of a given guest is based on the fact that it's a guest
// in addition to which platform application the guest belongs to, rather
// than the URL that the guest is being navigated to.
@@ -421,8 +421,7 @@
guest_instance_id,
new_contents_impl,
new_contents_impl->GetRenderViewHost(),
- focused,
- visible));
+ params));
return new_contents;
}
@@ -2323,10 +2322,7 @@
void WebContentsImpl::OnBrowserPluginCreateGuest(
int instance_id,
- const std::string& storage_partition_id,
- bool persist_storage,
- bool focused,
- bool visible) {
+ const BrowserPluginHostMsg_CreateGuest_Params& params) {
// This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin
// specific messages for this WebContents (through its
// BrowserPluginEmbedderHelper). This means that any message from browser
@@ -2344,10 +2340,7 @@
BrowserPluginEmbedder::Create(this, GetRenderViewHost()));
browser_plugin_embedder_->CreateGuest(GetRenderViewHost(),
instance_id,
- storage_partition_id,
- persist_storage,
- focused,
- visible);
+ params);
}
// Notifies the RenderWidgetHost instance about the fact that the page is