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

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

Issue 13467038: Browser Plugin: Expose frame name changes to the content API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 7 years, 8 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 83b6292c9f19fc0ef94a63a25312656bd1ae256a..84092c8691f0fc3feca1c6033c054e71d8285478 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -207,7 +207,7 @@ void BrowserPluginGuest::Initialize(
focused_ = params.focused;
guest_visible_ = params.visible;
if (!params.name.empty())
- name_ = params.name;
+ GetWebContents()->SetWindowName(params.name);
Charlie Reis 2013/04/18 21:26:51 Why is this needed? Won't the RenderView tell the
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;
@@ -373,7 +373,7 @@ void BrowserPluginGuest::WebContentsCreated(WebContents* source_contents,
static_cast<WebContentsImpl*>(new_contents);
BrowserPluginGuest* guest = new_contents_impl->GetBrowserPluginGuest();
guest->opener_ = this;
- guest->name_ = UTF16ToUTF8(frame_name);
+ new_contents_impl->SetWindowName(UTF16ToUTF8(frame_name));
Charlie Reis 2013/04/18 21:26:51 Again, won't RenderView tell us?
// Take ownership of the new guest until it is attached to the embedder's DOM
// tree to avoid leaking a guest if this guest is destroyed before attaching
// the new guest.
@@ -616,6 +616,16 @@ void BrowserPluginGuest::DidStopLoading(RenderViewHost* render_view_host) {
SendMessageToEmbedder(new BrowserPluginMsg_LoadStop(instance_id()));
}
+void BrowserPluginGuest::DidUpdateFrameName(int frame_id,
+ bool is_top_level,
+ const std::string& name,
+ RenderViewHost* render_view_host) {
+ if (!is_top_level)
+ return;
+
+ SendMessageToEmbedder(new BrowserPluginMsg_UpdatedName(instance_id_, name));
+}
+
void BrowserPluginGuest::RenderViewReady() {
// TODO(fsamuel): Investigate whether it's possible to update state earlier
// here (see http://crbug.com/158151).
@@ -627,8 +637,6 @@ void BrowserPluginGuest::RenderViewReady() {
else
rvh->DisableAutoResize(damage_view_size_);
- Send(new ViewMsg_SetName(routing_id(), name_));
-
RenderWidgetHostImpl::From(rvh)->
set_hung_renderer_delay_ms(guest_hang_timeout_);
}
@@ -713,7 +721,6 @@ bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus)
IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse)
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()
@@ -742,7 +749,7 @@ void BrowserPluginGuest::Attach(
// The guest's frame name takes precedence over the BrowserPlugin's name.
// The guest's frame name is assigned in
// BrowserPluginGuest::WebContentsCreated.
- if (!name_.empty())
+ if (!GetWebContents()->GetWindowName().empty())
params.name.clear();
Initialize(embedder_web_contents, params);
@@ -763,7 +770,7 @@ void BrowserPluginGuest::Attach(
ack_params.storage_partition_id = site_url.query();
ack_params.persist_storage =
site_url.path().find("persist") != std::string::npos;
- ack_params.name = name_;
+ ack_params.name = GetWebContents()->GetWindowName();
SendMessageToEmbedder(
new BrowserPluginMsg_Attach_ACK(instance_id_, ack_params));
}
@@ -955,10 +962,7 @@ void BrowserPluginGuest::OnSetFocus(int instance_id, bool focused) {
}
void BrowserPluginGuest::OnSetName(int instance_id, const std::string& name) {
- if (name == name_)
- return;
- name_ = name;
- Send(new ViewMsg_SetName(routing_id(), name));
+ GetWebContents()->SetWindowName(name);
Charlie Reis 2013/04/18 21:26:51 Again, why is this needed? If we change the name
}
void BrowserPluginGuest::OnSetSize(
@@ -1123,16 +1127,6 @@ 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(instance_id_, name));
-}
-
void BrowserPluginGuest::RequestMediaAccessPermission(
WebContents* web_contents,
const MediaStreamRequest& request,

Powered by Google App Engine
This is Rietveld 408576698