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()->CallJavascriptFunction("ContentSettings.setExclusiveAccessVisible", | |
725 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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 | 1644 |
1658 // Exceptions apply only when the feature is enabled. | 1645 // Exceptions apply only when the feature is enabled. |
1659 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1646 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1660 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1647 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1661 web_ui()->CallJavascriptFunction( | 1648 web_ui()->CallJavascriptFunction( |
1662 "ContentSettings.enableProtectedContentExceptions", | 1649 "ContentSettings.enableProtectedContentExceptions", |
1663 base::FundamentalValue(enable_exceptions)); | 1650 base::FundamentalValue(enable_exceptions)); |
1664 } | 1651 } |
1665 | 1652 |
1666 } // namespace options | 1653 } // namespace options |
OLD | NEW |