| 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 <utility> | 10 #include <utility> |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 {"notificationsAsk", IDS_NOTIFICATIONS_ASK_RADIO}, | 499 {"notificationsAsk", IDS_NOTIFICATIONS_ASK_RADIO}, |
| 500 {"notificationsBlock", IDS_NOTIFICATIONS_BLOCK_RADIO}, | 500 {"notificationsBlock", IDS_NOTIFICATIONS_BLOCK_RADIO}, |
| 501 // Fullscreen filter. | 501 // Fullscreen filter. |
| 502 {"fullscreenTabLabel", IDS_FULLSCREEN_TAB_LABEL}, | 502 {"fullscreenTabLabel", IDS_FULLSCREEN_TAB_LABEL}, |
| 503 {"fullscreenHeader", IDS_FULLSCREEN_HEADER}, | 503 {"fullscreenHeader", IDS_FULLSCREEN_HEADER}, |
| 504 {"fullscreenDeprecated", IDS_EXCLUSIVE_ACCESS_DEPRECATED}, | 504 {"fullscreenDeprecated", IDS_EXCLUSIVE_ACCESS_DEPRECATED}, |
| 505 // Mouse Lock filter. | 505 // Mouse Lock filter. |
| 506 {"mouselockTabLabel", IDS_MOUSE_LOCK_TAB_LABEL}, | 506 {"mouselockTabLabel", IDS_MOUSE_LOCK_TAB_LABEL}, |
| 507 {"mouselockHeader", IDS_MOUSE_LOCK_HEADER}, | 507 {"mouselockHeader", IDS_MOUSE_LOCK_HEADER}, |
| 508 {"mouselockDeprecated", IDS_EXCLUSIVE_ACCESS_DEPRECATED}, | 508 {"mouselockDeprecated", IDS_EXCLUSIVE_ACCESS_DEPRECATED}, |
| 509 {"mouselockAllow", IDS_MOUSE_LOCK_ALLOW_RADIO}, | |
| 510 {"mouselockAsk", IDS_MOUSE_LOCK_ASK_RADIO}, | |
| 511 {"mouselockBlock", IDS_MOUSE_LOCK_BLOCK_RADIO}, | |
| 512 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 509 #if defined(OS_CHROMEOS) || defined(OS_WIN) |
| 513 // Protected Content filter | 510 // Protected Content filter |
| 514 {"protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL}, | 511 {"protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL}, |
| 515 {"protectedContentInfo", IDS_PROTECTED_CONTENT_INFO}, | 512 {"protectedContentInfo", IDS_PROTECTED_CONTENT_INFO}, |
| 516 {"protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE}, | 513 {"protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE}, |
| 517 {"protectedContentHeader", IDS_PROTECTED_CONTENT_HEADER}, | 514 {"protectedContentHeader", IDS_PROTECTED_CONTENT_HEADER}, |
| 518 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) | 515 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) |
| 519 // Microphone filter. | 516 // Microphone filter. |
| 520 {"mediaStreamMicTabLabel", IDS_MEDIA_STREAM_MIC_TAB_LABEL}, | 517 {"mediaStreamMicTabLabel", IDS_MEDIA_STREAM_MIC_TAB_LABEL}, |
| 521 {"mediaStreamMicHeader", IDS_MEDIA_STREAM_MIC_HEADER}, | 518 {"mediaStreamMicHeader", IDS_MEDIA_STREAM_MIC_HEADER}, |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 } | 704 } |
| 708 | 705 |
| 709 void ContentSettingsHandler::InitializePage() { | 706 void ContentSettingsHandler::InitializePage() { |
| 710 media_settings_.reset(new MediaSettingsInfo()); | 707 media_settings_.reset(new MediaSettingsInfo()); |
| 711 RefreshFlashMediaSettings(); | 708 RefreshFlashMediaSettings(); |
| 712 | 709 |
| 713 UpdateHandlersEnabledRadios(); | 710 UpdateHandlersEnabledRadios(); |
| 714 UpdateAllExceptionsViewsFromModel(); | 711 UpdateAllExceptionsViewsFromModel(); |
| 715 UpdateAllChooserExceptionsViewsFromModel(); | 712 UpdateAllChooserExceptionsViewsFromModel(); |
| 716 UpdateProtectedContentExceptionsButton(); | 713 UpdateProtectedContentExceptionsButton(); |
| 717 | |
| 718 // Fullscreen and mouselock settings are ignored, but still stored. Always | |
| 719 // show the per-site settings (to give users the ability to view and delete | |
| 720 // exceptions), but hide the global settings. | |
| 721 // TODO(mgiuca): Remove this function and the global setting UI | |
| 722 // (https://crbug.com/610900). Then, delete all the per-site data and remove | |
| 723 // this content setting entirely (https://crbug.com/591896). | |
| 724 web_ui()->CallJavascriptFunctionUnsafe( | |
| 725 "ContentSettings.setExclusiveAccessVisible", base::FundamentalValue(true), | |
| 726 base::FundamentalValue(false)); | |
| 727 } | 714 } |
| 728 | 715 |
| 729 void ContentSettingsHandler::OnContentSettingChanged( | 716 void ContentSettingsHandler::OnContentSettingChanged( |
| 730 const ContentSettingsPattern& primary_pattern, | 717 const ContentSettingsPattern& primary_pattern, |
| 731 const ContentSettingsPattern& secondary_pattern, | 718 const ContentSettingsPattern& secondary_pattern, |
| 732 ContentSettingsType content_type, | 719 ContentSettingsType content_type, |
| 733 std::string resource_identifier) { | 720 std::string resource_identifier) { |
| 734 const ContentSettingsDetails details( | 721 const ContentSettingsDetails details( |
| 735 primary_pattern, secondary_pattern, content_type, resource_identifier); | 722 primary_pattern, secondary_pattern, content_type, resource_identifier); |
| 736 // TODO(estade): we pretend update_all() is always true. | 723 // TODO(estade): we pretend update_all() is always true. |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 site_settings::GetExceptionsFromHostContentSettingsMap( | 1154 site_settings::GetExceptionsFromHostContentSettingsMap( |
| 1168 GetContentSettingsMap(), type, web_ui(), &exceptions); | 1155 GetContentSettingsMap(), type, web_ui(), &exceptions); |
| 1169 base::StringValue type_string( | 1156 base::StringValue type_string( |
| 1170 site_settings::ContentSettingsTypeToGroupName(type)); | 1157 site_settings::ContentSettingsTypeToGroupName(type)); |
| 1171 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", | 1158 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", |
| 1172 | 1159 |
| 1173 type_string, exceptions); | 1160 type_string, exceptions); |
| 1174 | 1161 |
| 1175 UpdateExceptionsViewFromOTRHostContentSettingsMap(type); | 1162 UpdateExceptionsViewFromOTRHostContentSettingsMap(type); |
| 1176 | 1163 |
| 1177 // TODO(koz): The default for fullscreen is always 'ask'. | 1164 // Fullscreen and mouse lock have no global settings to update. |
| 1178 // http://crbug.com/104683 | 1165 // TODO(mgiuca): Delete this after removing these content settings entirely |
| 1179 if (type == CONTENT_SETTINGS_TYPE_FULLSCREEN) | 1166 // (https://crbug.com/591896). |
| 1167 if (type == CONTENT_SETTINGS_TYPE_FULLSCREEN || |
| 1168 type == CONTENT_SETTINGS_TYPE_MOUSELOCK) { |
| 1180 return; | 1169 return; |
| 1170 } |
| 1181 | 1171 |
| 1182 #if defined(OS_CHROMEOS) | 1172 #if defined(OS_CHROMEOS) |
| 1183 // Also the default for protected contents is managed in another place. | 1173 // Also the default for protected contents is managed in another place. |
| 1184 if (type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) | 1174 if (type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) |
| 1185 return; | 1175 return; |
| 1186 #endif | 1176 #endif |
| 1187 | 1177 |
| 1188 // The default may also have changed (we won't get a separate notification). | 1178 // The default may also have changed (we won't get a separate notification). |
| 1189 // If it hasn't changed, this call will be harmless. | 1179 // If it hasn't changed, this call will be harmless. |
| 1190 UpdateSettingDefaultFromModel(type); | 1180 UpdateSettingDefaultFromModel(type); |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 | 1645 |
| 1656 // Exceptions apply only when the feature is enabled. | 1646 // Exceptions apply only when the feature is enabled. |
| 1657 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1647 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
| 1658 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1648 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
| 1659 web_ui()->CallJavascriptFunctionUnsafe( | 1649 web_ui()->CallJavascriptFunctionUnsafe( |
| 1660 "ContentSettings.enableProtectedContentExceptions", | 1650 "ContentSettings.enableProtectedContentExceptions", |
| 1661 base::FundamentalValue(enable_exceptions)); | 1651 base::FundamentalValue(enable_exceptions)); |
| 1662 } | 1652 } |
| 1663 | 1653 |
| 1664 } // namespace options | 1654 } // namespace options |
| OLD | NEW |