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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // JavaScript filter. | 318 // JavaScript filter. |
319 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL}, | 319 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL}, |
320 {"javascript_header", IDS_JAVASCRIPT_HEADER}, | 320 {"javascript_header", IDS_JAVASCRIPT_HEADER}, |
321 {"javascriptAllow", IDS_JS_ALLOW_RADIO}, | 321 {"javascriptAllow", IDS_JS_ALLOW_RADIO}, |
322 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO}, | 322 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO}, |
323 // Plug-ins filter. | 323 // Plug-ins filter. |
324 {"pluginsTabLabel", IDS_PLUGIN_TAB_LABEL}, | 324 {"pluginsTabLabel", IDS_PLUGIN_TAB_LABEL}, |
325 {"plugins_header", IDS_PLUGIN_HEADER}, | 325 {"plugins_header", IDS_PLUGIN_HEADER}, |
326 {"pluginsAllow", IDS_PLUGIN_ALLOW_RADIO}, | 326 {"pluginsAllow", IDS_PLUGIN_ALLOW_RADIO}, |
327 {"pluginsDetect", IDS_PLUGIN_DETECT_RADIO}, | 327 {"pluginsDetect", IDS_PLUGIN_DETECT_RADIO}, |
| 328 {"pluginsAsk", IDS_PLUGIN_ASK_RADIO}, |
328 {"pluginsBlock", IDS_PLUGIN_BLOCK_RADIO}, | 329 {"pluginsBlock", IDS_PLUGIN_BLOCK_RADIO}, |
329 {"disableIndividualPlugins", IDS_PLUGIN_SELECTIVE_DISABLE}, | 330 {"disableIndividualPlugins", IDS_PLUGIN_SELECTIVE_DISABLE}, |
330 // Pop-ups filter. | 331 // Pop-ups filter. |
331 {"popupsTabLabel", IDS_POPUP_TAB_LABEL}, | 332 {"popupsTabLabel", IDS_POPUP_TAB_LABEL}, |
332 {"popups_header", IDS_POPUP_HEADER}, | 333 {"popups_header", IDS_POPUP_HEADER}, |
333 {"popupsAllow", IDS_POPUP_ALLOW_RADIO}, | 334 {"popupsAllow", IDS_POPUP_ALLOW_RADIO}, |
334 {"popupsBlock", IDS_POPUP_BLOCK_RADIO}, | 335 {"popupsBlock", IDS_POPUP_BLOCK_RADIO}, |
335 // Location filter. | 336 // Location filter. |
336 {"locationTabLabel", IDS_GEOLOCATION_TAB_LABEL}, | 337 {"locationTabLabel", IDS_GEOLOCATION_TAB_LABEL}, |
337 {"location_header", IDS_GEOLOCATION_HEADER}, | 338 {"location_header", IDS_GEOLOCATION_HEADER}, |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 } | 588 } |
588 | 589 |
589 void ContentSettingsHandler::UpdateSettingDefaultFromModel( | 590 void ContentSettingsHandler::UpdateSettingDefaultFromModel( |
590 ContentSettingsType type) { | 591 ContentSettingsType type) { |
591 Profile* profile = Profile::FromWebUI(web_ui()); | 592 Profile* profile = Profile::FromWebUI(web_ui()); |
592 std::string provider_id; | 593 std::string provider_id; |
593 ContentSetting default_setting = | 594 ContentSetting default_setting = |
594 profile->GetHostContentSettingsMap()->GetDefaultContentSetting( | 595 profile->GetHostContentSettingsMap()->GetDefaultContentSetting( |
595 type, &provider_id); | 596 type, &provider_id); |
596 | 597 |
597 // For Plugins, display the obsolete ASK setting as BLOCK. | |
598 if (type == ContentSettingsType::CONTENT_SETTINGS_TYPE_PLUGINS && | |
599 default_setting == ContentSetting::CONTENT_SETTING_ASK) { | |
600 default_setting = ContentSetting::CONTENT_SETTING_BLOCK; | |
601 } | |
602 | |
603 base::DictionaryValue filter_settings; | 598 base::DictionaryValue filter_settings; |
604 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value", | 599 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value", |
605 ContentSettingToString(default_setting)); | 600 ContentSettingToString(default_setting)); |
606 filter_settings.SetString( | 601 filter_settings.SetString( |
607 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); | 602 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); |
608 | 603 |
609 web_ui()->CallJavascriptFunction( | 604 web_ui()->CallJavascriptFunction( |
610 "ContentSettings.setContentFilterSettingsValue", filter_settings); | 605 "ContentSettings.setContentFilterSettingsValue", filter_settings); |
611 } | 606 } |
612 | 607 |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 | 1520 |
1526 // Exceptions apply only when the feature is enabled. | 1521 // Exceptions apply only when the feature is enabled. |
1527 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1522 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1528 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1523 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1529 web_ui()->CallJavascriptFunction( | 1524 web_ui()->CallJavascriptFunction( |
1530 "ContentSettings.enableProtectedContentExceptions", | 1525 "ContentSettings.enableProtectedContentExceptions", |
1531 base::FundamentalValue(enable_exceptions)); | 1526 base::FundamentalValue(enable_exceptions)); |
1532 } | 1527 } |
1533 | 1528 |
1534 } // namespace options | 1529 } // namespace options |
OLD | NEW |