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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 11554030: <webview>: Add name attribute (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 7 years, 11 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/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 a5eec106ce460ee0cbea42b2f85fd26e36ff4ff7..8320889152c35b8f1585a7cc6385754c111efed6 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -56,6 +56,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) {
@@ -75,6 +76,7 @@ bool BrowserPluginGuest::OnMessageReceivedFromEmbedder(
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ResizeGuest, OnResizeGuest)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetAutoSize, OnSetSize)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetFocus, OnSetFocus)
+ IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetName, OnSetName)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetVisibility, OnSetVisibility)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_Stop, OnStop)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_TerminateGuest, OnTerminateGuest)
@@ -321,12 +323,13 @@ void BrowserPluginGuest::RenderViewReady() {
// here (see http://crbug.com/158151).
Send(new ViewMsg_SetFocus(routing_id(), focused_));
UpdateVisibility();
- if (auto_size_enabled_) {
- web_contents()->GetRenderViewHost()->EnableAutoResize(
- min_auto_size_, max_auto_size_);
- } else {
- web_contents()->GetRenderViewHost()->DisableAutoResize(damage_view_size_);
- }
+ RenderViewHost* rvh = web_contents()->GetRenderViewHost();
+ if (auto_size_enabled_)
+ rvh->EnableAutoResize(min_auto_size_, max_auto_size_);
+ else
+ rvh->DisableAutoResize(damage_view_size_);
+
+ rvh->Send(new ViewMsg_SetName(rvh->GetRoutingID(), name_));
}
void BrowserPluginGuest::RenderViewGone(base::TerminationStatus status) {
@@ -367,6 +370,7 @@ bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget)
IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus)
IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFrameName, OnUpdateFrameName)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -466,6 +470,15 @@ void BrowserPluginGuest::OnSetFocus(int instance_id, bool focused) {
Send(new ViewMsg_SetFocus(routing_id(), focused));
}
+void BrowserPluginGuest::OnSetName(int instance_id, const std::string& name) {
+ if (name == name_)
+ return;
+ name_ = name;
+ web_contents()->GetRenderViewHost()->Send(new ViewMsg_SetName(
+ web_contents()->GetRenderViewHost()->GetRoutingID(),
+ name));
+}
+
void BrowserPluginGuest::OnSetSize(
int instance_id,
const BrowserPluginHostMsg_AutoSize_Params& auto_size_params,
@@ -607,6 +620,19 @@ void BrowserPluginGuest::OnUpdateDragCursor(
view->UpdateDragCursor(operation);
}
+void BrowserPluginGuest::OnUpdateFrameName(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));
+}
+
void BrowserPluginGuest::OnUpdateRect(
const ViewHostMsg_UpdateRect_Params& params) {
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/browser/browser_plugin/browser_plugin_guest_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698