OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/views/frame/contents_web_view.h" | 5 #include "chrome/browser/ui/views/frame/contents_web_view.h" |
6 | 6 |
7 #include "chrome/browser/themes/theme_properties.h" | 7 #include "chrome/browser/themes/theme_properties.h" |
8 #include "chrome/browser/ui/views/status_bubble_views.h" | 8 #include "chrome/browser/ui/views/status_bubble_views.h" |
9 #include "content/public/browser/render_frame_host.h" | |
9 #include "content/public/browser/render_widget_host_view.h" | 10 #include "content/public/browser/render_widget_host_view.h" |
10 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
11 #include "ui/base/theme_provider.h" | 12 #include "ui/base/theme_provider.h" |
12 #include "ui/compositor/layer_tree_owner.h" | 13 #include "ui/compositor/layer_tree_owner.h" |
13 #include "ui/views/background.h" | 14 #include "ui/views/background.h" |
14 | 15 |
15 #if defined(USE_AURA) | 16 #if defined(USE_AURA) |
16 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
17 #include "ui/wm/core/window_util.h" | 18 #include "ui/wm/core/window_util.h" |
18 #endif | 19 #endif |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 cloned_layer_tree_.reset(); | 123 cloned_layer_tree_.reset(); |
123 SetPaintToLayer(false); | 124 SetPaintToLayer(false); |
124 set_layer_owner_delegate(nullptr); | 125 set_layer_owner_delegate(nullptr); |
125 } | 126 } |
126 | 127 |
127 void ContentsWebView::RenderViewReady() { | 128 void ContentsWebView::RenderViewReady() { |
128 // Apply the theme color to be the default background on startup. | 129 // Apply the theme color to be the default background on startup. |
129 OnThemeChanged(); | 130 OnThemeChanged(); |
130 WebView::RenderViewReady(); | 131 WebView::RenderViewReady(); |
131 } | 132 } |
133 | |
134 void ContentsWebView::RenderFrameHostChanged( | |
135 content::RenderFrameHost* old_host, content::RenderFrameHost* new_host) { | |
136 // Pass the background color of the old host to the new one. This passes | |
137 // on the page background color of the old host (or the theme color if the | |
138 // page background color is not set). This avoids flashes of white when | |
139 // starting up new_host. | |
140 if (old_host && new_host) | |
sky
2016/05/04 20:39:09
If this is the right change, can't we do it entire
chrishtr
2016/05/04 21:10:18
I'm not sure what you mean. What do you mean by "i
sky
2016/05/04 21:48:06
Content knows when the renderframehost is changing
chrishtr
2016/05/04 23:07:16
Done (hope I understood your suggestion).
Should
| |
141 new_host->GetView()->SetBackgroundColor( | |
142 old_host->GetView()->background_color()); | |
143 WebView::RenderFrameHostChanged(old_host, new_host); | |
144 } | |
OLD | NEW |