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

Side by Side Diff: chrome/browser/ui/website_settings/website_settings_ui.cc

Issue 10534138: Add icons to the views Website Settings UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 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 | Annotate | Revision Log
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/ui/website_settings/website_settings_ui.h" 5 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
6 6
7 #include "grit/generated_resources.h" 7 #include "grit/generated_resources.h"
8 #include "grit/theme_resources.h"
9 #include "grit/theme_resources_standard.h"
10 #include "grit/ui_resources.h"
11 #include "ui/base/resource/resource_bundle.h"
12 #include "ui/gfx/image/image.h"
8 13
9 namespace { 14 namespace {
10 const int kInvalidRessourceID = -1; 15 const int kInvalidRessourceID = -1;
11 } 16 }
12 17
13 WebsiteSettingsUI::CookieInfo::CookieInfo() 18 WebsiteSettingsUI::CookieInfo::CookieInfo()
14 : allowed(-1), blocked(-1) { 19 : allowed(-1), blocked(-1) {
15 } 20 }
16 21
17 WebsiteSettingsUI::PermissionInfo::PermissionInfo() 22 WebsiteSettingsUI::PermissionInfo::PermissionInfo()
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return IDS_WEBSITE_SETTINGS_PERMISSION_ALLOW; 58 return IDS_WEBSITE_SETTINGS_PERMISSION_ALLOW;
54 case CONTENT_SETTING_BLOCK: 59 case CONTENT_SETTING_BLOCK:
55 return IDS_WEBSITE_SETTINGS_PERMISSION_BLOCK; 60 return IDS_WEBSITE_SETTINGS_PERMISSION_BLOCK;
56 case CONTENT_SETTING_ASK: 61 case CONTENT_SETTING_ASK:
57 return IDS_WEBSITE_SETTINGS_PERMISSION_ASK; 62 return IDS_WEBSITE_SETTINGS_PERMISSION_ASK;
58 default: 63 default:
59 NOTREACHED(); 64 NOTREACHED();
60 return kInvalidRessourceID; 65 return kInvalidRessourceID;
61 } 66 }
62 } 67 }
68
69 // static
70 gfx::Image* WebsiteSettingsUI::GetPermissionIcon(
71 ContentSettingsType type,
72 ContentSetting setting) {
73 bool use_blocked = (setting == CONTENT_SETTING_BLOCK);
74 int resource_id = IDR_INFO;
75 switch (type) {
76 case CONTENT_SETTINGS_TYPE_COOKIES:
77 resource_id = use_blocked ? IDR_BLOCKED_COOKIES
78 : IDR_COOKIE_ICON;
79 break;
80 case CONTENT_SETTINGS_TYPE_POPUPS:
81 resource_id = use_blocked ? IDR_BLOCKED_POPUPS
82 : IDR_INFO;
83 break;
84 case CONTENT_SETTINGS_TYPE_PLUGINS:
85 resource_id = use_blocked ? IDR_BLOCKED_PLUGINS
86 : IDR_EXTENSIONS_FAVICON;
87 break;
88 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
89 resource_id = use_blocked ? IDR_GEOLOCATION_DENIED_LOCATIONBAR_ICON
90 : IDR_GEOLOCATION_ALLOWED_LOCATIONBAR_ICON;
91 break;
92 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
Finnur 2012/06/14 12:32:17 What's the plan for this?
markusheintz_ 2012/06/14 12:55:21 I don't have icons yet :(. But I'm working on it.
93 break;
94 default:
95 NOTREACHED();
96 break;
97 }
98 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
99 return &rb.GetNativeImageNamed(resource_id);
100 }
101
102 // static
103 gfx::Image* WebsiteSettingsUI::GetIdentityIcon(
104 WebsiteSettings::SiteIdentityStatus status) {
105 int resource_id = IDR_PAGEINFO_INFO;
106 switch (status) {
107 case WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN:
108 break;
109 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT:
110 case WebsiteSettings::SITE_IDENTITY_STATUS_EV_CERT:
111 case WebsiteSettings::SITE_IDENTITY_STATUS_DNSSEC_CERT:
112 resource_id = IDR_PAGEINFO_GOOD;
113 break;
114 case WebsiteSettings::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN:
115 resource_id = IDR_PAGEINFO_WARNING_MINOR;
116 break;
117 case WebsiteSettings::SITE_IDENTITY_STATUS_NO_CERT:
118 resource_id = IDR_PAGEINFO_WARNING_MAJOR;
119 break;
120 case WebsiteSettings::SITE_IDENTITY_STATUS_ERROR:
121 resource_id = IDR_PAGEINFO_BAD;
122 break;
123 default:
124 NOTREACHED();
125 break;
126 }
127 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
128 return &rb.GetNativeImageNamed(resource_id);
129 }
130
131 // static
132 gfx::Image* WebsiteSettingsUI::GetConnectionIcon(
133 WebsiteSettings::SiteConnectionStatus status) {
134 int resource_id = IDR_PAGEINFO_INFO;
135 switch (status) {
136 case WebsiteSettings::SITE_CONNECTION_STATUS_UNKNOWN:
137 break;
138 case WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED:
139 resource_id = IDR_PAGEINFO_GOOD;
140 break;
141 case WebsiteSettings::SITE_CONNECTION_STATUS_MIXED_CONTENT:
142 resource_id = IDR_PAGEINFO_WARNING_MINOR;
143 break;
144 case WebsiteSettings::SITE_CONNECTION_STATUS_UNENCRYPTED:
145 resource_id = IDR_PAGEINFO_WARNING_MAJOR;
146 break;
147 case WebsiteSettings::SITE_CONNECTION_STATUS_ENCRYPTED_ERROR:
148 resource_id = IDR_PAGEINFO_BAD;
149 break;
150 default:
151 NOTREACHED();
152 break;
153 }
154 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
155 return &rb.GetNativeImageNamed(resource_id);
156 }
Finnur 2012/06/14 12:32:17 Neither of those functions handle SITE_IDENTITY_ST
markusheintz_ 2012/06/14 12:55:21 Yes. As for internal pages I intend to display dif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698