| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 BookmarkBarView* view) { | 213 BookmarkBarView* view) { |
| 214 // Paint background for detached state; if animating, this is fade in/out. | 214 // Paint background for detached state; if animating, this is fade in/out. |
| 215 const ui::ThemeProvider* tp = view->GetThemeProvider(); | 215 const ui::ThemeProvider* tp = view->GetThemeProvider(); |
| 216 gfx::Rect fill_rect = view->GetLocalBounds(); | 216 gfx::Rect fill_rect = view->GetLocalBounds(); |
| 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 // The detached bar overlaps the |contents_container_| and so uses the same | 223 // In detached mode, the bar is meant to overlap with |contents_container_|. |
| 224 // background color (the NTP background color). | 224 // The detached background color may be partially transparent, but the layer |
| 225 // for |view| must be painted opaquely to avoid subpixel anti-aliasing |
| 226 // artifacts, so we recreate the contents container base color here. |
| 225 canvas->FillRect(fill_rect, | 227 canvas->FillRect(fill_rect, |
| 226 tp->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND)); | 228 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND)); |
| 229 canvas->FillRect( |
| 230 fill_rect, |
| 231 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND)); |
| 227 | 232 |
| 228 // Draw the separators above and below bookmark bar; | 233 // Draw the separators above and below bookmark bar; |
| 229 // if animating, these are fading in/out. | 234 // if animating, these are fading in/out. |
| 230 SkColor separator_color = | 235 SkColor separator_color = |
| 231 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); | 236 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); |
| 232 | 237 |
| 233 if (ui::MaterialDesignController::IsModeMaterial()) { | 238 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 234 BrowserView::Paint1pxHorizontalLine( | 239 BrowserView::Paint1pxHorizontalLine( |
| 235 canvas, separator_color, | 240 canvas, separator_color, |
| 236 gfx::Rect(0, 0, view->width(), | 241 gfx::Rect(0, 0, view->width(), |
| (...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 | 2063 |
| 2059 web_contents_close_handler_.reset( | 2064 web_contents_close_handler_.reset( |
| 2060 new WebContentsCloseHandler(contents_web_view_)); | 2065 new WebContentsCloseHandler(contents_web_view_)); |
| 2061 | 2066 |
| 2062 devtools_web_view_ = new views::WebView(browser_->profile()); | 2067 devtools_web_view_ = new views::WebView(browser_->profile()); |
| 2063 devtools_web_view_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); | 2068 devtools_web_view_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); |
| 2064 devtools_web_view_->SetVisible(false); | 2069 devtools_web_view_->SetVisible(false); |
| 2065 | 2070 |
| 2066 contents_container_ = new views::View(); | 2071 contents_container_ = new views::View(); |
| 2067 contents_container_->set_background(views::Background::CreateSolidBackground( | 2072 contents_container_->set_background(views::Background::CreateSolidBackground( |
| 2068 GetThemeProvider()->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND))); | 2073 GetThemeProvider()->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND))); |
| 2069 contents_container_->AddChildView(devtools_web_view_); | 2074 contents_container_->AddChildView(devtools_web_view_); |
| 2070 contents_container_->AddChildView(contents_web_view_); | 2075 contents_container_->AddChildView(contents_web_view_); |
| 2071 contents_container_->SetLayoutManager(new ContentsLayoutManager( | 2076 contents_container_->SetLayoutManager(new ContentsLayoutManager( |
| 2072 devtools_web_view_, contents_web_view_)); | 2077 devtools_web_view_, contents_web_view_)); |
| 2073 AddChildView(contents_container_); | 2078 AddChildView(contents_container_); |
| 2074 set_contents_view(contents_container_); | 2079 set_contents_view(contents_container_); |
| 2075 | 2080 |
| 2076 // Top container holds tab strip and toolbar and lives at the front of the | 2081 // Top container holds tab strip and toolbar and lives at the front of the |
| 2077 // view hierarchy. | 2082 // view hierarchy. |
| 2078 top_container_ = new TopContainerView(this); | 2083 top_container_ = new TopContainerView(this); |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2649 } | 2654 } |
| 2650 | 2655 |
| 2651 extensions::ActiveTabPermissionGranter* | 2656 extensions::ActiveTabPermissionGranter* |
| 2652 BrowserView::GetActiveTabPermissionGranter() { | 2657 BrowserView::GetActiveTabPermissionGranter() { |
| 2653 content::WebContents* web_contents = GetActiveWebContents(); | 2658 content::WebContents* web_contents = GetActiveWebContents(); |
| 2654 if (!web_contents) | 2659 if (!web_contents) |
| 2655 return nullptr; | 2660 return nullptr; |
| 2656 return extensions::TabHelper::FromWebContents(web_contents) | 2661 return extensions::TabHelper::FromWebContents(web_contents) |
| 2657 ->active_tab_permission_granter(); | 2662 ->active_tab_permission_granter(); |
| 2658 } | 2663 } |
| OLD | NEW |