| 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/webui/options/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
| 27 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 27 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 28 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" | 28 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" |
| 29 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 29 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 30 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 30 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
| 31 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 31 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 32 #include "chrome/browser/notifications/desktop_notification_profile_util.h" | 32 #include "chrome/browser/notifications/desktop_notification_profile_util.h" |
| 33 #include "chrome/browser/permissions/chooser_context_base.h" | 33 #include "chrome/browser/permissions/chooser_context_base.h" |
| 34 #include "chrome/browser/permissions/permission_uma_util.h" | 34 #include "chrome/browser/permissions/permission_uma_util.h" |
| 35 #include "chrome/browser/permissions/permission_util.h" | 35 #include "chrome/browser/permissions/permission_util.h" |
| 36 #include "chrome/browser/plugins/plugin_utils.h" |
| 36 #include "chrome/browser/plugins/plugins_field_trial.h" | 37 #include "chrome/browser/plugins/plugins_field_trial.h" |
| 37 #include "chrome/browser/profiles/profile.h" | 38 #include "chrome/browser/profiles/profile.h" |
| 38 #include "chrome/browser/ui/browser_list.h" | 39 #include "chrome/browser/ui/browser_list.h" |
| 39 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" | 40 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
| 40 #include "chrome/browser/ui/webui/site_settings_helper.h" | 41 #include "chrome/browser/ui/webui/site_settings_helper.h" |
| 41 #include "chrome/browser/usb/usb_chooser_context.h" | 42 #include "chrome/browser/usb/usb_chooser_context.h" |
| 42 #include "chrome/browser/usb/usb_chooser_context_factory.h" | 43 #include "chrome/browser/usb/usb_chooser_context_factory.h" |
| 43 #include "chrome/common/chrome_features.h" | 44 #include "chrome/common/chrome_features.h" |
| 44 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
| 45 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 46 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 // PDF Plugin filter. | 509 // PDF Plugin filter. |
| 509 {"pdfTabLabel", IDS_PDF_TAB_LABEL}, | 510 {"pdfTabLabel", IDS_PDF_TAB_LABEL}, |
| 510 {"pdfEnable", IDS_PDF_ENABLE_CHECKBOX}, | 511 {"pdfEnable", IDS_PDF_ENABLE_CHECKBOX}, |
| 511 }; | 512 }; |
| 512 | 513 |
| 513 RegisterStrings(localized_strings, resources, arraysize(resources)); | 514 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 514 | 515 |
| 515 // TODO(tommycli): When the HTML5 By Default feature flag is on, we want to | 516 // TODO(tommycli): When the HTML5 By Default feature flag is on, we want to |
| 516 // display strings that begin with "Ask...", even though the setting remains | 517 // display strings that begin with "Ask...", even though the setting remains |
| 517 // DETECT. Once this feature is finalized, then we migrate the setting to ASK. | 518 // DETECT. Once this feature is finalized, then we migrate the setting to ASK. |
| 518 bool is_hbd = base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins); | 519 Profile* profile = Profile::FromWebUI(web_ui()); |
| 520 bool is_hbd = PluginUtils::ShouldPreferHtmlOverPlugins( |
| 521 HostContentSettingsMapFactory::GetForProfile(profile)); |
| 519 static OptionsStringResource flash_strings[] = { | 522 static OptionsStringResource flash_strings[] = { |
| 520 {"pluginsDetectImportantContent", | 523 {"pluginsDetectImportantContent", |
| 521 is_hbd ? IDS_FLASH_ASK_RECOMMENDED_RADIO | 524 is_hbd ? IDS_FLASH_ASK_RECOMMENDED_RADIO |
| 522 : IDS_FLASH_DETECT_RECOMMENDED_RADIO}, | 525 : IDS_FLASH_DETECT_RECOMMENDED_RADIO}, |
| 523 {"detectException", | 526 {"detectException", |
| 524 is_hbd ? IDS_EXCEPTIONS_ASK_BUTTON | 527 is_hbd ? IDS_EXCEPTIONS_ASK_BUTTON |
| 525 : IDS_EXCEPTIONS_DETECT_IMPORTANT_CONTENT_BUTTON}, | 528 : IDS_EXCEPTIONS_DETECT_IMPORTANT_CONTENT_BUTTON}, |
| 526 }; | 529 }; |
| 527 RegisterStrings(localized_strings, flash_strings, arraysize(flash_strings)); | 530 RegisterStrings(localized_strings, flash_strings, arraysize(flash_strings)); |
| 528 | 531 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 &settings.exceptions); | 734 &settings.exceptions); |
| 732 | 735 |
| 733 UpdateFlashMediaLinksVisibility(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | 736 UpdateFlashMediaLinksVisibility(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 734 UpdateFlashMediaLinksVisibility(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 737 UpdateFlashMediaLinksVisibility(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 735 } | 738 } |
| 736 } | 739 } |
| 737 | 740 |
| 738 void ContentSettingsHandler::UpdateSettingDefaultFromModel( | 741 void ContentSettingsHandler::UpdateSettingDefaultFromModel( |
| 739 ContentSettingsType type) { | 742 ContentSettingsType type) { |
| 740 std::string provider_id; | 743 std::string provider_id; |
| 744 HostContentSettingsMap* host_content_settings_map = |
| 745 HostContentSettingsMapFactory::GetForProfile(GetProfile()); |
| 741 ContentSetting default_setting = | 746 ContentSetting default_setting = |
| 742 HostContentSettingsMapFactory::GetForProfile(GetProfile()) | 747 host_content_settings_map->GetDefaultContentSetting(type, &provider_id); |
| 743 ->GetDefaultContentSetting(type, &provider_id); | |
| 744 | 748 |
| 745 #if defined(ENABLE_PLUGINS) | 749 #if defined(ENABLE_PLUGINS) |
| 746 default_setting = | 750 default_setting = PluginsFieldTrial::EffectiveContentSetting( |
| 747 PluginsFieldTrial::EffectiveContentSetting(type, default_setting); | 751 host_content_settings_map, type, default_setting); |
| 748 #endif | 752 #endif |
| 749 | 753 |
| 750 // Camera and microphone default content settings cannot be set by the policy. | 754 // Camera and microphone default content settings cannot be set by the policy. |
| 751 // However, the policy can disable them. Treat this case visually in the same | 755 // However, the policy can disable them. Treat this case visually in the same |
| 752 // way as if the policy set the default setting to BLOCK. Furthermore, compare | 756 // way as if the policy set the default setting to BLOCK. Furthermore, compare |
| 753 // the settings with Flash settings and show links to the Flash settings site | 757 // the settings with Flash settings and show links to the Flash settings site |
| 754 // if they differ. | 758 // if they differ. |
| 755 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || | 759 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || |
| 756 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { | 760 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { |
| 757 UpdateMediaSettingsFromPrefs(type); | 761 UpdateMediaSettingsFromPrefs(type); |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 | 1522 |
| 1519 // Exceptions apply only when the feature is enabled. | 1523 // Exceptions apply only when the feature is enabled. |
| 1520 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1524 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
| 1521 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1525 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
| 1522 web_ui()->CallJavascriptFunctionUnsafe( | 1526 web_ui()->CallJavascriptFunctionUnsafe( |
| 1523 "ContentSettings.enableProtectedContentExceptions", | 1527 "ContentSettings.enableProtectedContentExceptions", |
| 1524 base::FundamentalValue(enable_exceptions)); | 1528 base::FundamentalValue(enable_exceptions)); |
| 1525 } | 1529 } |
| 1526 | 1530 |
| 1527 } // namespace options | 1531 } // namespace options |
| OLD | NEW |