| 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 4072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4083 observer.RenderViewHostChanged(old_host, new_host); | 4083 observer.RenderViewHostChanged(old_host, new_host); |
| 4084 | 4084 |
| 4085 // Ensure that the associated embedder gets cleared after a RenderViewHost | 4085 // Ensure that the associated embedder gets cleared after a RenderViewHost |
| 4086 // gets swapped, so we don't reuse the same embedder next time a | 4086 // gets swapped, so we don't reuse the same embedder next time a |
| 4087 // RenderViewHost is attached to this WebContents. | 4087 // RenderViewHost is attached to this WebContents. |
| 4088 RemoveBrowserPluginEmbedder(); | 4088 RemoveBrowserPluginEmbedder(); |
| 4089 } | 4089 } |
| 4090 | 4090 |
| 4091 void WebContentsImpl::NotifyFrameSwapped(RenderFrameHost* old_host, | 4091 void WebContentsImpl::NotifyFrameSwapped(RenderFrameHost* old_host, |
| 4092 RenderFrameHost* new_host) { | 4092 RenderFrameHost* new_host) { |
| 4093 // Copies the background color from an old WebContents to a new one that | |
| 4094 // replaces it on the screen. This allows the new WebContents to use the | |
| 4095 // old one's background color as the starting background color, before having | |
| 4096 // loaded any contents. As a result, we avoid flashing white when navigating | |
| 4097 // from a site whith a dark background to another site with a dark background. | |
| 4098 if (old_host && new_host) { | |
| 4099 RenderWidgetHostView* old_view = old_host->GetView(); | |
| 4100 RenderWidgetHostView* new_view = new_host->GetView(); | |
| 4101 if (old_view && new_view) | |
| 4102 new_view->SetBackgroundColor(old_view->background_color()); | |
| 4103 } | |
| 4104 | |
| 4105 for (auto& observer : observers_) | 4093 for (auto& observer : observers_) |
| 4106 observer.RenderFrameHostChanged(old_host, new_host); | 4094 observer.RenderFrameHostChanged(old_host, new_host); |
| 4107 } | 4095 } |
| 4108 | 4096 |
| 4109 // TODO(avi): Remove this entire function because this notification is already | 4097 // TODO(avi): Remove this entire function because this notification is already |
| 4110 // covered by two observer functions. http://crbug.com/170921 | 4098 // covered by two observer functions. http://crbug.com/170921 |
| 4111 void WebContentsImpl::NotifyDisconnected() { | 4099 void WebContentsImpl::NotifyDisconnected() { |
| 4112 if (!notify_disconnection_) | 4100 if (!notify_disconnection_) |
| 4113 return; | 4101 return; |
| 4114 | 4102 |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5413 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5401 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
| 5414 if (!render_view_host) | 5402 if (!render_view_host) |
| 5415 continue; | 5403 continue; |
| 5416 render_view_host_set.insert(render_view_host); | 5404 render_view_host_set.insert(render_view_host); |
| 5417 } | 5405 } |
| 5418 for (RenderViewHost* render_view_host : render_view_host_set) | 5406 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5419 render_view_host->OnWebkitPreferencesChanged(); | 5407 render_view_host->OnWebkitPreferencesChanged(); |
| 5420 } | 5408 } |
| 5421 | 5409 |
| 5422 } // namespace content | 5410 } // namespace content |
| OLD | NEW |