| 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 {"notificationsAsk", IDS_NOTIFICATIONS_ASK_RADIO}, | 540 {"notificationsAsk", IDS_NOTIFICATIONS_ASK_RADIO}, |
| 541 {"notificationsBlock", IDS_NOTIFICATIONS_BLOCK_RADIO}, | 541 {"notificationsBlock", IDS_NOTIFICATIONS_BLOCK_RADIO}, |
| 542 // Fullscreen filter. | 542 // Fullscreen filter. |
| 543 {"fullscreenTabLabel", IDS_FULLSCREEN_TAB_LABEL}, | 543 {"fullscreenTabLabel", IDS_FULLSCREEN_TAB_LABEL}, |
| 544 {"fullscreenHeader", IDS_FULLSCREEN_HEADER}, | 544 {"fullscreenHeader", IDS_FULLSCREEN_HEADER}, |
| 545 {"fullscreenDeprecated", IDS_EXCLUSIVE_ACCESS_DEPRECATED}, | 545 {"fullscreenDeprecated", IDS_EXCLUSIVE_ACCESS_DEPRECATED}, |
| 546 // Mouse Lock filter. | 546 // Mouse Lock filter. |
| 547 {"mouselockTabLabel", IDS_MOUSE_LOCK_TAB_LABEL}, | 547 {"mouselockTabLabel", IDS_MOUSE_LOCK_TAB_LABEL}, |
| 548 {"mouselockHeader", IDS_MOUSE_LOCK_HEADER}, | 548 {"mouselockHeader", IDS_MOUSE_LOCK_HEADER}, |
| 549 {"mouselockDeprecated", IDS_EXCLUSIVE_ACCESS_DEPRECATED}, | 549 {"mouselockDeprecated", IDS_EXCLUSIVE_ACCESS_DEPRECATED}, |
| 550 {"mouselockAllow", IDS_MOUSE_LOCK_ALLOW_RADIO}, | |
| 551 {"mouselockAsk", IDS_MOUSE_LOCK_ASK_RADIO}, | |
| 552 {"mouselockBlock", IDS_MOUSE_LOCK_BLOCK_RADIO}, | |
| 553 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 550 #if defined(OS_CHROMEOS) || defined(OS_WIN) |
| 554 // Protected Content filter | 551 // Protected Content filter |
| 555 {"protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL}, | 552 {"protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL}, |
| 556 {"protectedContentInfo", IDS_PROTECTED_CONTENT_INFO}, | 553 {"protectedContentInfo", IDS_PROTECTED_CONTENT_INFO}, |
| 557 {"protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE}, | 554 {"protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE}, |
| 558 {"protectedContentHeader", IDS_PROTECTED_CONTENT_HEADER}, | 555 {"protectedContentHeader", IDS_PROTECTED_CONTENT_HEADER}, |
| 559 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) | 556 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) |
| 560 // Microphone filter. | 557 // Microphone filter. |
| 561 {"mediaStreamMicTabLabel", IDS_MEDIA_STREAM_MIC_TAB_LABEL}, | 558 {"mediaStreamMicTabLabel", IDS_MEDIA_STREAM_MIC_TAB_LABEL}, |
| 562 {"mediaStreamMicHeader", IDS_MEDIA_STREAM_MIC_HEADER}, | 559 {"mediaStreamMicHeader", IDS_MEDIA_STREAM_MIC_HEADER}, |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 } | 745 } |
| 749 | 746 |
| 750 void ContentSettingsHandler::InitializePage() { | 747 void ContentSettingsHandler::InitializePage() { |
| 751 media_settings_.reset(new MediaSettingsInfo()); | 748 media_settings_.reset(new MediaSettingsInfo()); |
| 752 RefreshFlashMediaSettings(); | 749 RefreshFlashMediaSettings(); |
| 753 | 750 |
| 754 UpdateHandlersEnabledRadios(); | 751 UpdateHandlersEnabledRadios(); |
| 755 UpdateAllExceptionsViewsFromModel(); | 752 UpdateAllExceptionsViewsFromModel(); |
| 756 UpdateAllChooserExceptionsViewsFromModel(); | 753 UpdateAllChooserExceptionsViewsFromModel(); |
| 757 UpdateProtectedContentExceptionsButton(); | 754 UpdateProtectedContentExceptionsButton(); |
| 758 | |
| 759 // Fullscreen and mouselock settings are ignored, but still stored. Always | |
| 760 // show the per-site settings (to give users the ability to view and delete | |
| 761 // exceptions), but hide the global settings. | |
| 762 // TODO(mgiuca): Remove this function and the global setting UI | |
| 763 // (https://crbug.com/610900). Then, delete all the per-site data and remove | |
| 764 // this content setting entirely (https://crbug.com/591896). | |
| 765 web_ui()->CallJavascriptFunction("ContentSettings.setExclusiveAccessVisible", | |
| 766 base::FundamentalValue(true), | |
| 767 base::FundamentalValue(false)); | |
| 768 } | 755 } |
| 769 | 756 |
| 770 void ContentSettingsHandler::OnContentSettingChanged( | 757 void ContentSettingsHandler::OnContentSettingChanged( |
| 771 const ContentSettingsPattern& primary_pattern, | 758 const ContentSettingsPattern& primary_pattern, |
| 772 const ContentSettingsPattern& secondary_pattern, | 759 const ContentSettingsPattern& secondary_pattern, |
| 773 ContentSettingsType content_type, | 760 ContentSettingsType content_type, |
| 774 std::string resource_identifier) { | 761 std::string resource_identifier) { |
| 775 const ContentSettingsDetails details( | 762 const ContentSettingsDetails details( |
| 776 primary_pattern, secondary_pattern, content_type, resource_identifier); | 763 primary_pattern, secondary_pattern, content_type, resource_identifier); |
| 777 // TODO(estade): we pretend update_all() is always true. | 764 // TODO(estade): we pretend update_all() is always true. |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1706 | 1693 |
| 1707 // Exceptions apply only when the feature is enabled. | 1694 // Exceptions apply only when the feature is enabled. |
| 1708 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1695 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
| 1709 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1696 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
| 1710 web_ui()->CallJavascriptFunction( | 1697 web_ui()->CallJavascriptFunction( |
| 1711 "ContentSettings.enableProtectedContentExceptions", | 1698 "ContentSettings.enableProtectedContentExceptions", |
| 1712 base::FundamentalValue(enable_exceptions)); | 1699 base::FundamentalValue(enable_exceptions)); |
| 1713 } | 1700 } |
| 1714 | 1701 |
| 1715 } // namespace options | 1702 } // namespace options |
| OLD | NEW |