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 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, | 154 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, |
155 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, | 155 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, |
156 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"}, | 156 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"}, |
157 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"}, | 157 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"}, |
158 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"}, | 158 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"}, |
159 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging"}, | 159 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging"}, |
160 {CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions"}, | 160 {CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions"}, |
161 #if defined(OS_CHROMEOS) | 161 #if defined(OS_CHROMEOS) |
162 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"}, | 162 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"}, |
163 #endif | 163 #endif |
| 164 {CONTENT_SETTINGS_TYPE_KEYGEN, "keygen"}, |
164 }; | 165 }; |
165 | 166 |
166 ChooserContextBase* GetUsbChooserContext(Profile* profile) { | 167 ChooserContextBase* GetUsbChooserContext(Profile* profile) { |
167 return UsbChooserContextFactory::GetForProfile(profile); | 168 return UsbChooserContextFactory::GetForProfile(profile); |
168 } | 169 } |
169 | 170 |
170 const ContentSettingsHandler::ChooserTypeNameEntry kChooserTypeGroupNames[] = { | 171 const ContentSettingsHandler::ChooserTypeNameEntry kChooserTypeGroupNames[] = { |
171 {CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, &GetUsbChooserContext, | 172 {CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, &GetUsbChooserContext, |
172 "usb-devices", "name"}, | 173 "usb-devices", "name"}, |
173 }; | 174 }; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 true, | 228 true, |
228 UserMetricsAction("Options_DefaultPushMessagingSettingChanged")))); | 229 UserMetricsAction("Options_DefaultPushMessagingSettingChanged")))); |
229 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 230 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
230 exceptions_info_map.insert(std::make_pair( | 231 exceptions_info_map.insert(std::make_pair( |
231 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, | 232 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, |
232 ContentSettingWithExceptions( | 233 ContentSettingWithExceptions( |
233 true, | 234 true, |
234 UserMetricsAction( | 235 UserMetricsAction( |
235 "Options_DefaultProtectedMediaIdentifierSettingChanged")))); | 236 "Options_DefaultProtectedMediaIdentifierSettingChanged")))); |
236 #endif | 237 #endif |
| 238 exceptions_info_map.insert(std::make_pair( |
| 239 CONTENT_SETTINGS_TYPE_KEYGEN, |
| 240 ContentSettingWithExceptions( |
| 241 true, UserMetricsAction("Options_DefaultKeygenSettingChanged")))); |
237 | 242 |
238 // Without OTR exceptions. | 243 // Without OTR exceptions. |
239 exceptions_info_map.insert(std::make_pair( | 244 exceptions_info_map.insert(std::make_pair( |
240 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 245 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
241 ContentSettingWithExceptions( | 246 ContentSettingWithExceptions( |
242 false, | 247 false, |
243 UserMetricsAction("Options_DefaultNotificationsSettingChanged")))); | 248 UserMetricsAction("Options_DefaultNotificationsSettingChanged")))); |
244 exceptions_info_map.insert(std::make_pair( | 249 exceptions_info_map.insert(std::make_pair( |
245 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 250 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
246 ContentSettingWithExceptions( | 251 ContentSettingWithExceptions( |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 {"midiSysExBlock", IDS_MIDI_SYSEX_BLOCK_RADIO}, | 623 {"midiSysExBlock", IDS_MIDI_SYSEX_BLOCK_RADIO}, |
619 // Push messaging strings | 624 // Push messaging strings |
620 {"pushMessagingHeader", IDS_PUSH_MESSAGES_TAB_LABEL}, | 625 {"pushMessagingHeader", IDS_PUSH_MESSAGES_TAB_LABEL}, |
621 {"pushMessagingAllow", IDS_PUSH_MESSSAGING_ALLOW_RADIO}, | 626 {"pushMessagingAllow", IDS_PUSH_MESSSAGING_ALLOW_RADIO}, |
622 {"pushMessagingAsk", IDS_PUSH_MESSSAGING_ASK_RADIO}, | 627 {"pushMessagingAsk", IDS_PUSH_MESSSAGING_ASK_RADIO}, |
623 {"pushMessagingBlock", IDS_PUSH_MESSSAGING_BLOCK_RADIO}, | 628 {"pushMessagingBlock", IDS_PUSH_MESSSAGING_BLOCK_RADIO}, |
624 {"usbDevicesHeader", IDS_USB_DEVICES_HEADER_AND_TAB_LABEL}, | 629 {"usbDevicesHeader", IDS_USB_DEVICES_HEADER_AND_TAB_LABEL}, |
625 {"usbDevicesManage", IDS_USB_DEVICES_MANAGE_BUTTON}, | 630 {"usbDevicesManage", IDS_USB_DEVICES_MANAGE_BUTTON}, |
626 {"zoomlevelsHeader", IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL}, | 631 {"zoomlevelsHeader", IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL}, |
627 {"zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON}, | 632 {"zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON}, |
| 633 // Keygen filter. |
| 634 {"keygenTabLabel", IDS_KEYGEN_TAB_LABEL}, |
| 635 {"keygenHeader", IDS_KEYGEN_HEADER}, |
| 636 {"keygenAllow", IDS_KEYGEN_ALLOW_RADIO}, |
| 637 {"keygenBlock", IDS_KEYGEN_DONOTALLOW_RADIO}, |
628 }; | 638 }; |
629 | 639 |
630 RegisterStrings(localized_strings, resources, arraysize(resources)); | 640 RegisterStrings(localized_strings, resources, arraysize(resources)); |
631 | 641 |
632 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 642 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
633 const base::Value* default_pref = prefs->GetDefaultPrefValue( | 643 const base::Value* default_pref = prefs->GetDefaultPrefValue( |
634 content_settings::WebsiteSettingsRegistry::GetInstance() | 644 content_settings::WebsiteSettingsRegistry::GetInstance() |
635 ->Get(CONTENT_SETTINGS_TYPE_PLUGINS) | 645 ->Get(CONTENT_SETTINGS_TYPE_PLUGINS) |
636 ->default_value_pref_name()); | 646 ->default_value_pref_name()); |
637 | 647 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 RegisterTitle(localized_strings, "ppapi-broker", | 684 RegisterTitle(localized_strings, "ppapi-broker", |
675 IDS_PPAPI_BROKER_TAB_LABEL); | 685 IDS_PPAPI_BROKER_TAB_LABEL); |
676 RegisterTitle(localized_strings, "multiple-automatic-downloads", | 686 RegisterTitle(localized_strings, "multiple-automatic-downloads", |
677 IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL); | 687 IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL); |
678 RegisterTitle(localized_strings, "midi-sysex", | 688 RegisterTitle(localized_strings, "midi-sysex", |
679 IDS_MIDI_SYSEX_TAB_LABEL); | 689 IDS_MIDI_SYSEX_TAB_LABEL); |
680 RegisterTitle(localized_strings, "usb-devices", | 690 RegisterTitle(localized_strings, "usb-devices", |
681 IDS_USB_DEVICES_HEADER_AND_TAB_LABEL); | 691 IDS_USB_DEVICES_HEADER_AND_TAB_LABEL); |
682 RegisterTitle(localized_strings, "zoomlevels", | 692 RegisterTitle(localized_strings, "zoomlevels", |
683 IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL); | 693 IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL); |
| 694 RegisterTitle(localized_strings, "keygen", IDS_KEYGEN_TAB_LABEL); |
684 | 695 |
685 localized_strings->SetString("exceptionsLearnMoreUrl", | 696 localized_strings->SetString("exceptionsLearnMoreUrl", |
686 kExceptionsLearnMoreUrl); | 697 kExceptionsLearnMoreUrl); |
687 } | 698 } |
688 | 699 |
689 void ContentSettingsHandler::InitializeHandler() { | 700 void ContentSettingsHandler::InitializeHandler() { |
690 notification_registrar_.Add( | 701 notification_registrar_.Add( |
691 this, chrome::NOTIFICATION_PROFILE_CREATED, | 702 this, chrome::NOTIFICATION_PROFILE_CREATED, |
692 content::NotificationService::AllSources()); | 703 content::NotificationService::AllSources()); |
693 notification_registrar_.Add( | 704 notification_registrar_.Add( |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1794 | 1805 |
1795 // Exceptions apply only when the feature is enabled. | 1806 // Exceptions apply only when the feature is enabled. |
1796 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1807 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1797 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1808 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1798 web_ui()->CallJavascriptFunction( | 1809 web_ui()->CallJavascriptFunction( |
1799 "ContentSettings.enableProtectedContentExceptions", | 1810 "ContentSettings.enableProtectedContentExceptions", |
1800 base::FundamentalValue(enable_exceptions)); | 1811 base::FundamentalValue(enable_exceptions)); |
1801 } | 1812 } |
1802 | 1813 |
1803 } // namespace options | 1814 } // namespace options |
OLD | NEW |