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_, |