Chromium Code Reviews| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 // In detached mode, the bar is meant to overlap with |contents_container_|. | 214 // In detached mode, the bar is meant to overlap with |contents_container_|. |
| 215 // The detached background color may be partially transparent, but the layer | 215 // The detached background color may be partially transparent, but the layer |
| 216 // for |view| must be painted opaquely to avoid subpixel anti-aliasing | 216 // for |view| must be painted opaquely to avoid subpixel anti-aliasing |
| 217 // artifacts, so we recreate the contents container base color here. | 217 // artifacts, so we recreate the contents container base color here. |
| 218 canvas->FillRect(fill_rect, | 218 canvas->FillRect(fill_rect, |
| 219 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND)); | 219 tp->GetColor(ThemeProperties::COLOR_CONTROL_BACKGROUND)); |
| 220 canvas->FillRect( | 220 canvas->FillRect( |
| 221 fill_rect, | 221 fill_rect, |
| 222 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND)); | 222 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND)); |
| 223 | 223 |
| 224 // Draw the separators above and below bookmark bar; | 224 // Draw the separator below the detached bookmark bar. |
| 225 // if animating, these are fading in/out. | |
| 226 SkColor separator_color = | |
| 227 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR); | |
|
Evan Stade
2017/01/13 01:16:52
This code looks weird because when the code was or
| |
| 228 | |
| 229 // For the bottom separator, increase the luminance. Either double it or halve | |
| 230 // the distance to 1.0, whichever is less of a difference. | |
| 231 color_utils::HSL hsl; | |
| 232 color_utils::SkColorToHSL(separator_color, &hsl); | |
| 233 hsl.l = std::min((hsl.l + 1) / 2, hsl.l * 2); | |
| 234 BrowserView::Paint1pxHorizontalLine( | 225 BrowserView::Paint1pxHorizontalLine( |
| 235 canvas, color_utils::HSLToSkColor(hsl, SK_AlphaOPAQUE), | 226 canvas, |
| 227 tp->GetColor(ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR), | |
| 236 view->GetLocalBounds(), true); | 228 view->GetLocalBounds(), true); |
| 237 } | 229 } |
| 238 | 230 |
| 239 // Paints the background (including the theme image behind content area) for | 231 // Paints the background (including the theme image behind content area) for |
| 240 // the Bookmarks Bar when it is attached to the Toolbar into |bounds|. | 232 // the Bookmarks Bar when it is attached to the Toolbar into |bounds|. |
| 241 // |background_origin| is the origin to use for painting the theme image. | 233 // |background_origin| is the origin to use for painting the theme image. |
| 242 void PaintBackgroundAttachedMode(gfx::Canvas* canvas, | 234 void PaintBackgroundAttachedMode(gfx::Canvas* canvas, |
| 243 const ui::ThemeProvider* theme_provider, | 235 const ui::ThemeProvider* theme_provider, |
| 244 const gfx::Rect& bounds, | 236 const gfx::Rect& bounds, |
| 245 const gfx::Point& background_origin) { | 237 const gfx::Point& background_origin) { |
| (...skipping 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2644 } | 2636 } |
| 2645 | 2637 |
| 2646 extensions::ActiveTabPermissionGranter* | 2638 extensions::ActiveTabPermissionGranter* |
| 2647 BrowserView::GetActiveTabPermissionGranter() { | 2639 BrowserView::GetActiveTabPermissionGranter() { |
| 2648 content::WebContents* web_contents = GetActiveWebContents(); | 2640 content::WebContents* web_contents = GetActiveWebContents(); |
| 2649 if (!web_contents) | 2641 if (!web_contents) |
| 2650 return nullptr; | 2642 return nullptr; |
| 2651 return extensions::TabHelper::FromWebContents(web_contents) | 2643 return extensions::TabHelper::FromWebContents(web_contents) |
| 2652 ->active_tab_permission_granter(); | 2644 ->active_tab_permission_granter(); |
| 2653 } | 2645 } |
| OLD | NEW |