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

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

Issue 2408613002: Replace kPreferHtmlOverPlugins feature checks with PluginUtils::ShouldPreferHtmlOverPlugi… (Closed)
Patch Set: Replace remaining kPreferHtmlOverPlugins feature checks with PluginUtils::ShouldPreferHtmlOverPlugi… Created 4 years, 2 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 (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 "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
9 #include "chrome/browser/plugins/plugin_utils.h"
8 #include "chrome/browser/plugins/plugins_field_trial.h" 10 #include "chrome/browser/plugins/plugins_field_trial.h"
9 #include "chrome/common/chrome_features.h" 11 #include "chrome/common/chrome_features.h"
10 #include "chrome/grit/chromium_strings.h" 12 #include "chrome/grit/chromium_strings.h"
11 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
12 #include "chrome/grit/theme_resources.h" 14 #include "chrome/grit/theme_resources.h"
13 #include "components/strings/grit/components_strings.h" 15 #include "components/strings/grit/components_strings.h"
14 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/gfx/image/image.h" 18 #include "ui/gfx/image/image.h"
17 19
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 case CONTENT_SETTING_ASK: 224 case CONTENT_SETTING_ASK:
223 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_ASK); 225 return l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_PERMISSION_ASK);
224 default: 226 default:
225 NOTREACHED(); 227 NOTREACHED();
226 return base::string16(); 228 return base::string16();
227 } 229 }
228 } 230 }
229 231
230 // static 232 // static
231 base::string16 WebsiteSettingsUI::PermissionActionToUIString( 233 base::string16 WebsiteSettingsUI::PermissionActionToUIString(
234 Profile* profile,
232 ContentSettingsType type, 235 ContentSettingsType type,
233 ContentSetting setting, 236 ContentSetting setting,
234 ContentSetting default_setting, 237 ContentSetting default_setting,
235 content_settings::SettingSource source) { 238 content_settings::SettingSource source) {
236 ContentSetting effective_setting = setting; 239 ContentSetting effective_setting = setting;
237 if (effective_setting == CONTENT_SETTING_DEFAULT) 240 if (effective_setting == CONTENT_SETTING_DEFAULT)
238 effective_setting = default_setting; 241 effective_setting = default_setting;
239 242
240 #if defined(ENABLE_PLUGINS) 243 #if defined(ENABLE_PLUGINS)
241 effective_setting = 244 HostContentSettingsMap* host_content_settings_map =
242 PluginsFieldTrial::EffectiveContentSetting(type, effective_setting); 245 HostContentSettingsMapFactory::GetForProfile(profile);
246 effective_setting = PluginsFieldTrial::EffectiveContentSetting(
247 host_content_settings_map, type, effective_setting);
243 248
244 // Display the UI string for ASK instead of DETECT for HTML5 by Default. 249 // Display the UI string for ASK instead of DETECT for HTML5 by Default.
245 // TODO(tommycli): Once HTML5 by Default is shipped and the feature flag 250 // TODO(tommycli): Once HTML5 by Default is shipped and the feature flag
246 // is removed, just migrate the actual content setting to ASK. 251 // is removed, just migrate the actual content setting to ASK.
247 if (base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins) && 252 if (PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map) &&
248 effective_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) { 253 effective_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) {
249 effective_setting = CONTENT_SETTING_ASK; 254 effective_setting = CONTENT_SETTING_ASK;
250 } 255 }
251 #endif 256 #endif
252 257
253 const int* button_text_ids = NULL; 258 const int* button_text_ids = NULL;
254 switch (source) { 259 switch (source) {
255 case content_settings::SETTING_SOURCE_USER: 260 case content_settings::SETTING_SOURCE_USER:
256 if (setting == CONTENT_SETTING_DEFAULT) 261 if (setting == CONTENT_SETTING_DEFAULT)
257 button_text_ids = kPermissionButtonTextIDDefaultSetting; 262 button_text_ids = kPermissionButtonTextIDDefaultSetting;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 390 }
386 return resource_id; 391 return resource_id;
387 } 392 }
388 393
389 // static 394 // static
390 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon( 395 const gfx::Image& WebsiteSettingsUI::GetConnectionIcon(
391 WebsiteSettings::SiteConnectionStatus status) { 396 WebsiteSettings::SiteConnectionStatus status) {
392 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 397 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
393 return rb.GetNativeImageNamed(GetConnectionIconID(status)); 398 return rb.GetNativeImageNamed(GetConnectionIconID(status));
394 } 399 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings/website_settings_ui.h ('k') | chrome/browser/ui/webui/options/content_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698