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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const char* kAppId = "appId"; | 86 const char* kAppId = "appId"; |
87 const char* kEmbeddingOrigin = "embeddingOrigin"; | 87 const char* kEmbeddingOrigin = "embeddingOrigin"; |
88 const char* kPreferencesSource = "preference"; | 88 const char* kPreferencesSource = "preference"; |
89 const char* kVideoSetting = "video"; | 89 const char* kVideoSetting = "video"; |
90 const char* kZoom = "zoom"; | 90 const char* kZoom = "zoom"; |
91 | 91 |
92 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { | 92 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { |
93 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, | 93 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, |
94 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, | 94 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, |
95 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, | 95 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, |
| 96 {CONTENT_SETTINGS_TYPE_MEDIA, "media"}, |
96 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, | 97 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, |
97 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, | 98 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, |
98 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, | 99 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, |
99 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, | 100 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, |
100 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, | 101 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, |
101 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, | 102 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, |
102 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, | 103 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, |
103 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"}, | 104 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"}, |
104 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"}, | 105 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"}, |
105 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, | 106 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // Image filter. | 328 // Image filter. |
328 { "images_tab_label", IDS_IMAGES_TAB_LABEL }, | 329 { "images_tab_label", IDS_IMAGES_TAB_LABEL }, |
329 { "images_header", IDS_IMAGES_HEADER }, | 330 { "images_header", IDS_IMAGES_HEADER }, |
330 { "images_allow", IDS_IMAGES_LOAD_RADIO }, | 331 { "images_allow", IDS_IMAGES_LOAD_RADIO }, |
331 { "images_block", IDS_IMAGES_NOLOAD_RADIO }, | 332 { "images_block", IDS_IMAGES_NOLOAD_RADIO }, |
332 // JavaScript filter. | 333 // JavaScript filter. |
333 { "javascript_tab_label", IDS_JAVASCRIPT_TAB_LABEL }, | 334 { "javascript_tab_label", IDS_JAVASCRIPT_TAB_LABEL }, |
334 { "javascript_header", IDS_JAVASCRIPT_HEADER }, | 335 { "javascript_header", IDS_JAVASCRIPT_HEADER }, |
335 { "javascript_allow", IDS_JS_ALLOW_RADIO }, | 336 { "javascript_allow", IDS_JS_ALLOW_RADIO }, |
336 { "javascript_block", IDS_JS_DONOTALLOW_RADIO }, | 337 { "javascript_block", IDS_JS_DONOTALLOW_RADIO }, |
| 338 // Media (HTML5 <audio> and <video>) filter. |
| 339 { "media_tab_label", IDS_MEDIA_TAB_LABEL }, |
| 340 { "media_header", IDS_MEDIA_HEADER }, |
| 341 { "media_allow", IDS_MEDIA_LOAD_RADIO }, |
| 342 { "media_block", IDS_MEDIA_NOLOAD_RADIO }, |
337 // Plug-ins filter. | 343 // Plug-ins filter. |
338 { "plugins_tab_label", IDS_PLUGIN_TAB_LABEL }, | 344 { "plugins_tab_label", IDS_PLUGIN_TAB_LABEL }, |
339 { "plugins_header", IDS_PLUGIN_HEADER }, | 345 { "plugins_header", IDS_PLUGIN_HEADER }, |
340 { "plugins_ask", IDS_PLUGIN_ASK_RADIO }, | 346 { "plugins_ask", IDS_PLUGIN_ASK_RADIO }, |
341 { "plugins_allow", IDS_PLUGIN_LOAD_RADIO }, | 347 { "plugins_allow", IDS_PLUGIN_LOAD_RADIO }, |
342 { "plugins_block", IDS_PLUGIN_NOLOAD_RADIO }, | 348 { "plugins_block", IDS_PLUGIN_NOLOAD_RADIO }, |
343 { "disableIndividualPlugins", IDS_PLUGIN_SELECTIVE_DISABLE }, | 349 { "disableIndividualPlugins", IDS_PLUGIN_SELECTIVE_DISABLE }, |
344 // Pop-ups filter. | 350 // Pop-ups filter. |
345 { "popups_tab_label", IDS_POPUP_TAB_LABEL }, | 351 { "popups_tab_label", IDS_POPUP_TAB_LABEL }, |
346 { "popups_header", IDS_POPUP_HEADER }, | 352 { "popups_header", IDS_POPUP_HEADER }, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 IDS_CONTENT_SETTINGS_TITLE); | 435 IDS_CONTENT_SETTINGS_TITLE); |
430 | 436 |
431 // Register titles for each of the individual settings whose exception | 437 // Register titles for each of the individual settings whose exception |
432 // dialogs will be processed by |ContentSettingsHandler|. | 438 // dialogs will be processed by |ContentSettingsHandler|. |
433 RegisterTitle(localized_strings, "cookies", | 439 RegisterTitle(localized_strings, "cookies", |
434 IDS_COOKIES_TAB_LABEL); | 440 IDS_COOKIES_TAB_LABEL); |
435 RegisterTitle(localized_strings, "images", | 441 RegisterTitle(localized_strings, "images", |
436 IDS_IMAGES_TAB_LABEL); | 442 IDS_IMAGES_TAB_LABEL); |
437 RegisterTitle(localized_strings, "javascript", | 443 RegisterTitle(localized_strings, "javascript", |
438 IDS_JAVASCRIPT_TAB_LABEL); | 444 IDS_JAVASCRIPT_TAB_LABEL); |
| 445 RegisterTitle(localized_strings, "media", |
| 446 IDS_MEDIA_TAB_LABEL); |
439 RegisterTitle(localized_strings, "plugins", | 447 RegisterTitle(localized_strings, "plugins", |
440 IDS_PLUGIN_TAB_LABEL); | 448 IDS_PLUGIN_TAB_LABEL); |
441 RegisterTitle(localized_strings, "popups", | 449 RegisterTitle(localized_strings, "popups", |
442 IDS_POPUP_TAB_LABEL); | 450 IDS_POPUP_TAB_LABEL); |
443 RegisterTitle(localized_strings, "location", | 451 RegisterTitle(localized_strings, "location", |
444 IDS_GEOLOCATION_TAB_LABEL); | 452 IDS_GEOLOCATION_TAB_LABEL); |
445 RegisterTitle(localized_strings, "notifications", | 453 RegisterTitle(localized_strings, "notifications", |
446 IDS_NOTIFICATIONS_TAB_LABEL); | 454 IDS_NOTIFICATIONS_TAB_LABEL); |
447 RegisterTitle(localized_strings, "fullscreen", | 455 RegisterTitle(localized_strings, "fullscreen", |
448 IDS_FULLSCREEN_TAB_LABEL); | 456 IDS_FULLSCREEN_TAB_LABEL); |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 UserMetricsAction("Options_DefaultCookieSettingChanged")); | 1335 UserMetricsAction("Options_DefaultCookieSettingChanged")); |
1328 break; | 1336 break; |
1329 case CONTENT_SETTINGS_TYPE_IMAGES: | 1337 case CONTENT_SETTINGS_TYPE_IMAGES: |
1330 content::RecordAction( | 1338 content::RecordAction( |
1331 UserMetricsAction("Options_DefaultImagesSettingChanged")); | 1339 UserMetricsAction("Options_DefaultImagesSettingChanged")); |
1332 break; | 1340 break; |
1333 case CONTENT_SETTINGS_TYPE_JAVASCRIPT: | 1341 case CONTENT_SETTINGS_TYPE_JAVASCRIPT: |
1334 content::RecordAction( | 1342 content::RecordAction( |
1335 UserMetricsAction("Options_DefaultJavaScriptSettingChanged")); | 1343 UserMetricsAction("Options_DefaultJavaScriptSettingChanged")); |
1336 break; | 1344 break; |
| 1345 case CONTENT_SETTINGS_TYPE_MEDIA: |
| 1346 content::RecordAction( |
| 1347 UserMetricsAction("Options_DefaultMediaSettingChanged")); |
| 1348 break; |
1337 case CONTENT_SETTINGS_TYPE_PLUGINS: | 1349 case CONTENT_SETTINGS_TYPE_PLUGINS: |
1338 content::RecordAction( | 1350 content::RecordAction( |
1339 UserMetricsAction("Options_DefaultPluginsSettingChanged")); | 1351 UserMetricsAction("Options_DefaultPluginsSettingChanged")); |
1340 break; | 1352 break; |
1341 case CONTENT_SETTINGS_TYPE_POPUPS: | 1353 case CONTENT_SETTINGS_TYPE_POPUPS: |
1342 content::RecordAction( | 1354 content::RecordAction( |
1343 UserMetricsAction("Options_DefaultPopupsSettingChanged")); | 1355 UserMetricsAction("Options_DefaultPopupsSettingChanged")); |
1344 break; | 1356 break; |
1345 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 1357 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
1346 content::RecordAction( | 1358 content::RecordAction( |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { | 1578 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { |
1567 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 1579 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
1568 // Exceptions apply only when the feature is enabled. | 1580 // Exceptions apply only when the feature is enabled. |
1569 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1581 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1570 web_ui()->CallJavascriptFunction( | 1582 web_ui()->CallJavascriptFunction( |
1571 "ContentSettings.enableProtectedContentExceptions", | 1583 "ContentSettings.enableProtectedContentExceptions", |
1572 base::FundamentalValue(enable_exceptions)); | 1584 base::FundamentalValue(enable_exceptions)); |
1573 } | 1585 } |
1574 | 1586 |
1575 } // namespace options | 1587 } // namespace options |
OLD | NEW |