Chromium Code Reviews| 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 6749aafe832138b29352a637eb1107f508b56817..b4046682eace1da751df6efae1ba3daa9f9c14cc 100644 |
| --- a/content/browser/web_contents/web_contents_impl.cc |
| +++ b/content/browser/web_contents/web_contents_impl.cc |
| @@ -4082,20 +4082,23 @@ void WebContentsImpl::NotifyViewSwapped(RenderViewHost* old_host, |
| void WebContentsImpl::NotifyFrameSwapped(RenderFrameHost* old_host, |
| RenderFrameHost* new_host) { |
| - // Copies the background color from an old WebContents to a new one that |
| - // replaces it on the screen. This allows the new WebContents to use the |
| + for (auto& observer : observers_) |
| + observer.RenderFrameHostChanged(old_host, new_host); |
| +} |
| + |
| +void WebContentsImpl::NotifyInitialBackground(SkColor old_background, |
| + RenderFrameHost* new_host) { |
| + // This code copies the background color from an old WebContents to a new one |
| + // that replaces it on the screen. This allows the new WebContents to use the |
| // old one's background color as the starting background color, before having |
| // loaded any contents. As a result, we avoid flashing white when navigating |
| // from a site whith a dark background to another site with a dark background. |
| - if (old_host && new_host) { |
| - RenderWidgetHostView* old_view = old_host->GetView(); |
| + if (new_host) { |
| RenderWidgetHostView* new_view = new_host->GetView(); |
| - if (old_view && new_view) |
| - new_view->SetBackgroundColor(old_view->background_color()); |
| + if (new_view) { |
|
nasko
2017/03/08 22:54:20
nit: No need for {} on one line if statements.
|
| + new_view->SetBackgroundColor(old_background); |
| + } |
| } |
| - |
| - for (auto& observer : observers_) |
| - observer.RenderFrameHostChanged(old_host, new_host); |
| } |
| // TODO(avi): Remove this entire function because this notification is already |