| 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 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL: | 470 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL: |
| 471 return color_utils::GetReadableColor( | 471 return color_utils::GetReadableColor( |
| 472 SK_ColorWHITE, GetColor(kLabelBackground, incognito)); | 472 SK_ColorWHITE, GetColor(kLabelBackground, incognito)); |
| 473 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND: | 473 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND: |
| 474 return color_utils::BlendTowardOppositeLuminance( | 474 return color_utils::BlendTowardOppositeLuminance( |
| 475 GetColor(ThemeProperties::COLOR_FRAME, incognito), 0x80); | 475 GetColor(ThemeProperties::COLOR_FRAME, incognito), 0x80); |
| 476 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BORDER: | 476 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BORDER: |
| 477 return color_utils::AlphaBlend(GetColor(kLabelBackground, incognito), | 477 return color_utils::AlphaBlend(GetColor(kLabelBackground, incognito), |
| 478 SK_ColorBLACK, 230); | 478 SK_ColorBLACK, 230); |
| 479 #endif | 479 #endif |
| 480 case ThemeProperties::COLOR_STATUS_BAR_TEXT: { | |
| 481 // A long time ago, we blended the toolbar and the tab text together to | |
| 482 // get the status bar text because, at the time, our text rendering in | |
| 483 // views couldn't do alpha blending. Even though this is no longer the | |
| 484 // case, this blending decision is built into the majority of themes that | |
| 485 // exist, and we must keep doing it. | |
| 486 SkColor toolbar_color = | |
| 487 GetColor(ThemeProperties::COLOR_TOOLBAR, incognito); | |
| 488 SkColor text_color = GetColor(ThemeProperties::COLOR_TAB_TEXT, incognito); | |
| 489 return SkColorSetARGB( | |
| 490 SkColorGetA(text_color), | |
| 491 (SkColorGetR(text_color) + SkColorGetR(toolbar_color)) / 2, | |
| 492 (SkColorGetG(text_color) + SkColorGetR(toolbar_color)) / 2, | |
| 493 (SkColorGetB(text_color) + SkColorGetR(toolbar_color)) / 2); | |
| 494 } | |
| 495 } | 480 } |
| 496 | 481 |
| 497 return ThemeProperties::GetDefaultColor(id, incognito); | 482 return ThemeProperties::GetDefaultColor(id, incognito); |
| 498 } | 483 } |
| 499 | 484 |
| 500 color_utils::HSL ThemeService::GetTint(int id, bool incognito) const { | 485 color_utils::HSL ThemeService::GetTint(int id, bool incognito) const { |
| 501 DCHECK(CalledOnValidThread()); | 486 DCHECK(CalledOnValidThread()); |
| 502 | 487 |
| 503 color_utils::HSL hsl; | 488 color_utils::HSL hsl; |
| 504 if (theme_supplier_ && theme_supplier_->GetTint(id, &hsl)) | 489 if (theme_supplier_ && theme_supplier_->GetTint(id, &hsl)) |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 | 779 |
| 795 #if defined(ENABLE_SUPERVISED_USERS) | 780 #if defined(ENABLE_SUPERVISED_USERS) |
| 796 bool ThemeService::IsSupervisedUser() const { | 781 bool ThemeService::IsSupervisedUser() const { |
| 797 return profile_->IsSupervised(); | 782 return profile_->IsSupervised(); |
| 798 } | 783 } |
| 799 | 784 |
| 800 void ThemeService::SetSupervisedUserTheme() { | 785 void ThemeService::SetSupervisedUserTheme() { |
| 801 SetCustomDefaultTheme(new SupervisedUserTheme); | 786 SetCustomDefaultTheme(new SupervisedUserTheme); |
| 802 } | 787 } |
| 803 #endif | 788 #endif |
| OLD | NEW |