OLD | NEW |
---|---|
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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 BookmarkBarView* view) { | 215 BookmarkBarView* view) { |
216 // Paint background for detached state; if animating, this is fade in/out. | 216 // Paint background for detached state; if animating, this is fade in/out. |
217 const ui::ThemeProvider* tp = view->GetThemeProvider(); | 217 const ui::ThemeProvider* tp = view->GetThemeProvider(); |
218 gfx::Rect fill_rect = view->GetLocalBounds(); | 218 gfx::Rect fill_rect = view->GetLocalBounds(); |
219 // In MD, we have to not color the top 1dp, because that should be painted by | 219 // In MD, we have to not color the top 1dp, because that should be painted by |
220 // the toolbar. We will, however, paint the 1px separator at the bottom of the | 220 // the toolbar. We will, however, paint the 1px separator at the bottom of the |
221 // first dp. See crbug.com/610359 | 221 // first dp. See crbug.com/610359 |
222 if (ui::MaterialDesignController::IsModeMaterial()) | 222 if (ui::MaterialDesignController::IsModeMaterial()) |
223 fill_rect.Inset(0, 1, 0, 0); | 223 fill_rect.Inset(0, 1, 0, 0); |
224 | 224 |
225 // In detached mode, the bar is meant to overlap with |contents_container_|. | 225 // The detached bar overlaps the |contents_container_| and so uses the same |
226 // The detached background color may be partially transparent, but the layer | 226 // background color (the NTP background color). |
227 // for |view| must be painted opaquely to avoid subpixel anti-aliasing | |
228 // artifacts, so we recreate the contents container base color here. | |
229 canvas->FillRect(fill_rect, | 227 canvas->FillRect(fill_rect, |
230 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND)); | 228 tp->GetColor(tp->HasCustomImage(IDR_THEME_NTP_BACKGROUND) |
231 canvas->FillRect( | 229 ? ThemeProperties::COLOR_TOOLBAR |
232 fill_rect, | 230 : ThemeProperties::COLOR_NTP_BACKGROUND)); |
Julien Isorce Samsung
2016/08/16 16:01:03
It relies on HasCustomImage to avoid regression of
Peter Kasting
2016/08/18 09:12:36
Hmm. There are arguments for both.
I'm inclined
| |
233 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND)); | |
234 | 231 |
235 // Draw the separators above and below bookmark bar; | 232 // Draw the separators above and below bookmark bar; |
236 // if animating, these are fading in/out. | 233 // if animating, these are fading in/out. |
237 SkColor separator_color = | 234 SkColor separator_color = |
238 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); | 235 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); |
239 | 236 |
240 if (ui::MaterialDesignController::IsModeMaterial()) { | 237 if (ui::MaterialDesignController::IsModeMaterial()) { |
241 BrowserView::Paint1pxHorizontalLine( | 238 BrowserView::Paint1pxHorizontalLine( |
242 canvas, separator_color, | 239 canvas, separator_color, |
243 gfx::Rect(0, 0, view->width(), | 240 gfx::Rect(0, 0, view->width(), |
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2067 | 2064 |
2068 web_contents_close_handler_.reset( | 2065 web_contents_close_handler_.reset( |
2069 new WebContentsCloseHandler(contents_web_view_)); | 2066 new WebContentsCloseHandler(contents_web_view_)); |
2070 | 2067 |
2071 devtools_web_view_ = new views::WebView(browser_->profile()); | 2068 devtools_web_view_ = new views::WebView(browser_->profile()); |
2072 devtools_web_view_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); | 2069 devtools_web_view_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); |
2073 devtools_web_view_->SetVisible(false); | 2070 devtools_web_view_->SetVisible(false); |
2074 | 2071 |
2075 contents_container_ = new views::View(); | 2072 contents_container_ = new views::View(); |
2076 contents_container_->set_background(views::Background::CreateSolidBackground( | 2073 contents_container_->set_background(views::Background::CreateSolidBackground( |
2077 GetThemeProvider()->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND))); | 2074 GetThemeProvider()->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND))); |
2078 contents_container_->AddChildView(devtools_web_view_); | 2075 contents_container_->AddChildView(devtools_web_view_); |
2079 contents_container_->AddChildView(contents_web_view_); | 2076 contents_container_->AddChildView(contents_web_view_); |
2080 contents_container_->SetLayoutManager(new ContentsLayoutManager( | 2077 contents_container_->SetLayoutManager(new ContentsLayoutManager( |
2081 devtools_web_view_, contents_web_view_)); | 2078 devtools_web_view_, contents_web_view_)); |
2082 AddChildView(contents_container_); | 2079 AddChildView(contents_container_); |
2083 set_contents_view(contents_container_); | 2080 set_contents_view(contents_container_); |
2084 | 2081 |
2085 // Top container holds tab strip and toolbar and lives at the front of the | 2082 // Top container holds tab strip and toolbar and lives at the front of the |
2086 // view hierarchy. | 2083 // view hierarchy. |
2087 top_container_ = new TopContainerView(this); | 2084 top_container_ = new TopContainerView(this); |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2662 } | 2659 } |
2663 | 2660 |
2664 extensions::ActiveTabPermissionGranter* | 2661 extensions::ActiveTabPermissionGranter* |
2665 BrowserView::GetActiveTabPermissionGranter() { | 2662 BrowserView::GetActiveTabPermissionGranter() { |
2666 content::WebContents* web_contents = GetActiveWebContents(); | 2663 content::WebContents* web_contents = GetActiveWebContents(); |
2667 if (!web_contents) | 2664 if (!web_contents) |
2668 return nullptr; | 2665 return nullptr; |
2669 return extensions::TabHelper::FromWebContents(web_contents) | 2666 return extensions::TabHelper::FromWebContents(web_contents) |
2670 ->active_tab_permission_granter(); | 2667 ->active_tab_permission_granter(); |
2671 } | 2668 } |
OLD | NEW |