| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // In MD, we have to not color the top 1dp, because that should be painted by | 217 // In MD, we have to not color the top 1dp, because that should be painted by |
| 218 // the toolbar. We will, however, paint the 1px separator at the bottom of the | 218 // the toolbar. We will, however, paint the 1px separator at the bottom of the |
| 219 // first dp. See crbug.com/610359 | 219 // first dp. See crbug.com/610359 |
| 220 if (ui::MaterialDesignController::IsModeMaterial()) | 220 if (ui::MaterialDesignController::IsModeMaterial()) |
| 221 fill_rect.Inset(0, 1, 0, 0); | 221 fill_rect.Inset(0, 1, 0, 0); |
| 222 | 222 |
| 223 // In detached mode, the bar is meant to overlap with |contents_container_|. | 223 // In detached mode, the bar is meant to overlap with |contents_container_|. |
| 224 // The detached background color may be partially transparent, but the layer | 224 // The detached background color may be partially transparent, but the layer |
| 225 // for |view| must be painted opaquely to avoid subpixel anti-aliasing | 225 // for |view| must be painted opaquely to avoid subpixel anti-aliasing |
| 226 // artifacts, so we recreate the contents container base color here. | 226 // artifacts, so we recreate the contents container base color here. |
| 227 canvas->FillRect(fill_rect, | |
| 228 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND)); | |
| 229 canvas->FillRect( | 227 canvas->FillRect( |
| 230 fill_rect, | 228 fill_rect, |
| 231 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND)); | 229 SkColorSetA(tp->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND), |
| 230 SK_AlphaOPAQUE)); |
| 232 | 231 |
| 233 // Draw the separators above and below bookmark bar; | 232 // Draw the separators above and below bookmark bar; |
| 234 // if animating, these are fading in/out. | 233 // if animating, these are fading in/out. |
| 235 SkColor separator_color = | 234 SkColor separator_color = |
| 236 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); | 235 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); |
| 237 | 236 |
| 238 if (ui::MaterialDesignController::IsModeMaterial()) { | 237 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 239 BrowserView::Paint1pxHorizontalLine( | 238 BrowserView::Paint1pxHorizontalLine( |
| 240 canvas, separator_color, | 239 canvas, separator_color, |
| 241 gfx::Rect(0, 0, view->width(), | 240 gfx::Rect(0, 0, view->width(), |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 | 2061 |
| 2063 web_contents_close_handler_.reset( | 2062 web_contents_close_handler_.reset( |
| 2064 new WebContentsCloseHandler(contents_web_view_)); | 2063 new WebContentsCloseHandler(contents_web_view_)); |
| 2065 | 2064 |
| 2066 devtools_web_view_ = new views::WebView(browser_->profile()); | 2065 devtools_web_view_ = new views::WebView(browser_->profile()); |
| 2067 devtools_web_view_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); | 2066 devtools_web_view_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); |
| 2068 devtools_web_view_->SetVisible(false); | 2067 devtools_web_view_->SetVisible(false); |
| 2069 | 2068 |
| 2070 contents_container_ = new views::View(); | 2069 contents_container_ = new views::View(); |
| 2071 contents_container_->set_background(views::Background::CreateSolidBackground( | 2070 contents_container_->set_background(views::Background::CreateSolidBackground( |
| 2072 GetThemeProvider()->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND))); | 2071 GetThemeProvider()->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND))); |
| 2073 contents_container_->AddChildView(devtools_web_view_); | 2072 contents_container_->AddChildView(devtools_web_view_); |
| 2074 contents_container_->AddChildView(contents_web_view_); | 2073 contents_container_->AddChildView(contents_web_view_); |
| 2075 contents_container_->SetLayoutManager(new ContentsLayoutManager( | 2074 contents_container_->SetLayoutManager(new ContentsLayoutManager( |
| 2076 devtools_web_view_, contents_web_view_)); | 2075 devtools_web_view_, contents_web_view_)); |
| 2077 AddChildView(contents_container_); | 2076 AddChildView(contents_container_); |
| 2078 set_contents_view(contents_container_); | 2077 set_contents_view(contents_container_); |
| 2079 | 2078 |
| 2080 // Top container holds tab strip and toolbar and lives at the front of the | 2079 // Top container holds tab strip and toolbar and lives at the front of the |
| 2081 // view hierarchy. | 2080 // view hierarchy. |
| 2082 top_container_ = new TopContainerView(this); | 2081 top_container_ = new TopContainerView(this); |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2653 } | 2652 } |
| 2654 | 2653 |
| 2655 extensions::ActiveTabPermissionGranter* | 2654 extensions::ActiveTabPermissionGranter* |
| 2656 BrowserView::GetActiveTabPermissionGranter() { | 2655 BrowserView::GetActiveTabPermissionGranter() { |
| 2657 content::WebContents* web_contents = GetActiveWebContents(); | 2656 content::WebContents* web_contents = GetActiveWebContents(); |
| 2658 if (!web_contents) | 2657 if (!web_contents) |
| 2659 return nullptr; | 2658 return nullptr; |
| 2660 return extensions::TabHelper::FromWebContents(web_contents) | 2659 return extensions::TabHelper::FromWebContents(web_contents) |
| 2661 ->active_tab_permission_granter(); | 2660 ->active_tab_permission_granter(); |
| 2662 } | 2661 } |
| OLD | NEW |