OLD | NEW |
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 "chrome/grit/chromium_strings.h" | 7 #include "chrome/grit/chromium_strings.h" |
8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 "incorrect"); | 43 "incorrect"); |
44 | 44 |
45 // The resource id's for the strings that are displayed on the permissions | 45 // The resource id's for the strings that are displayed on the permissions |
46 // button if the permission setting is managed by the user. | 46 // button if the permission setting is managed by the user. |
47 const int kPermissionButtonTextIDUserManaged[] = { | 47 const int kPermissionButtonTextIDUserManaged[] = { |
48 kInvalidResourceID, | 48 kInvalidResourceID, |
49 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_USER, | 49 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_USER, |
50 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_USER, | 50 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_USER, |
51 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_USER, | 51 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_USER, |
52 kInvalidResourceID, | 52 kInvalidResourceID, |
53 kInvalidResourceID}; | 53 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_USER}; |
54 static_assert(arraysize(kPermissionButtonTextIDUserManaged) == | 54 static_assert(arraysize(kPermissionButtonTextIDUserManaged) == |
55 CONTENT_SETTING_NUM_SETTINGS, | 55 CONTENT_SETTING_NUM_SETTINGS, |
56 "kPermissionButtonTextIDUserManaged array size is incorrect"); | 56 "kPermissionButtonTextIDUserManaged array size is incorrect"); |
57 | 57 |
58 // The resource id's for the strings that are displayed on the permissions | 58 // The resource id's for the strings that are displayed on the permissions |
59 // button if the permission setting is the global default setting. | 59 // button if the permission setting is the global default setting. |
60 const int kPermissionButtonTextIDDefaultSetting[] = { | 60 const int kPermissionButtonTextIDDefaultSetting[] = { |
61 kInvalidResourceID, | 61 kInvalidResourceID, |
62 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_DEFAULT, | 62 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ALLOWED_BY_DEFAULT, |
63 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_DEFAULT, | 63 IDS_WEBSITE_SETTINGS_BUTTON_TEXT_BLOCKED_BY_DEFAULT, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 case CONTENT_SETTING_ASK: | 150 case CONTENT_SETTING_ASK: |
151 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_ASK); | 151 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_ASK); |
152 default: | 152 default: |
153 NOTREACHED(); | 153 NOTREACHED(); |
154 return base::string16(); | 154 return base::string16(); |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 // static | 158 // static |
159 base::string16 WebsiteSettingsUI::PermissionActionToUIString( | 159 base::string16 WebsiteSettingsUI::PermissionActionToUIString( |
160 ContentSetting setting, | 160 ContentSettingsType type, |
161 ContentSetting default_setting, | 161 ContentSetting setting, |
162 content_settings::SettingSource source) { | 162 ContentSetting default_setting, |
| 163 content_settings::SettingSource source) { |
163 ContentSetting effective_setting = setting; | 164 ContentSetting effective_setting = setting; |
164 if (effective_setting == CONTENT_SETTING_DEFAULT) | 165 if (effective_setting == CONTENT_SETTING_DEFAULT) { |
165 effective_setting = default_setting; | 166 effective_setting = default_setting; |
166 | 167 |
| 168 // For Plugins, ASK is obsolete. Show as BLOCK to reflect actual behavior. |
| 169 if (type == CONTENT_SETTINGS_TYPE_PLUGINS && |
| 170 default_setting == CONTENT_SETTING_ASK) { |
| 171 effective_setting = CONTENT_SETTING_BLOCK; |
| 172 } |
| 173 } |
| 174 |
167 const int* button_text_ids = NULL; | 175 const int* button_text_ids = NULL; |
168 switch (source) { | 176 switch (source) { |
169 case content_settings::SETTING_SOURCE_USER: | 177 case content_settings::SETTING_SOURCE_USER: |
170 if (setting == CONTENT_SETTING_DEFAULT) | 178 if (setting == CONTENT_SETTING_DEFAULT) |
171 button_text_ids = kPermissionButtonTextIDDefaultSetting; | 179 button_text_ids = kPermissionButtonTextIDDefaultSetting; |
172 else | 180 else |
173 button_text_ids = kPermissionButtonTextIDUserManaged; | 181 button_text_ids = kPermissionButtonTextIDUserManaged; |
174 break; | 182 break; |
175 case content_settings::SETTING_SOURCE_POLICY: | 183 case content_settings::SETTING_SOURCE_POLICY: |
176 button_text_ids = kPermissionButtonTextIDPolicyManaged; | 184 button_text_ids = kPermissionButtonTextIDPolicyManaged; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // the first time. | 342 // the first time. |
335 return IDR_PAGEINFO_INFO; | 343 return IDR_PAGEINFO_INFO; |
336 } | 344 } |
337 | 345 |
338 // static | 346 // static |
339 const gfx::Image& WebsiteSettingsUI::GetFirstVisitIcon( | 347 const gfx::Image& WebsiteSettingsUI::GetFirstVisitIcon( |
340 const base::string16& first_visit) { | 348 const base::string16& first_visit) { |
341 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 349 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
342 return rb.GetNativeImageNamed(GetFirstVisitIconID(first_visit)); | 350 return rb.GetNativeImageNamed(GetFirstVisitIconID(first_visit)); |
343 } | 351 } |
OLD | NEW |