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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // JavaScript filter. | 313 // JavaScript filter. |
314 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL}, | 314 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL}, |
315 {"javascript_header", IDS_JAVASCRIPT_HEADER}, | 315 {"javascript_header", IDS_JAVASCRIPT_HEADER}, |
316 {"javascriptAllow", IDS_JS_ALLOW_RADIO}, | 316 {"javascriptAllow", IDS_JS_ALLOW_RADIO}, |
317 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO}, | 317 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO}, |
318 // Plug-ins filter. | 318 // Plug-ins filter. |
319 {"pluginsTabLabel", IDS_PLUGIN_TAB_LABEL}, | 319 {"pluginsTabLabel", IDS_PLUGIN_TAB_LABEL}, |
320 {"plugins_header", IDS_PLUGIN_HEADER}, | 320 {"plugins_header", IDS_PLUGIN_HEADER}, |
321 {"pluginsAllow", IDS_PLUGIN_ALLOW_RADIO}, | 321 {"pluginsAllow", IDS_PLUGIN_ALLOW_RADIO}, |
322 {"pluginsDetect", IDS_PLUGIN_DETECT_RADIO}, | 322 {"pluginsDetect", IDS_PLUGIN_DETECT_RADIO}, |
323 {"pluginsAsk", IDS_PLUGIN_ASK_RADIO}, | |
324 {"pluginsBlock", IDS_PLUGIN_BLOCK_RADIO}, | 323 {"pluginsBlock", IDS_PLUGIN_BLOCK_RADIO}, |
325 {"manageIndividualPlugins", IDS_PLUGIN_MANAGE_INDIVIDUAL}, | 324 {"manageIndividualPlugins", IDS_PLUGIN_MANAGE_INDIVIDUAL}, |
326 // Pop-ups filter. | 325 // Pop-ups filter. |
327 {"popupsTabLabel", IDS_POPUP_TAB_LABEL}, | 326 {"popupsTabLabel", IDS_POPUP_TAB_LABEL}, |
328 {"popups_header", IDS_POPUP_HEADER}, | 327 {"popups_header", IDS_POPUP_HEADER}, |
329 {"popupsAllow", IDS_POPUP_ALLOW_RADIO}, | 328 {"popupsAllow", IDS_POPUP_ALLOW_RADIO}, |
330 {"popupsBlock", IDS_POPUP_BLOCK_RADIO}, | 329 {"popupsBlock", IDS_POPUP_BLOCK_RADIO}, |
331 // Location filter. | 330 // Location filter. |
332 {"locationTabLabel", IDS_GEOLOCATION_TAB_LABEL}, | 331 {"locationTabLabel", IDS_GEOLOCATION_TAB_LABEL}, |
333 {"location_header", IDS_GEOLOCATION_HEADER}, | 332 {"location_header", IDS_GEOLOCATION_HEADER}, |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 } | 597 } |
599 | 598 |
600 void ContentSettingsHandler::UpdateSettingDefaultFromModel( | 599 void ContentSettingsHandler::UpdateSettingDefaultFromModel( |
601 ContentSettingsType type) { | 600 ContentSettingsType type) { |
602 Profile* profile = Profile::FromWebUI(web_ui()); | 601 Profile* profile = Profile::FromWebUI(web_ui()); |
603 std::string provider_id; | 602 std::string provider_id; |
604 ContentSetting default_setting = | 603 ContentSetting default_setting = |
605 profile->GetHostContentSettingsMap()->GetDefaultContentSetting( | 604 profile->GetHostContentSettingsMap()->GetDefaultContentSetting( |
606 type, &provider_id); | 605 type, &provider_id); |
607 | 606 |
| 607 // For Plugins, display the obsolete ASK setting as DETECT. |
| 608 if (type == ContentSettingsType::CONTENT_SETTINGS_TYPE_PLUGINS && |
| 609 default_setting == ContentSetting::CONTENT_SETTING_ASK) { |
| 610 default_setting = ContentSetting::CONTENT_SETTING_DETECT_IMPORTANT_CONTENT; |
| 611 } |
| 612 |
608 base::DictionaryValue filter_settings; | 613 base::DictionaryValue filter_settings; |
609 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value", | 614 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value", |
610 ContentSettingToString(default_setting)); | 615 ContentSettingToString(default_setting)); |
611 filter_settings.SetString( | 616 filter_settings.SetString( |
612 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); | 617 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); |
613 | 618 |
614 web_ui()->CallJavascriptFunction( | 619 web_ui()->CallJavascriptFunction( |
615 "ContentSettings.setContentFilterSettingsValue", filter_settings); | 620 "ContentSettings.setContentFilterSettingsValue", filter_settings); |
616 } | 621 } |
617 | 622 |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 | 1595 |
1591 // Exceptions apply only when the feature is enabled. | 1596 // Exceptions apply only when the feature is enabled. |
1592 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1597 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1593 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1598 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1594 web_ui()->CallJavascriptFunction( | 1599 web_ui()->CallJavascriptFunction( |
1595 "ContentSettings.enableProtectedContentExceptions", | 1600 "ContentSettings.enableProtectedContentExceptions", |
1596 base::FundamentalValue(enable_exceptions)); | 1601 base::FundamentalValue(enable_exceptions)); |
1597 } | 1602 } |
1598 | 1603 |
1599 } // namespace options | 1604 } // namespace options |
OLD | NEW |