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

Side by Side Diff: chrome/browser/themes/theme_service.cc

Issue 2928823003: Make it possible to build without enable_supervised_users.
Patch Set: Does it still compile with the feature enabled? Created 3 years, 6 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
OLDNEW
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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 412 }
413 413
414 bool ThemeService::ShouldInitWithSystemTheme() const { 414 bool ThemeService::ShouldInitWithSystemTheme() const {
415 return false; 415 return false;
416 } 416 }
417 417
418 SkColor ThemeService::GetDefaultColor(int id, bool incognito) const { 418 SkColor ThemeService::GetDefaultColor(int id, bool incognito) const {
419 // For backward compat with older themes, some newer colors are generated from 419 // For backward compat with older themes, some newer colors are generated from
420 // older ones if they are missing. 420 // older ones if they are missing.
421 const int kNtpText = ThemeProperties::COLOR_NTP_TEXT; 421 const int kNtpText = ThemeProperties::COLOR_NTP_TEXT;
422 const int kLabelBackground =
423 ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND;
424 switch (id) { 422 switch (id) {
425 case ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON: 423 case ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON:
426 return color_utils::HSLShift( 424 return color_utils::HSLShift(
427 gfx::kChromeIconGrey, 425 gfx::kChromeIconGrey,
428 GetTint(ThemeProperties::TINT_BUTTONS, incognito)); 426 GetTint(ThemeProperties::TINT_BUTTONS, incognito));
429 case ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE: 427 case ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE:
430 // The active color is overridden in GtkUi. 428 // The active color is overridden in GtkUi.
431 return SkColorSetA( 429 return SkColorSetA(
432 GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON, incognito), 430 GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON, incognito),
433 0x33); 431 0x33);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 case ThemeProperties::COLOR_TAB_THROBBER_WAITING: { 486 case ThemeProperties::COLOR_TAB_THROBBER_WAITING: {
489 SkColor base_color = 487 SkColor base_color =
490 ui::GetAuraColor(id == ThemeProperties::COLOR_TAB_THROBBER_SPINNING 488 ui::GetAuraColor(id == ThemeProperties::COLOR_TAB_THROBBER_SPINNING
491 ? ui::NativeTheme::kColorId_ThrobberSpinningColor 489 ? ui::NativeTheme::kColorId_ThrobberSpinningColor
492 : ui::NativeTheme::kColorId_ThrobberWaitingColor, 490 : ui::NativeTheme::kColorId_ThrobberWaitingColor,
493 nullptr); 491 nullptr);
494 color_utils::HSL hsl = GetTint(ThemeProperties::TINT_BUTTONS, incognito); 492 color_utils::HSL hsl = GetTint(ThemeProperties::TINT_BUTTONS, incognito);
495 return color_utils::HSLShift(base_color, hsl); 493 return color_utils::HSLShift(base_color, hsl);
496 } 494 }
497 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 495 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
498 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL: 496 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL: {
497 constexpr int kLabelBackground =
498 ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND;
499 return color_utils::GetReadableColor( 499 return color_utils::GetReadableColor(
500 SK_ColorWHITE, GetColor(kLabelBackground, incognito)); 500 SK_ColorWHITE, GetColor(kLabelBackground, incognito));
501 }
501 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND: 502 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND:
502 return color_utils::BlendTowardOppositeLuma( 503 return color_utils::BlendTowardOppositeLuma(
503 GetColor(ThemeProperties::COLOR_FRAME, incognito), 0x80); 504 GetColor(ThemeProperties::COLOR_FRAME, incognito), 0x80);
504 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BORDER: 505 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BORDER:
505 return color_utils::AlphaBlend(GetColor(kLabelBackground, incognito), 506 return color_utils::AlphaBlend(GetColor(kLabelBackground, incognito),
506 SK_ColorBLACK, 230); 507 SK_ColorBLACK, 230);
507 #endif 508 #endif
508 } 509 }
509 510
510 // Always fall back to the non-incognito color when there's a custom theme 511 // Always fall back to the non-incognito color when there's a custom theme
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 924
924 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 925 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
925 bool ThemeService::IsSupervisedUser() const { 926 bool ThemeService::IsSupervisedUser() const {
926 return profile_->IsSupervised(); 927 return profile_->IsSupervised();
927 } 928 }
928 929
929 void ThemeService::SetSupervisedUserTheme() { 930 void ThemeService::SetSupervisedUserTheme() {
930 SetCustomDefaultTheme(new SupervisedUserTheme); 931 SetCustomDefaultTheme(new SupervisedUserTheme);
931 } 932 }
932 #endif 933 #endif
OLDNEW
« no previous file with comments | « chrome/browser/sync/supervised_user_signin_manager_wrapper.h ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698