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

Unified Diff: content/browser/web_contents/web_contents_impl.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/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index b3dc3fad4d9607386ca011ad5bf4d6254ef0adbf..a3193eba8d55b4cb1ed0a054bf8af13fdd2ce7f8 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -838,6 +838,20 @@ const std::string& WebContentsImpl::GetUserAgentOverride() const {
return renderer_preferences_.user_agent_override;
}
+void WebContentsImpl::SetWindowName(const std::string& name) {
+ if (window_name_ == name)
+ return;
+
+ window_name_ = name;
+ RenderViewHost* rvh = GetRenderViewHost();
+ if (rvh)
+ rvh->SetWindowName(name);
+}
+
+const std::string& WebContentsImpl::GetWindowName() const {
+ return window_name_;
+}
+
const string16& WebContentsImpl::GetTitle() const {
// Transient entries take precedence. They are used for interstitial pages
// that are shown on top of existing pages.
@@ -2634,6 +2648,9 @@ void WebContentsImpl::RenderViewReady(RenderViewHost* rvh) {
view_->Focus();
}
+ if (!window_name_.empty())
+ rvh->SetWindowName(window_name_);
+
FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewReady());
}
@@ -2903,6 +2920,19 @@ void WebContentsImpl::DidUpdateFrameTree(RenderViewHost* rvh) {
render_manager_.DidUpdateFrameTree(rvh);
}
+void WebContentsImpl::DidUpdateFrameName(RenderViewHost* rvh,
+ int frame_id,
+ bool is_top_level,
+ const std::string& name) {
+ if (is_top_level)
+ window_name_ = name;
+ FOR_EACH_OBSERVER(WebContentsObserver, observers_,
+ DidUpdateFrameName(frame_id,
+ is_top_level,
+ name,
+ rvh));
+}
+
void WebContentsImpl::DocumentAvailableInMainFrame(
RenderViewHost* render_view_host) {
FOR_EACH_OBSERVER(WebContentsObserver, observers_,

Powered by Google App Engine
This is Rietveld 408576698