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/browser/plugins/plugins_field_trial.h" |
7 #include "chrome/grit/chromium_strings.h" | 8 #include "chrome/grit/chromium_strings.h" |
8 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
9 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
10 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
11 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
12 #include "ui/gfx/image/image.h" | 13 #include "ui/gfx/image/image.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 const int kInvalidResourceID = -1; | 17 const int kInvalidResourceID = -1; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 170 } |
170 } | 171 } |
171 | 172 |
172 // static | 173 // static |
173 base::string16 WebsiteSettingsUI::PermissionActionToUIString( | 174 base::string16 WebsiteSettingsUI::PermissionActionToUIString( |
174 ContentSettingsType type, | 175 ContentSettingsType type, |
175 ContentSetting setting, | 176 ContentSetting setting, |
176 ContentSetting default_setting, | 177 ContentSetting default_setting, |
177 content_settings::SettingSource source) { | 178 content_settings::SettingSource source) { |
178 ContentSetting effective_setting = setting; | 179 ContentSetting effective_setting = setting; |
179 if (effective_setting == CONTENT_SETTING_DEFAULT) { | 180 if (effective_setting == CONTENT_SETTING_DEFAULT) |
180 effective_setting = default_setting; | 181 effective_setting = default_setting; |
181 | 182 |
182 // For Plugins, ASK is obsolete. Show as BLOCK to reflect actual behavior. | 183 #if defined(ENABLE_PLUGINS) |
183 if (type == CONTENT_SETTINGS_TYPE_PLUGINS && | 184 effective_setting = |
184 default_setting == CONTENT_SETTING_ASK) { | 185 PluginsFieldTrial::EffectiveContentSetting(type, effective_setting); |
185 effective_setting = CONTENT_SETTING_BLOCK; | 186 #endif |
186 } | |
187 } | |
188 | 187 |
189 const int* button_text_ids = NULL; | 188 const int* button_text_ids = NULL; |
190 switch (source) { | 189 switch (source) { |
191 case content_settings::SETTING_SOURCE_USER: | 190 case content_settings::SETTING_SOURCE_USER: |
192 if (setting == CONTENT_SETTING_DEFAULT) | 191 if (setting == CONTENT_SETTING_DEFAULT) |
193 button_text_ids = kPermissionButtonTextIDDefaultSetting; | 192 button_text_ids = kPermissionButtonTextIDDefaultSetting; |
194 else | 193 else |
195 button_text_ids = kPermissionButtonTextIDUserManaged; | 194 button_text_ids = kPermissionButtonTextIDUserManaged; |
196 break; | 195 break; |
197 case content_settings::SETTING_SOURCE_POLICY: | 196 case content_settings::SETTING_SOURCE_POLICY: |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 // the first time. | 358 // the first time. |
360 return IDR_PAGEINFO_INFO; | 359 return IDR_PAGEINFO_INFO; |
361 } | 360 } |
362 | 361 |
363 // static | 362 // static |
364 const gfx::Image& WebsiteSettingsUI::GetFirstVisitIcon( | 363 const gfx::Image& WebsiteSettingsUI::GetFirstVisitIcon( |
365 const base::string16& first_visit) { | 364 const base::string16& first_visit) { |
366 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 365 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
367 return rb.GetNativeImageNamed(GetFirstVisitIconID(first_visit)); | 366 return rb.GetNativeImageNamed(GetFirstVisitIconID(first_visit)); |
368 } | 367 } |
OLD | NEW |