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 <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, | 150 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, |
151 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, | 151 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, |
152 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"}, | 152 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"}, |
153 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"}, | 153 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"}, |
154 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"}, | 154 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"}, |
155 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging"}, | 155 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging"}, |
156 {CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions"}, | 156 {CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions"}, |
157 #if defined(OS_CHROMEOS) | 157 #if defined(OS_CHROMEOS) |
158 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"}, | 158 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"}, |
159 #endif | 159 #endif |
| 160 {CONTENT_SETTINGS_TYPE_KEYGEN, "keygen"}, |
160 }; | 161 }; |
161 | 162 |
162 ChooserContextBase* GetUsbChooserContext(Profile* profile) { | 163 ChooserContextBase* GetUsbChooserContext(Profile* profile) { |
163 return UsbChooserContextFactory::GetForProfile(profile); | 164 return UsbChooserContextFactory::GetForProfile(profile); |
164 } | 165 } |
165 | 166 |
166 const ContentSettingsHandler::ChooserTypeNameEntry kChooserTypeGroupNames[] = { | 167 const ContentSettingsHandler::ChooserTypeNameEntry kChooserTypeGroupNames[] = { |
167 {CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, &GetUsbChooserContext, | 168 {CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, &GetUsbChooserContext, |
168 "usb-devices", "name"}, | 169 "usb-devices", "name"}, |
169 }; | 170 }; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 true, | 224 true, |
224 UserMetricsAction("Options_DefaultPushMessagingSettingChanged")))); | 225 UserMetricsAction("Options_DefaultPushMessagingSettingChanged")))); |
225 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 226 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
226 exceptions_info_map.insert(std::make_pair( | 227 exceptions_info_map.insert(std::make_pair( |
227 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, | 228 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, |
228 ContentSettingWithExceptions( | 229 ContentSettingWithExceptions( |
229 true, | 230 true, |
230 UserMetricsAction( | 231 UserMetricsAction( |
231 "Options_DefaultProtectedMediaIdentifierSettingChanged")))); | 232 "Options_DefaultProtectedMediaIdentifierSettingChanged")))); |
232 #endif | 233 #endif |
| 234 exceptions_info_map.insert(std::make_pair( |
| 235 CONTENT_SETTINGS_TYPE_KEYGEN, |
| 236 ContentSettingWithExceptions( |
| 237 true, UserMetricsAction("Options_DefaultKeygenSettingChanged")))); |
233 | 238 |
234 // Without OTR exceptions. | 239 // Without OTR exceptions. |
235 exceptions_info_map.insert(std::make_pair( | 240 exceptions_info_map.insert(std::make_pair( |
236 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, | 241 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, |
237 ContentSettingWithExceptions( | 242 ContentSettingWithExceptions( |
238 false, | 243 false, |
239 UserMetricsAction("Options_DefaultNotificationsSettingChanged")))); | 244 UserMetricsAction("Options_DefaultNotificationsSettingChanged")))); |
240 exceptions_info_map.insert(std::make_pair( | 245 exceptions_info_map.insert(std::make_pair( |
241 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 246 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
242 ContentSettingWithExceptions( | 247 ContentSettingWithExceptions( |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 {"midiSysExBlock", IDS_MIDI_SYSEX_BLOCK_RADIO}, | 619 {"midiSysExBlock", IDS_MIDI_SYSEX_BLOCK_RADIO}, |
615 // Push messaging strings | 620 // Push messaging strings |
616 {"pushMessagingHeader", IDS_PUSH_MESSAGES_TAB_LABEL}, | 621 {"pushMessagingHeader", IDS_PUSH_MESSAGES_TAB_LABEL}, |
617 {"pushMessagingAllow", IDS_PUSH_MESSSAGING_ALLOW_RADIO}, | 622 {"pushMessagingAllow", IDS_PUSH_MESSSAGING_ALLOW_RADIO}, |
618 {"pushMessagingAsk", IDS_PUSH_MESSSAGING_ASK_RADIO}, | 623 {"pushMessagingAsk", IDS_PUSH_MESSSAGING_ASK_RADIO}, |
619 {"pushMessagingBlock", IDS_PUSH_MESSSAGING_BLOCK_RADIO}, | 624 {"pushMessagingBlock", IDS_PUSH_MESSSAGING_BLOCK_RADIO}, |
620 {"usbDevicesHeader", IDS_USB_DEVICES_HEADER_AND_TAB_LABEL}, | 625 {"usbDevicesHeader", IDS_USB_DEVICES_HEADER_AND_TAB_LABEL}, |
621 {"usbDevicesManage", IDS_USB_DEVICES_MANAGE_BUTTON}, | 626 {"usbDevicesManage", IDS_USB_DEVICES_MANAGE_BUTTON}, |
622 {"zoomlevelsHeader", IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL}, | 627 {"zoomlevelsHeader", IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL}, |
623 {"zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON}, | 628 {"zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON}, |
| 629 // Keygen filter. |
| 630 {"keygenTabLabel", IDS_KEYGEN_TAB_LABEL}, |
| 631 {"keygenHeader", IDS_KEYGEN_HEADER}, |
| 632 {"keygenAllow", IDS_KEYGEN_ALLOW_RADIO}, |
| 633 {"keygenBlock", IDS_KEYGEN_DONOTALLOW_RADIO}, |
624 }; | 634 }; |
625 | 635 |
626 RegisterStrings(localized_strings, resources, arraysize(resources)); | 636 RegisterStrings(localized_strings, resources, arraysize(resources)); |
627 | 637 |
628 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 638 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
629 const base::Value* default_pref = prefs->GetDefaultPrefValue( | 639 const base::Value* default_pref = prefs->GetDefaultPrefValue( |
630 content_settings::WebsiteSettingsRegistry::GetInstance() | 640 content_settings::WebsiteSettingsRegistry::GetInstance() |
631 ->Get(CONTENT_SETTINGS_TYPE_PLUGINS) | 641 ->Get(CONTENT_SETTINGS_TYPE_PLUGINS) |
632 ->default_value_pref_name()); | 642 ->default_value_pref_name()); |
633 | 643 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 RegisterTitle(localized_strings, "ppapi-broker", | 680 RegisterTitle(localized_strings, "ppapi-broker", |
671 IDS_PPAPI_BROKER_TAB_LABEL); | 681 IDS_PPAPI_BROKER_TAB_LABEL); |
672 RegisterTitle(localized_strings, "multiple-automatic-downloads", | 682 RegisterTitle(localized_strings, "multiple-automatic-downloads", |
673 IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL); | 683 IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL); |
674 RegisterTitle(localized_strings, "midi-sysex", | 684 RegisterTitle(localized_strings, "midi-sysex", |
675 IDS_MIDI_SYSEX_TAB_LABEL); | 685 IDS_MIDI_SYSEX_TAB_LABEL); |
676 RegisterTitle(localized_strings, "usb-devices", | 686 RegisterTitle(localized_strings, "usb-devices", |
677 IDS_USB_DEVICES_HEADER_AND_TAB_LABEL); | 687 IDS_USB_DEVICES_HEADER_AND_TAB_LABEL); |
678 RegisterTitle(localized_strings, "zoomlevels", | 688 RegisterTitle(localized_strings, "zoomlevels", |
679 IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL); | 689 IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL); |
| 690 RegisterTitle(localized_strings, "keygen", IDS_KEYGEN_TAB_LABEL); |
680 | 691 |
681 localized_strings->SetString("exceptionsLearnMoreUrl", | 692 localized_strings->SetString("exceptionsLearnMoreUrl", |
682 kExceptionsLearnMoreUrl); | 693 kExceptionsLearnMoreUrl); |
683 } | 694 } |
684 | 695 |
685 void ContentSettingsHandler::InitializeHandler() { | 696 void ContentSettingsHandler::InitializeHandler() { |
686 notification_registrar_.Add( | 697 notification_registrar_.Add( |
687 this, chrome::NOTIFICATION_PROFILE_CREATED, | 698 this, chrome::NOTIFICATION_PROFILE_CREATED, |
688 content::NotificationService::AllSources()); | 699 content::NotificationService::AllSources()); |
689 notification_registrar_.Add( | 700 notification_registrar_.Add( |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 | 1873 |
1863 // Exceptions apply only when the feature is enabled. | 1874 // Exceptions apply only when the feature is enabled. |
1864 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1875 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1865 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1876 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1866 web_ui()->CallJavascriptFunction( | 1877 web_ui()->CallJavascriptFunction( |
1867 "ContentSettings.enableProtectedContentExceptions", | 1878 "ContentSettings.enableProtectedContentExceptions", |
1868 base::FundamentalValue(enable_exceptions)); | 1879 base::FundamentalValue(enable_exceptions)); |
1869 } | 1880 } |
1870 | 1881 |
1871 } // namespace options | 1882 } // namespace options |
OLD | NEW |