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

Side by Side Diff: chrome/browser/managed_mode/managed_user_theme.cc

Issue 19471005: Add custom default theme support and create a managed user default theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits and add another test. Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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 } // namespace
17
18 ManagedUserTheme::ManagedUserTheme()
19 : CustomThemeSupplier(MANAGED_USER_THEME) {}
20
21 ManagedUserTheme::~ManagedUserTheme() {}
22
23 bool ManagedUserTheme::GetColor(int id, SkColor* color) const {
24 if (id == ThemeProperties::COLOR_FRAME) {
Pam (message me for reviews) 2013/07/23 10:14:17 How about a switch statement?
Adrian Kuegel 2013/07/23 10:26:37 Done.
25 *color = kDefaultColorFrameManagedUser;
26 return true;
27 }
28 if (id == ThemeProperties::COLOR_FRAME_INACTIVE) {
29 *color = kDefaultColorFrameManagedUserInactive;
30 return true;
31 }
32 if (id == ThemeProperties::COLOR_MANAGED_USER_LABEL) {
33 *color = SK_ColorWHITE;
34 return true;
35 }
36 if (id == ThemeProperties::COLOR_MANAGED_USER_LABEL_BACKGROUND) {
37 *color = SkColorSetRGB(108, 167, 210);
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 || id == IDR_THEME_FRAME_INACTIVE ||
Pam (message me for reviews) 2013/07/23 10:14:17 Please split this at each || for clarity.
Adrian Kuegel 2013/07/23 10:26:37 Done.
58 id == IDR_THEME_TAB_BACKGROUND || id == IDR_THEME_TAB_BACKGROUND_V);
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698