1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/managed_mode/managed_user_theme.h"
7 #include "chrome/browser/themes/theme_properties.h"
8 #include "grit/theme_resources.h"
9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/image/image.h"
14 const SkColor kDefaultColorFrameManagedUser
= SkColorSetRGB(165, 197, 225);
15 const SkColor kDefaultColorFrameManagedUserInactive
=
16 SkColorSetRGB(180, 225, 247);
17 const SkColor kDefaultColorManagedUserLabelBackground
=
18 SkColorSetRGB(108, 167, 210);
20 // Map resource ids to the managed user resource ids.
21 int MapToManagedUserResourceIds(int id
) {
25 case IDR_THEME_FRAME_WIN
:
27 return IDR_MANAGED_USER_THEME_FRAME
;
28 case IDR_THEME_FRAME_INACTIVE
:
30 case IDR_THEME_FRAME_INACTIVE_WIN
:
32 return IDR_MANAGED_USER_THEME_FRAME_INACTIVE
;
33 case IDR_THEME_TAB_BACKGROUND
:
34 case IDR_THEME_TAB_BACKGROUND_V
:
36 case IDR_THEME_TAB_BACKGROUND_WIN
:
38 return IDR_MANAGED_USER_THEME_TAB_BACKGROUND
;
45 ManagedUserTheme::ManagedUserTheme()
46 : CustomThemeSupplier(MANAGED_USER_THEME
) {}
48 ManagedUserTheme::~ManagedUserTheme() {}
50 bool ManagedUserTheme::GetColor(int id
, SkColor
* color
) const {
52 case ThemeProperties::COLOR_FRAME
:
53 *color
= kDefaultColorFrameManagedUser
;
55 case ThemeProperties::COLOR_FRAME_INACTIVE
:
56 *color
= kDefaultColorFrameManagedUserInactive
;
58 case ThemeProperties::COLOR_MANAGED_USER_LABEL
:
59 *color
= SK_ColorWHITE
;
61 case ThemeProperties::COLOR_MANAGED_USER_LABEL_BACKGROUND
:
62 *color
= kDefaultColorManagedUserLabelBackground
;
68 gfx::Image
ManagedUserTheme::GetImageNamed(int id
) {
69 if (!HasCustomImage(id
))
72 id
= MapToManagedUserResourceIds(id
);
73 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(id
);
76 bool ManagedUserTheme::HasCustomImage(int id
) const {
77 return id
!= MapToManagedUserResourceIds(id
);