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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 const int kBackgroundBrightness = 0x33; // 20% | 59 const int kBackgroundBrightness = 0x33; // 20% |
60 // FIXME: Clear alpha only upon a call to | |
61 // content::RenderWidgetHostView->SetBackgroundColor(SK_ColorTRANSPARENT). | |
60 const SkColor ntp_background = | 62 const SkColor ntp_background = |
61 theme->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND); | 63 theme->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND) & 0x00FFFFFF; |
trchen
2016/02/25 02:30:12
ditto.
Julien Isorce Samsung
2016/02/25 11:33:55
Same
| |
62 set_background(views::Background::CreateSolidBackground( | 64 set_background(views::Background::CreateSolidBackground( |
63 SkColorGetR(ntp_background) * kBackgroundBrightness / 0xFF, | 65 SkColorGetR(ntp_background) * kBackgroundBrightness / 0xFF, |
64 SkColorGetG(ntp_background) * kBackgroundBrightness / 0xFF, | 66 SkColorGetG(ntp_background) * kBackgroundBrightness / 0xFF, |
65 SkColorGetB(ntp_background) * kBackgroundBrightness / 0xFF, | 67 SkColorGetB(ntp_background) * kBackgroundBrightness / 0xFF, |
66 SkColorGetA(ntp_background))); | 68 SkColorGetA(ntp_background))); |
67 } | 69 } |
68 | 70 |
69 void ContentsWebView::OnLayerRecreated(ui::Layer* old_layer, | 71 void ContentsWebView::OnLayerRecreated(ui::Layer* old_layer, |
70 ui::Layer* new_layer) { | 72 ui::Layer* new_layer) { |
71 if (!cloned_layer_tree_) | 73 if (!cloned_layer_tree_) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 cloned_layer_tree_->root()->SetBounds( | 109 cloned_layer_tree_->root()->SetBounds( |
108 gfx::Rect(origin, cloned_layer_tree_->root()->bounds().size())); | 110 gfx::Rect(origin, cloned_layer_tree_->root()->bounds().size())); |
109 layer()->Add(cloned_layer_tree_->root()); | 111 layer()->Add(cloned_layer_tree_->root()); |
110 } | 112 } |
111 | 113 |
112 void ContentsWebView::DestroyClonedLayer() { | 114 void ContentsWebView::DestroyClonedLayer() { |
113 cloned_layer_tree_.reset(); | 115 cloned_layer_tree_.reset(); |
114 SetPaintToLayer(false); | 116 SetPaintToLayer(false); |
115 set_layer_owner_delegate(nullptr); | 117 set_layer_owner_delegate(nullptr); |
116 } | 118 } |
OLD | NEW |