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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_theme.cc

Issue 1869693002: Theme suppliers: Avoid all Image copying. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/supervised_user/supervised_user_theme.h" 5 #include "chrome/browser/supervised_user/supervised_user_theme.h"
6 6
7 #include "chrome/browser/themes/theme_properties.h" 7 #include "chrome/browser/themes/theme_properties.h"
8 #include "grit/theme_resources.h" 8 #include "grit/theme_resources.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/image/image.h" 10 #include "ui/gfx/image/image.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL: 49 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL:
50 *color = SK_ColorWHITE; 50 *color = SK_ColorWHITE;
51 return true; 51 return true;
52 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND: 52 case ThemeProperties::COLOR_SUPERVISED_USER_LABEL_BACKGROUND:
53 *color = kDefaultColorSupervisedUserLabelBackground; 53 *color = kDefaultColorSupervisedUserLabelBackground;
54 return true; 54 return true;
55 } 55 }
56 return false; 56 return false;
57 } 57 }
58 58
59 gfx::Image SupervisedUserTheme::GetImageNamed(int id) { 59 const gfx::Image& SupervisedUserTheme::GetImageNamed(int id) {
60 if (!HasCustomImage(id)) 60 if (!HasCustomImage(id))
61 return gfx::Image(); 61 return empty_image();
62 62
63 id = MapToSupervisedUserResourceIds(id); 63 id = MapToSupervisedUserResourceIds(id);
64 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(id); 64 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(id);
65 } 65 }
66 66
67 bool SupervisedUserTheme::HasCustomImage(int id) const { 67 bool SupervisedUserTheme::HasCustomImage(int id) const {
68 return id != MapToSupervisedUserResourceIds(id); 68 return id != MapToSupervisedUserResourceIds(id);
69 } 69 }
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_theme.h ('k') | chrome/browser/themes/browser_theme_pack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698