| 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/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "ui/base/theme_provider.h" | 10 #include "ui/base/theme_provider.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 void ContentsWebView::OnThemeChanged() { | 50 void ContentsWebView::OnThemeChanged() { |
| 51 const ui::ThemeProvider* const theme = GetThemeProvider(); | 51 const ui::ThemeProvider* const theme = GetThemeProvider(); |
| 52 if (!theme) | 52 if (!theme) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 // Set the background color to a dark tint of the new tab page's background | 55 // Set the background color to a dark tint of the new tab page's background |
| 56 // color. This is the color filled within the WebView's bounds when its child | 56 // color. This is the color filled within the WebView's bounds when its child |
| 57 // view is sized specially for fullscreen tab capture. See WebView header | 57 // view is sized specially for fullscreen tab capture. See WebView header |
| 58 // file comments for more details. | 58 // file comments for more details. |
| 59 // TODO(ericrk): This color causes ugly guttering when the window is resized, |
| 60 // investigate changing color to match window color. May need to special case |
| 61 // tab capture to not break the behavior described above. crbug.com/568317 |
| 59 const int kBackgroundBrightness = 0x33; // 20% | 62 const int kBackgroundBrightness = 0x33; // 20% |
| 60 const SkColor ntp_background = | 63 const SkColor ntp_background = |
| 61 theme->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND); | 64 theme->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND); |
| 62 set_background(views::Background::CreateSolidBackground( | 65 set_background(views::Background::CreateSolidBackground( |
| 63 SkColorGetR(ntp_background) * kBackgroundBrightness / 0xFF, | 66 SkColorGetR(ntp_background) * kBackgroundBrightness / 0xFF, |
| 64 SkColorGetG(ntp_background) * kBackgroundBrightness / 0xFF, | 67 SkColorGetG(ntp_background) * kBackgroundBrightness / 0xFF, |
| 65 SkColorGetB(ntp_background) * kBackgroundBrightness / 0xFF, | 68 SkColorGetB(ntp_background) * kBackgroundBrightness / 0xFF, |
| 66 SkColorGetA(ntp_background))); | 69 SkColorGetA(ntp_background))); |
| 67 } | 70 } |
| 68 | 71 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 cloned_layer_tree_->root()->SetBounds( | 110 cloned_layer_tree_->root()->SetBounds( |
| 108 gfx::Rect(origin, cloned_layer_tree_->root()->bounds().size())); | 111 gfx::Rect(origin, cloned_layer_tree_->root()->bounds().size())); |
| 109 layer()->Add(cloned_layer_tree_->root()); | 112 layer()->Add(cloned_layer_tree_->root()); |
| 110 } | 113 } |
| 111 | 114 |
| 112 void ContentsWebView::DestroyClonedLayer() { | 115 void ContentsWebView::DestroyClonedLayer() { |
| 113 cloned_layer_tree_.reset(); | 116 cloned_layer_tree_.reset(); |
| 114 SetPaintToLayer(false); | 117 SetPaintToLayer(false); |
| 115 set_layer_owner_delegate(nullptr); | 118 set_layer_owner_delegate(nullptr); |
| 116 } | 119 } |
| OLD | NEW |