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

Side by Side Diff: chrome/browser/ui/browser.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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 return size; 1844 return size;
1845 } 1845 }
1846 1846
1847 /////////////////////////////////////////////////////////////////////////////// 1847 ///////////////////////////////////////////////////////////////////////////////
1848 // Browser, CoreTabHelperDelegate implementation: 1848 // Browser, CoreTabHelperDelegate implementation:
1849 1849
1850 void Browser::SwapTabContents(content::WebContents* old_contents, 1850 void Browser::SwapTabContents(content::WebContents* old_contents,
1851 content::WebContents* new_contents, 1851 content::WebContents* new_contents,
1852 bool did_start_load, 1852 bool did_start_load,
1853 bool did_finish_load) { 1853 bool did_finish_load) {
1854 // Copies the background color from an old WebContents to a new one that
1855 // replaces it on the screen. This allows the new WebContents to use the
1856 // old one's background color as the starting background color, before having
1857 // loaded any contents. As a result, we avoid flashing white when navigating
1858 // from a site whith a dark background to another site with a dark background.
1859 if (old_contents && new_contents) {
1860 RenderWidgetHostView* old_view = old_contents->GetMainFrame()->GetView();
1861 RenderWidgetHostView* new_view = new_contents->GetMainFrame()->GetView();
1862 if (old_view && new_view)
1863 new_view->SetBackgroundColor(old_view->background_color());
1864 }
1865
1854 int index = tab_strip_model_->GetIndexOfWebContents(old_contents); 1866 int index = tab_strip_model_->GetIndexOfWebContents(old_contents);
1855 DCHECK_NE(TabStripModel::kNoTab, index); 1867 DCHECK_NE(TabStripModel::kNoTab, index);
1856 tab_strip_model_->ReplaceWebContentsAt(index, new_contents); 1868 tab_strip_model_->ReplaceWebContentsAt(index, new_contents);
1857 } 1869 }
1858 1870
1859 bool Browser::CanReloadContents(content::WebContents* web_contents) const { 1871 bool Browser::CanReloadContents(content::WebContents* web_contents) const {
1860 return chrome::CanReload(this); 1872 return chrome::CanReload(this);
1861 } 1873 }
1862 1874
1863 bool Browser::CanSaveContents(content::WebContents* web_contents) const { 1875 bool Browser::CanSaveContents(content::WebContents* web_contents) const {
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 if (contents && !allow_js_access) { 2595 if (contents && !allow_js_access) {
2584 contents->web_contents()->GetController().LoadURL( 2596 contents->web_contents()->GetController().LoadURL(
2585 target_url, 2597 target_url,
2586 content::Referrer(), 2598 content::Referrer(),
2587 ui::PAGE_TRANSITION_LINK, 2599 ui::PAGE_TRANSITION_LINK,
2588 std::string()); // No extra headers. 2600 std::string()); // No extra headers.
2589 } 2601 }
2590 2602
2591 return contents != NULL; 2603 return contents != NULL;
2592 } 2604 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698