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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2466413009: Propagate view background color when changing visible web contents. (Closed)
Patch Set: none Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 3968 matching lines...) Expand 10 before | Expand all | Expand 10 after
3979 observer.RenderViewHostChanged(old_host, new_host); 3979 observer.RenderViewHostChanged(old_host, new_host);
3980 3980
3981 // Ensure that the associated embedder gets cleared after a RenderViewHost 3981 // Ensure that the associated embedder gets cleared after a RenderViewHost
3982 // gets swapped, so we don't reuse the same embedder next time a 3982 // gets swapped, so we don't reuse the same embedder next time a
3983 // RenderViewHost is attached to this WebContents. 3983 // RenderViewHost is attached to this WebContents.
3984 RemoveBrowserPluginEmbedder(); 3984 RemoveBrowserPluginEmbedder();
3985 } 3985 }
3986 3986
3987 void WebContentsImpl::NotifyFrameSwapped(RenderFrameHost* old_host, 3987 void WebContentsImpl::NotifyFrameSwapped(RenderFrameHost* old_host,
3988 RenderFrameHost* new_host) { 3988 RenderFrameHost* new_host) {
3989 // Copies the background color from an old WebContents to a new one that
3990 // replaces it on the screen. This allows the new WebContents to use the
3991 // old one's background color as the starting background color, before having
3992 // loaded any contents. As a result, we avoid flashing white when navigating
3993 // from a site whith a dark background to another site with a dark background.
3994 if (old_host && new_host) {
3995 RenderWidgetHostView* old_view = old_host->GetView();
3996 RenderWidgetHostView* new_view = new_host->GetView();
3997 if (old_view && new_view)
3998 new_view->SetBackgroundColor(old_view->background_color());
3999 }
4000
3989 for (auto& observer : observers_) 4001 for (auto& observer : observers_)
3990 observer.RenderFrameHostChanged(old_host, new_host); 4002 observer.RenderFrameHostChanged(old_host, new_host);
3991 } 4003 }
3992 4004
3993 // TODO(avi): Remove this entire function because this notification is already 4005 // TODO(avi): Remove this entire function because this notification is already
3994 // covered by two observer functions. http://crbug.com/170921 4006 // covered by two observer functions. http://crbug.com/170921
3995 void WebContentsImpl::NotifyDisconnected() { 4007 void WebContentsImpl::NotifyDisconnected() {
3996 if (!notify_disconnection_) 4008 if (!notify_disconnection_)
3997 return; 4009 return;
3998 4010
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
5198 dialog_manager_ = dialog_manager; 5210 dialog_manager_ = dialog_manager;
5199 } 5211 }
5200 5212
5201 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { 5213 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5202 auto it = binding_sets_.find(interface_name); 5214 auto it = binding_sets_.find(interface_name);
5203 if (it != binding_sets_.end()) 5215 if (it != binding_sets_.end())
5204 binding_sets_.erase(it); 5216 binding_sets_.erase(it);
5205 } 5217 }
5206 5218
5207 } // namespace content 5219 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_base.cc ('k') | content/public/browser/render_widget_host_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698