OLD | NEW |
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 4055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4066 observer.RenderViewHostChanged(old_host, new_host); | 4066 observer.RenderViewHostChanged(old_host, new_host); |
4067 | 4067 |
4068 // Ensure that the associated embedder gets cleared after a RenderViewHost | 4068 // Ensure that the associated embedder gets cleared after a RenderViewHost |
4069 // gets swapped, so we don't reuse the same embedder next time a | 4069 // gets swapped, so we don't reuse the same embedder next time a |
4070 // RenderViewHost is attached to this WebContents. | 4070 // RenderViewHost is attached to this WebContents. |
4071 RemoveBrowserPluginEmbedder(); | 4071 RemoveBrowserPluginEmbedder(); |
4072 } | 4072 } |
4073 | 4073 |
4074 void WebContentsImpl::NotifyFrameSwapped(RenderFrameHost* old_host, | 4074 void WebContentsImpl::NotifyFrameSwapped(RenderFrameHost* old_host, |
4075 RenderFrameHost* new_host) { | 4075 RenderFrameHost* new_host) { |
4076 // Copies the background color from an old WebContents to a new one that | |
4077 // replaces it on the screen. This allows the new WebContents to use the | |
4078 // old one's background color as the starting background color, before having | |
4079 // loaded any contents. As a result, we avoid flashing white when navigating | |
4080 // from a site whith a dark background to another site with a dark background. | |
4081 if (old_host && new_host) { | |
4082 RenderWidgetHostView* old_view = old_host->GetView(); | |
4083 RenderWidgetHostView* new_view = new_host->GetView(); | |
4084 if (old_view && new_view) | |
4085 new_view->SetBackgroundColor(old_view->background_color()); | |
4086 } | |
4087 | |
4088 for (auto& observer : observers_) | 4076 for (auto& observer : observers_) |
4089 observer.RenderFrameHostChanged(old_host, new_host); | 4077 observer.RenderFrameHostChanged(old_host, new_host); |
4090 } | 4078 } |
4091 | 4079 |
4092 // TODO(avi): Remove this entire function because this notification is already | 4080 // TODO(avi): Remove this entire function because this notification is already |
4093 // covered by two observer functions. http://crbug.com/170921 | 4081 // covered by two observer functions. http://crbug.com/170921 |
4094 void WebContentsImpl::NotifyDisconnected() { | 4082 void WebContentsImpl::NotifyDisconnected() { |
4095 if (!notify_disconnection_) | 4083 if (!notify_disconnection_) |
4096 return; | 4084 return; |
4097 | 4085 |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5431 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5419 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
5432 if (!render_view_host) | 5420 if (!render_view_host) |
5433 continue; | 5421 continue; |
5434 render_view_host_set.insert(render_view_host); | 5422 render_view_host_set.insert(render_view_host); |
5435 } | 5423 } |
5436 for (RenderViewHost* render_view_host : render_view_host_set) | 5424 for (RenderViewHost* render_view_host : render_view_host_set) |
5437 render_view_host->OnWebkitPreferencesChanged(); | 5425 render_view_host->OnWebkitPreferencesChanged(); |
5438 } | 5426 } |
5439 | 5427 |
5440 } // namespace content | 5428 } // namespace content |
OLD | NEW |