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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // 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. |
Peter Kasting
2016/07/11 01:41:58
The detached background color no longer exists, an
Julien Isorce Samsung
2016/07/13 15:01:33
Done.
| |
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 tp->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND)); |
232 | 230 |
233 // Draw the separators above and below bookmark bar; | 231 // Draw the separators above and below bookmark bar; |
234 // if animating, these are fading in/out. | 232 // if animating, these are fading in/out. |
235 SkColor separator_color = | 233 SkColor separator_color = |
236 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); | 234 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); |
237 | 235 |
238 if (ui::MaterialDesignController::IsModeMaterial()) { | 236 if (ui::MaterialDesignController::IsModeMaterial()) { |
239 BrowserView::Paint1pxHorizontalLine( | 237 BrowserView::Paint1pxHorizontalLine( |
240 canvas, separator_color, | 238 canvas, separator_color, |
241 gfx::Rect(0, 0, view->width(), | 239 gfx::Rect(0, 0, view->width(), |
(...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2062 | 2060 |
2063 web_contents_close_handler_.reset( | 2061 web_contents_close_handler_.reset( |
2064 new WebContentsCloseHandler(contents_web_view_)); | 2062 new WebContentsCloseHandler(contents_web_view_)); |
2065 | 2063 |
2066 devtools_web_view_ = new views::WebView(browser_->profile()); | 2064 devtools_web_view_ = new views::WebView(browser_->profile()); |
2067 devtools_web_view_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); | 2065 devtools_web_view_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); |
2068 devtools_web_view_->SetVisible(false); | 2066 devtools_web_view_->SetVisible(false); |
2069 | 2067 |
2070 contents_container_ = new views::View(); | 2068 contents_container_ = new views::View(); |
2071 contents_container_->set_background(views::Background::CreateSolidBackground( | 2069 contents_container_->set_background(views::Background::CreateSolidBackground( |
2072 GetThemeProvider()->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND))); | 2070 GetThemeProvider()->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND))); |
2073 contents_container_->AddChildView(devtools_web_view_); | 2071 contents_container_->AddChildView(devtools_web_view_); |
2074 contents_container_->AddChildView(contents_web_view_); | 2072 contents_container_->AddChildView(contents_web_view_); |
2075 contents_container_->SetLayoutManager(new ContentsLayoutManager( | 2073 contents_container_->SetLayoutManager(new ContentsLayoutManager( |
2076 devtools_web_view_, contents_web_view_)); | 2074 devtools_web_view_, contents_web_view_)); |
2077 AddChildView(contents_container_); | 2075 AddChildView(contents_container_); |
2078 set_contents_view(contents_container_); | 2076 set_contents_view(contents_container_); |
2079 | 2077 |
2080 // Top container holds tab strip and toolbar and lives at the front of the | 2078 // Top container holds tab strip and toolbar and lives at the front of the |
2081 // view hierarchy. | 2079 // view hierarchy. |
2082 top_container_ = new TopContainerView(this); | 2080 top_container_ = new TopContainerView(this); |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2653 } | 2651 } |
2654 | 2652 |
2655 extensions::ActiveTabPermissionGranter* | 2653 extensions::ActiveTabPermissionGranter* |
2656 BrowserView::GetActiveTabPermissionGranter() { | 2654 BrowserView::GetActiveTabPermissionGranter() { |
2657 content::WebContents* web_contents = GetActiveWebContents(); | 2655 content::WebContents* web_contents = GetActiveWebContents(); |
2658 if (!web_contents) | 2656 if (!web_contents) |
2659 return nullptr; | 2657 return nullptr; |
2660 return extensions::TabHelper::FromWebContents(web_contents) | 2658 return extensions::TabHelper::FromWebContents(web_contents) |
2661 ->active_tab_permission_granter(); | 2659 ->active_tab_permission_granter(); |
2662 } | 2660 } |
OLD | NEW |