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