Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1147)

Unified Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 10868012: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master-trial-obrowser
Patch Set: Rework tests to use timeouts instead of waiting indefinitely, not store any Guest* in embedder. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/browser_plugin/browser_plugin.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 8ba5421f33aa700fe63e733024d9a5185ed74684..c816c0e2d3eb374f48497de047dd863288688cf1 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -54,6 +54,7 @@ BrowserPlugin::BrowserPlugin(
sad_guest_(NULL),
guest_crashed_(false),
resize_pending_(false),
+ navigate_src_sent_(false),
parent_frame_(frame->identifier()) {
BrowserPluginManager::Get()->AddBrowserPlugin(instance_id, this);
bindings_.reset(new BrowserPluginBindings(this));
@@ -90,13 +91,21 @@ std::string BrowserPlugin::GetSrcAttribute() const {
void BrowserPlugin::SetSrcAttribute(const std::string& src) {
if (src == src_ && !guest_crashed_)
return;
- if (!src.empty()) {
+ if (!src.empty() || navigate_src_sent_) {
BrowserPluginManager::Get()->Send(
- new BrowserPluginHostMsg_NavigateOrCreateGuest(
+ new BrowserPluginHostMsg_NavigateGuest(
render_view_->GetRoutingID(),
instance_id_,
parent_frame_,
- src));
+ src,
+ gfx::Size(width(), height())));
+ // Record that we sent a NavigateGuest message to embedder. Once we send
+ // such a message, subsequent SetSrcAttribute() calls must always send
+ // NavigateGuest messages to the embedder (even if |src| is empty), so
+ // resize works correctly for all cases (e.g. The embedder can reset the
+ // guest's |src| to empty value, resize and then set the |src| to a
+ // non-empty value).
+ navigate_src_sent_ = true;
}
src_ = src;
guest_crashed_ = false;
@@ -327,7 +336,13 @@ void BrowserPlugin::updateGeometry(
int old_height = height();
plugin_rect_ = window_rect;
if (old_width == window_rect.width &&
- old_height == window_rect.height)
+ old_height == window_rect.height) {
+ return;
+ }
+ // Until an actual navigation occurs, there is no browser side embedder
+ // present to notify about geometry updates. In this case, after we've updated
+ // the BrowserPlugin's state we are done and can return immediately.
+ if (src_.empty() && !navigate_src_sent_)
return;
const size_t stride = skia::PlatformCanvas::StrideForWidth(window_rect.width);

Powered by Google App Engine
This is Rietveld 408576698