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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 const char kEmbeddingOrigin[] = "embeddingOrigin"; | 132 const char kEmbeddingOrigin[] = "embeddingOrigin"; |
133 const char kPreferencesSource[] = "preference"; | 133 const char kPreferencesSource[] = "preference"; |
134 const char kZoom[] = "zoom"; | 134 const char kZoom[] = "zoom"; |
135 const char kObject[] = "object"; | 135 const char kObject[] = "object"; |
136 const char kObjectName[] = "objectName"; | 136 const char kObjectName[] = "objectName"; |
137 | 137 |
138 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { | 138 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { |
139 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, | 139 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, |
140 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, | 140 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, |
141 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, | 141 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, |
| 142 {CONTENT_SETTINGS_TYPE_KEYGEN, "keygen"}, |
142 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, | 143 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, |
143 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, | 144 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, |
144 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, | 145 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, |
145 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, | 146 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, |
146 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, | 147 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, |
147 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, | 148 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, |
148 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, | 149 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, |
149 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"}, | 150 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"}, |
150 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, | 151 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, |
151 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, | 152 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, |
(...skipping 71 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // Image filter. | 530 // Image filter. |
526 {"imagesTabLabel", IDS_IMAGES_TAB_LABEL}, | 531 {"imagesTabLabel", IDS_IMAGES_TAB_LABEL}, |
527 {"imagesHeader", IDS_IMAGES_HEADER}, | 532 {"imagesHeader", IDS_IMAGES_HEADER}, |
528 {"imagesAllow", IDS_IMAGES_LOAD_RADIO}, | 533 {"imagesAllow", IDS_IMAGES_LOAD_RADIO}, |
529 {"imagesBlock", IDS_IMAGES_NOLOAD_RADIO}, | 534 {"imagesBlock", IDS_IMAGES_NOLOAD_RADIO}, |
530 // JavaScript filter. | 535 // JavaScript filter. |
531 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL}, | 536 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL}, |
532 {"javascriptHeader", IDS_JAVASCRIPT_HEADER}, | 537 {"javascriptHeader", IDS_JAVASCRIPT_HEADER}, |
533 {"javascriptAllow", IDS_JS_ALLOW_RADIO}, | 538 {"javascriptAllow", IDS_JS_ALLOW_RADIO}, |
534 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO}, | 539 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO}, |
| 540 // Keygen filter. |
| 541 {"keygenTabLabel", IDS_KEYGEN_TAB_LABEL}, |
| 542 {"keygenHeader", IDS_KEYGEN_HEADER}, |
| 543 {"keygenAllow", IDS_KEYGEN_ALLOW_RADIO}, |
| 544 {"keygenBlock", IDS_KEYGEN_DONOTALLOW_RADIO}, |
535 // Plugins filter. | 545 // Plugins filter. |
536 {"pluginsTabLabel", IDS_PLUGIN_TAB_LABEL}, | 546 {"pluginsTabLabel", IDS_PLUGIN_TAB_LABEL}, |
537 {"pluginsHeader", IDS_PLUGIN_HEADER}, | 547 {"pluginsHeader", IDS_PLUGIN_HEADER}, |
538 {"pluginsAllow", IDS_PLUGIN_ALLOW_RADIO}, | 548 {"pluginsAllow", IDS_PLUGIN_ALLOW_RADIO}, |
539 {"pluginsBlock", IDS_PLUGIN_BLOCK_RADIO}, | 549 {"pluginsBlock", IDS_PLUGIN_BLOCK_RADIO}, |
540 {"pluginsDetectImportantContent", IDS_PLUGIN_DETECT_RECOMMENDED_RADIO}, | 550 {"pluginsDetectImportantContent", IDS_PLUGIN_DETECT_RECOMMENDED_RADIO}, |
541 {"manageIndividualPlugins", IDS_PLUGIN_MANAGE_INDIVIDUAL}, | 551 {"manageIndividualPlugins", IDS_PLUGIN_MANAGE_INDIVIDUAL}, |
542 // Pop-ups filter. | 552 // Pop-ups filter. |
543 {"popupsTabLabel", IDS_POPUP_TAB_LABEL}, | 553 {"popupsTabLabel", IDS_POPUP_TAB_LABEL}, |
544 {"popupsHeader", IDS_POPUP_HEADER}, | 554 {"popupsHeader", IDS_POPUP_HEADER}, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 IDS_CONTENT_SETTINGS_TITLE); | 650 IDS_CONTENT_SETTINGS_TITLE); |
641 | 651 |
642 // Register titles for each of the individual settings whose exception | 652 // Register titles for each of the individual settings whose exception |
643 // dialogs will be processed by |ContentSettingsHandler|. | 653 // dialogs will be processed by |ContentSettingsHandler|. |
644 RegisterTitle(localized_strings, "cookies", | 654 RegisterTitle(localized_strings, "cookies", |
645 IDS_COOKIES_TAB_LABEL); | 655 IDS_COOKIES_TAB_LABEL); |
646 RegisterTitle(localized_strings, "images", | 656 RegisterTitle(localized_strings, "images", |
647 IDS_IMAGES_TAB_LABEL); | 657 IDS_IMAGES_TAB_LABEL); |
648 RegisterTitle(localized_strings, "javascript", | 658 RegisterTitle(localized_strings, "javascript", |
649 IDS_JAVASCRIPT_TAB_LABEL); | 659 IDS_JAVASCRIPT_TAB_LABEL); |
| 660 RegisterTitle(localized_strings, "keygen", IDS_KEYGEN_TAB_LABEL); |
650 RegisterTitle(localized_strings, "plugins", | 661 RegisterTitle(localized_strings, "plugins", |
651 IDS_PLUGIN_TAB_LABEL); | 662 IDS_PLUGIN_TAB_LABEL); |
652 RegisterTitle(localized_strings, "popups", | 663 RegisterTitle(localized_strings, "popups", |
653 IDS_POPUP_TAB_LABEL); | 664 IDS_POPUP_TAB_LABEL); |
654 RegisterTitle(localized_strings, "location", | 665 RegisterTitle(localized_strings, "location", |
655 IDS_GEOLOCATION_TAB_LABEL); | 666 IDS_GEOLOCATION_TAB_LABEL); |
656 RegisterTitle(localized_strings, "notifications", | 667 RegisterTitle(localized_strings, "notifications", |
657 IDS_NOTIFICATIONS_TAB_LABEL); | 668 IDS_NOTIFICATIONS_TAB_LABEL); |
658 RegisterTitle(localized_strings, "fullscreen", | 669 RegisterTitle(localized_strings, "fullscreen", |
659 IDS_FULLSCREEN_TAB_LABEL); | 670 IDS_FULLSCREEN_TAB_LABEL); |
(...skipping 1202 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 |