Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 1412523003: Adding <keygen> Content Setting (UI) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on core CL. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 struct ContentSettingWithExceptions { 73 struct ContentSettingWithExceptions {
74 ContentSettingsType type; 74 ContentSettingsType type;
75 bool has_otr_exceptions; 75 bool has_otr_exceptions;
76 }; 76 };
77 77
78 const ContentSettingWithExceptions kContentTypesWithExceptions[] = { 78 const ContentSettingWithExceptions kContentTypesWithExceptions[] = {
79 // With OTR exceptions. 79 // With OTR exceptions.
80 {CONTENT_SETTINGS_TYPE_COOKIES, true}, 80 {CONTENT_SETTINGS_TYPE_COOKIES, true},
81 {CONTENT_SETTINGS_TYPE_IMAGES, true}, 81 {CONTENT_SETTINGS_TYPE_IMAGES, true},
82 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, true}, 82 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, true},
83 {CONTENT_SETTINGS_TYPE_KEYGEN, true},
83 {CONTENT_SETTINGS_TYPE_PLUGINS, true}, 84 {CONTENT_SETTINGS_TYPE_PLUGINS, true},
84 {CONTENT_SETTINGS_TYPE_POPUPS, true}, 85 {CONTENT_SETTINGS_TYPE_POPUPS, true},
85 {CONTENT_SETTINGS_TYPE_FULLSCREEN, true}, 86 {CONTENT_SETTINGS_TYPE_FULLSCREEN, true},
86 {CONTENT_SETTINGS_TYPE_MOUSELOCK, true}, 87 {CONTENT_SETTINGS_TYPE_MOUSELOCK, true},
87 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, true}, 88 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, true},
88 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, true}, 89 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, true},
89 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) 90 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
90 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, true}, 91 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, true},
91 #endif 92 #endif
92 93
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 const char kAppName[] = "appName"; 129 const char kAppName[] = "appName";
129 const char kAppId[] = "appId"; 130 const char kAppId[] = "appId";
130 const char kEmbeddingOrigin[] = "embeddingOrigin"; 131 const char kEmbeddingOrigin[] = "embeddingOrigin";
131 const char kPreferencesSource[] = "preference"; 132 const char kPreferencesSource[] = "preference";
132 const char kZoom[] = "zoom"; 133 const char kZoom[] = "zoom";
133 134
134 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { 135 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
135 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, 136 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"},
136 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, 137 {CONTENT_SETTINGS_TYPE_IMAGES, "images"},
137 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, 138 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"},
139 {CONTENT_SETTINGS_TYPE_KEYGEN, "keygen"},
138 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, 140 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"},
139 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, 141 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"},
140 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, 142 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"},
141 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, 143 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"},
142 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, 144 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"},
143 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, 145 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"},
144 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, 146 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"},
145 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"}, 147 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"},
146 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, 148 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"},
147 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, 149 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"},
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // Image filter. 386 // Image filter.
385 {"imagesTabLabel", IDS_IMAGES_TAB_LABEL}, 387 {"imagesTabLabel", IDS_IMAGES_TAB_LABEL},
386 {"imagesHeader", IDS_IMAGES_HEADER}, 388 {"imagesHeader", IDS_IMAGES_HEADER},
387 {"imagesAllow", IDS_IMAGES_LOAD_RADIO}, 389 {"imagesAllow", IDS_IMAGES_LOAD_RADIO},
388 {"imagesBlock", IDS_IMAGES_NOLOAD_RADIO}, 390 {"imagesBlock", IDS_IMAGES_NOLOAD_RADIO},
389 // JavaScript filter. 391 // JavaScript filter.
390 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL}, 392 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL},
391 {"javascriptHeader", IDS_JAVASCRIPT_HEADER}, 393 {"javascriptHeader", IDS_JAVASCRIPT_HEADER},
392 {"javascriptAllow", IDS_JS_ALLOW_RADIO}, 394 {"javascriptAllow", IDS_JS_ALLOW_RADIO},
393 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO}, 395 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO},
396 // Keygen filter.
397 {"keygenTabLabel", IDS_KEYGEN_TAB_LABEL},
398 {"keygenHeader", IDS_KEYGEN_HEADER},
399 {"keygenAllow", IDS_KEYGEN_ALLOW_RADIO},
400 {"keygenBlock", IDS_KEYGEN_DONOTALLOW_RADIO},
394 // Plugins filter. 401 // Plugins filter.
395 {"pluginsTabLabel", IDS_PLUGIN_TAB_LABEL}, 402 {"pluginsTabLabel", IDS_PLUGIN_TAB_LABEL},
396 {"pluginsHeader", IDS_PLUGIN_HEADER}, 403 {"pluginsHeader", IDS_PLUGIN_HEADER},
397 {"pluginsAllow", IDS_PLUGIN_ALLOW_RADIO}, 404 {"pluginsAllow", IDS_PLUGIN_ALLOW_RADIO},
398 {"pluginsBlock", IDS_PLUGIN_BLOCK_RADIO}, 405 {"pluginsBlock", IDS_PLUGIN_BLOCK_RADIO},
399 {"pluginsDetectImportantContent", IDS_PLUGIN_DETECT_RECOMMENDED_RADIO}, 406 {"pluginsDetectImportantContent", IDS_PLUGIN_DETECT_RECOMMENDED_RADIO},
400 {"manageIndividualPlugins", IDS_PLUGIN_MANAGE_INDIVIDUAL}, 407 {"manageIndividualPlugins", IDS_PLUGIN_MANAGE_INDIVIDUAL},
401 // Pop-ups filter. 408 // Pop-ups filter.
402 {"popupsTabLabel", IDS_POPUP_TAB_LABEL}, 409 {"popupsTabLabel", IDS_POPUP_TAB_LABEL},
403 {"popupsHeader", IDS_POPUP_HEADER}, 410 {"popupsHeader", IDS_POPUP_HEADER},
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 IDS_CONTENT_SETTINGS_TITLE); 504 IDS_CONTENT_SETTINGS_TITLE);
498 505
499 // Register titles for each of the individual settings whose exception 506 // Register titles for each of the individual settings whose exception
500 // dialogs will be processed by |ContentSettingsHandler|. 507 // dialogs will be processed by |ContentSettingsHandler|.
501 RegisterTitle(localized_strings, "cookies", 508 RegisterTitle(localized_strings, "cookies",
502 IDS_COOKIES_TAB_LABEL); 509 IDS_COOKIES_TAB_LABEL);
503 RegisterTitle(localized_strings, "images", 510 RegisterTitle(localized_strings, "images",
504 IDS_IMAGES_TAB_LABEL); 511 IDS_IMAGES_TAB_LABEL);
505 RegisterTitle(localized_strings, "javascript", 512 RegisterTitle(localized_strings, "javascript",
506 IDS_JAVASCRIPT_TAB_LABEL); 513 IDS_JAVASCRIPT_TAB_LABEL);
514 RegisterTitle(localized_strings, "keygen", IDS_KEYGEN_TAB_LABEL);
507 RegisterTitle(localized_strings, "plugins", 515 RegisterTitle(localized_strings, "plugins",
508 IDS_PLUGIN_TAB_LABEL); 516 IDS_PLUGIN_TAB_LABEL);
509 RegisterTitle(localized_strings, "popups", 517 RegisterTitle(localized_strings, "popups",
510 IDS_POPUP_TAB_LABEL); 518 IDS_POPUP_TAB_LABEL);
511 RegisterTitle(localized_strings, "location", 519 RegisterTitle(localized_strings, "location",
512 IDS_GEOLOCATION_TAB_LABEL); 520 IDS_GEOLOCATION_TAB_LABEL);
513 RegisterTitle(localized_strings, "notifications", 521 RegisterTitle(localized_strings, "notifications",
514 IDS_NOTIFICATIONS_TAB_LABEL); 522 IDS_NOTIFICATIONS_TAB_LABEL);
515 RegisterTitle(localized_strings, "fullscreen", 523 RegisterTitle(localized_strings, "fullscreen",
516 IDS_FULLSCREEN_TAB_LABEL); 524 IDS_FULLSCREEN_TAB_LABEL);
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 UserMetricsAction("Options_DefaultCookieSettingChanged")); 1387 UserMetricsAction("Options_DefaultCookieSettingChanged"));
1380 break; 1388 break;
1381 case CONTENT_SETTINGS_TYPE_IMAGES: 1389 case CONTENT_SETTINGS_TYPE_IMAGES:
1382 content::RecordAction( 1390 content::RecordAction(
1383 UserMetricsAction("Options_DefaultImagesSettingChanged")); 1391 UserMetricsAction("Options_DefaultImagesSettingChanged"));
1384 break; 1392 break;
1385 case CONTENT_SETTINGS_TYPE_JAVASCRIPT: 1393 case CONTENT_SETTINGS_TYPE_JAVASCRIPT:
1386 content::RecordAction( 1394 content::RecordAction(
1387 UserMetricsAction("Options_DefaultJavaScriptSettingChanged")); 1395 UserMetricsAction("Options_DefaultJavaScriptSettingChanged"));
1388 break; 1396 break;
1397 case CONTENT_SETTINGS_TYPE_KEYGEN:
1398 content::RecordAction(
1399 UserMetricsAction("Options_DefaultKeygenSettingChanged"));
1400 break;
1389 case CONTENT_SETTINGS_TYPE_PLUGINS: 1401 case CONTENT_SETTINGS_TYPE_PLUGINS:
1390 content::RecordAction( 1402 content::RecordAction(
1391 UserMetricsAction("Options_DefaultPluginsSettingChanged")); 1403 UserMetricsAction("Options_DefaultPluginsSettingChanged"));
1392 break; 1404 break;
1393 case CONTENT_SETTINGS_TYPE_POPUPS: 1405 case CONTENT_SETTINGS_TYPE_POPUPS:
1394 content::RecordAction( 1406 content::RecordAction(
1395 UserMetricsAction("Options_DefaultPopupsSettingChanged")); 1407 UserMetricsAction("Options_DefaultPopupsSettingChanged"));
1396 break; 1408 break;
1397 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: 1409 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
1398 content::RecordAction( 1410 content::RecordAction(
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 1674
1663 // Exceptions apply only when the feature is enabled. 1675 // Exceptions apply only when the feature is enabled.
1664 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1676 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1665 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1677 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1666 web_ui()->CallJavascriptFunction( 1678 web_ui()->CallJavascriptFunction(
1667 "ContentSettings.enableProtectedContentExceptions", 1679 "ContentSettings.enableProtectedContentExceptions",
1668 base::FundamentalValue(enable_exceptions)); 1680 base::FundamentalValue(enable_exceptions));
1669 } 1681 }
1670 1682
1671 } // namespace options 1683 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698