Chromium Code Reviews| Index: content/browser/browser_plugin/browser_plugin_guest.cc |
| diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc |
| index 9ec55592207f3624e554ec8f804c221c846c8f06..c41446607220d268da9b86027c275a96e849a0c4 100644 |
| --- a/content/browser/browser_plugin/browser_plugin_guest.cc |
| +++ b/content/browser/browser_plugin/browser_plugin_guest.cc |
| @@ -58,6 +58,7 @@ BrowserPluginGuest::BrowserPluginGuest( |
| base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), |
| focused_(params.focused), |
| visible_(params.visible), |
| + name_(params.name), |
| auto_size_enabled_(params.auto_size_params.enable), |
| max_auto_size_(params.auto_size_params.max_size), |
| min_auto_size_(params.auto_size_params.min_size) { |
| @@ -74,6 +75,28 @@ void BrowserPluginGuest::InstallHelper( |
| content::Source<content::WebContents>(web_contents())); |
| } |
| +void BrowserPluginGuest::SetName(const std::string& name) { |
| + if (name == name_) |
| + return; |
| + name_ = name; |
| + web_contents()->GetRenderViewHost()->Send(new ViewMsg_SetName( |
| + web_contents()->GetRenderViewHost()->GetRoutingID(), |
| + name)); |
|
Charlie Reis
2012/12/13 01:11:42
nit: This last arg can go on previous line, which
Fady Samuel
2012/12/13 17:46:45
Done.
|
| +} |
| + |
| +void BrowserPluginGuest::UpdateFrameName(int frame_id, |
| + bool is_top_level, |
| + const std::string& name) { |
| + if (!is_top_level) |
| + return; |
| + |
| + name_ = name; |
| + SendMessageToEmbedder(new BrowserPluginMsg_UpdatedName( |
| + embedder_routing_id(), |
| + instance_id_, |
| + name)); |
| +} |
| + |
| BrowserPluginGuest::~BrowserPluginGuest() { |
| } |
| @@ -547,6 +570,8 @@ void BrowserPluginGuest::DidStartProvisionalLoadForFrame( |
| const GURL& validated_url, |
| bool is_error_page, |
| RenderViewHost* render_view_host) { |
| + // Reset the guest name if we are loading a new main frame. |
| + UpdateFrameName(frame_id, is_main_frame, ""); |
|
Charlie Reis
2012/12/13 01:11:42
Though I wish the web platform worked this way, it
Fady Samuel
2012/12/13 17:46:45
Removed, thanks.
|
| // Inform the embedder of the loadStart. |
| SendMessageToEmbedder( |
| new BrowserPluginMsg_LoadStart(embedder_routing_id(), |
| @@ -626,6 +651,10 @@ void BrowserPluginGuest::RenderViewReady() { |
| } else { |
| web_contents()->GetRenderViewHost()->DisableAutoResize(damage_view_size_); |
| } |
| + |
| + web_contents()->GetRenderViewHost()->Send(new ViewMsg_SetName( |
|
Charlie Reis
2012/12/13 01:11:42
We should cache the RVH in a local variable, since
Fady Samuel
2012/12/13 17:46:45
Done.
|
| + web_contents()->GetRenderViewHost()->GetRoutingID(), |
| + name_)); |
| } |
| void BrowserPluginGuest::RenderViewGone(base::TerminationStatus status) { |