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. 4 5 #include "chrome/browser/managed_mode/managed_user_theme.h" 6 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" 11 12 namespace { 13 const SkColor kDefaultColorFrameManagedUser = SkColorSetRGB(165, 197, 225); 14 const SkColor kDefaultColorFrameManagedUserInactive = 15 SkColorSetRGB(180, 225, 247); 16 const SkColor kDefaultColorManagedUserLabelBackground = 17 SkColorSetRGB(108, 167, 210); 18 } // namespace 19 20 ManagedUserTheme::ManagedUserTheme() 21 : CustomThemeSupplier(MANAGED_USER_THEME) {} 22 23 ManagedUserTheme::~ManagedUserTheme() {} 24 25 bool ManagedUserTheme::GetColor(int id, SkColor* color) const { 26 switch (id) { 27 case ThemeProperties::COLOR_FRAME: 28 *color = kDefaultColorFrameManagedUser; 29 return true; 30 case ThemeProperties::COLOR_FRAME_INACTIVE: 31 *color = kDefaultColorFrameManagedUserInactive; 32 return true; 33 case ThemeProperties::COLOR_MANAGED_USER_LABEL: 34 *color = SK_ColorWHITE; 35 return true; 36 case ThemeProperties::COLOR_MANAGED_USER_LABEL_BACKGROUND: 37 *color = kDefaultColorManagedUserLabelBackground; 38 return true; 39 } 40 return false; 41 } 42 43 gfx::Image ManagedUserTheme::GetImageNamed(int id) { 44 if (!HasCustomImage(id)) 45 return gfx::Image(); 46 47 if (id == IDR_THEME_FRAME) 48 id = IDR_MANAGED_USER_THEME_FRAME; 49 else if (id == IDR_THEME_FRAME_INACTIVE) 50 id = IDR_MANAGED_USER_THEME_FRAME_INACTIVE; 51 else if (id == IDR_THEME_TAB_BACKGROUND || id == IDR_THEME_TAB_BACKGROUND_V) 52 id = IDR_MANAGED_USER_THEME_TAB_BACKGROUND; 53 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(id); 54 } 55 56 bool ManagedUserTheme::HasCustomImage(int id) const { 57 return (id == IDR_THEME_FRAME || 58 id == IDR_THEME_FRAME_INACTIVE || 59 id == IDR_THEME_TAB_BACKGROUND || 60 id == IDR_THEME_TAB_BACKGROUND_V); 61 } 62