Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/themes/theme_service.h" | 5 #include "chrome/browser/themes/theme_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 const color_utils::HSL kTint = {-1, -1, 0.42975}; | 470 const color_utils::HSL kTint = {-1, -1, 0.42975}; |
| 471 const color_utils::HSL kTintIncognito = {-1, -1, 0.34375}; | 471 const color_utils::HSL kTintIncognito = {-1, -1, 0.34375}; |
| 472 return color_utils::HSLShift( | 472 return color_utils::HSLShift( |
| 473 GetColor(ThemeProperties::COLOR_TOOLBAR, incognito), | 473 GetColor(ThemeProperties::COLOR_TOOLBAR, incognito), |
| 474 incognito ? kTintIncognito : kTint); | 474 incognito ? kTintIncognito : kTint); |
| 475 } | 475 } |
| 476 case ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT: | 476 case ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT: |
| 477 if (UsingDefaultTheme()) | 477 if (UsingDefaultTheme()) |
| 478 break; | 478 break; |
| 479 return GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT, incognito); | 479 return GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT, incognito); |
| 480 case ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR: { | |
| 481 // Same as the normal toolbar separator, but with increased luminance. | |
| 482 // Either double it or halve the distance to 1.0, whichever is less of a | |
| 483 // difference. | |
| 484 color_utils::HSL hsl; | |
| 485 color_utils::SkColorToHSL( | |
| 486 GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR, incognito), | |
| 487 &hsl); | |
| 488 hsl.l = std::min((hsl.l + 1) / 2, hsl.l * 2); | |
| 489 return color_utils::HSLToSkColor(hsl, SK_AlphaOPAQUE); | |
| 490 } | |
| 480 case ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND: | 491 case ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND: |
| 481 if (UsingDefaultTheme()) | 492 if (UsingDefaultTheme()) |
| 482 break; | 493 break; |
| 483 return GetColor(ThemeProperties::COLOR_TOOLBAR, incognito); | 494 return GetColor(ThemeProperties::COLOR_TOOLBAR, incognito); |
| 484 case ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR: | 495 case ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR: |
| 485 if (UsingDefaultTheme()) | 496 if (UsingDefaultTheme()) |
| 486 break; | 497 break; |
| 487 // Use 50% of bookmark text color as separator color. | 498 // Use 25% of bookmark text color as separator color. |
| 488 return SkColorSetA( | 499 return color_utils::BlendTowardOppositeLuma( |
|
Evan Stade
2017/01/13 01:16:52
The 50% didn't match up well with what the default
| |
| 489 GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT, incognito), 128); | 500 GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT, incognito), 0xBF); |
| 490 case ThemeProperties::COLOR_NTP_SECTION_HEADER_TEXT: | 501 case ThemeProperties::COLOR_NTP_SECTION_HEADER_TEXT: |
| 491 return IncreaseLightness(GetColor(kNtpText, incognito), 0.30); | 502 return IncreaseLightness(GetColor(kNtpText, incognito), 0.30); |
| 492 case ThemeProperties::COLOR_NTP_SECTION_HEADER_TEXT_HOVER: | 503 case ThemeProperties::COLOR_NTP_SECTION_HEADER_TEXT_HOVER: |
| 493 return GetColor(kNtpText, incognito); | 504 return GetColor(kNtpText, incognito); |
| 494 case ThemeProperties::COLOR_NTP_SECTION_HEADER_RULE: | 505 case ThemeProperties::COLOR_NTP_SECTION_HEADER_RULE: |
| 495 return IncreaseLightness(GetColor(kNtpText, incognito), 0.70); | 506 return IncreaseLightness(GetColor(kNtpText, incognito), 0.70); |
| 496 case ThemeProperties::COLOR_NTP_SECTION_HEADER_RULE_LIGHT: | 507 case ThemeProperties::COLOR_NTP_SECTION_HEADER_RULE_LIGHT: |
| 497 return IncreaseLightness(GetColor(kNtpText, incognito), 0.86); | 508 return IncreaseLightness(GetColor(kNtpText, incognito), 0.86); |
| 498 case ThemeProperties::COLOR_NTP_TEXT_LIGHT: | 509 case ThemeProperties::COLOR_NTP_TEXT_LIGHT: |
| 499 return IncreaseLightness(GetColor(kNtpText, incognito), 0.40); | 510 return IncreaseLightness(GetColor(kNtpText, incognito), 0.40); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 | 886 |
| 876 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 887 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 877 bool ThemeService::IsSupervisedUser() const { | 888 bool ThemeService::IsSupervisedUser() const { |
| 878 return profile_->IsSupervised(); | 889 return profile_->IsSupervised(); |
| 879 } | 890 } |
| 880 | 891 |
| 881 void ThemeService::SetSupervisedUserTheme() { | 892 void ThemeService::SetSupervisedUserTheme() { |
| 882 SetCustomDefaultTheme(new SupervisedUserTheme); | 893 SetCustomDefaultTheme(new SupervisedUserTheme); |
| 883 } | 894 } |
| 884 #endif | 895 #endif |
| OLD | NEW |