Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 1978943002: [MD] Fix detached bookmark bar top separator in hdpi (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iterate on comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 SkColor color) { 210 SkColor color) {
211 int thickness = views::NonClientFrameView::kClientEdgeThickness; 211 int thickness = views::NonClientFrameView::kClientEdgeThickness;
212 int y = at_top ? 0 : (view->height() - thickness); 212 int y = at_top ? 0 : (view->height() - thickness);
213 canvas->FillRect(gfx::Rect(0, y, view->width(), thickness), color); 213 canvas->FillRect(gfx::Rect(0, y, view->width(), thickness), color);
214 } 214 }
215 215
216 void PaintDetachedBookmarkBar(gfx::Canvas* canvas, 216 void PaintDetachedBookmarkBar(gfx::Canvas* canvas,
217 BookmarkBarView* view) { 217 BookmarkBarView* view) {
218 // Paint background for detached state; if animating, this is fade in/out. 218 // Paint background for detached state; if animating, this is fade in/out.
219 const ui::ThemeProvider* tp = view->GetThemeProvider(); 219 const ui::ThemeProvider* tp = view->GetThemeProvider();
220 gfx::Rect fill_rect = view->GetLocalBounds();
221 // In MD, we have to not color the top 1dp, because that should be painted by
222 // the toolbar. We will, however, paint the 1px separator at the bottom of the
223 // first dp. See crbug.com/610359
224 if (ui::MaterialDesignController::IsModeMaterial())
225 fill_rect.Inset(0, 1, 0, 0);
226
220 // In detached mode, the bar is meant to overlap with |contents_container_|. 227 // In detached mode, the bar is meant to overlap with |contents_container_|.
221 // Since the layer for |view| is opaque, we have to recreate that base color 228 // The detached background color may be partially transparent, but the layer
222 // here. (The detached background color may be partially transparent.) 229 // for |view| must be painted opaquely to avoid subpixel anti-aliasing
223 canvas->DrawColor( 230 // artifacts, so we recreate the contents container base color here.
224 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND)); 231 canvas->FillRect(fill_rect,
225 canvas->DrawColor( 232 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND));
233 canvas->FillRect(
234 fill_rect,
226 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND)); 235 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND));
227 236
228 // Draw the separators above and below bookmark bar; 237 // Draw the separators above and below bookmark bar;
229 // if animating, these are fading in/out. 238 // if animating, these are fading in/out.
230 SkColor separator_color = 239 SkColor separator_color =
231 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); 240 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR);
232 241
233 if (ui::MaterialDesignController::IsModeMaterial()) { 242 if (ui::MaterialDesignController::IsModeMaterial()) {
234 BrowserView::Paint1pxHorizontalLine( 243 BrowserView::Paint1pxHorizontalLine(
235 canvas, separator_color, 244 canvas, separator_color,
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2627 } 2636 }
2628 2637
2629 extensions::ActiveTabPermissionGranter* 2638 extensions::ActiveTabPermissionGranter*
2630 BrowserView::GetActiveTabPermissionGranter() { 2639 BrowserView::GetActiveTabPermissionGranter() {
2631 content::WebContents* web_contents = GetActiveWebContents(); 2640 content::WebContents* web_contents = GetActiveWebContents();
2632 if (!web_contents) 2641 if (!web_contents)
2633 return nullptr; 2642 return nullptr;
2634 return extensions::TabHelper::FromWebContents(web_contents) 2643 return extensions::TabHelper::FromWebContents(web_contents)
2635 ->active_tab_permission_granter(); 2644 ->active_tab_permission_granter();
2636 } 2645 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698