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

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

Issue 1033103002: Plugin Power Saver: Overhaul plugin-power-saver flags. Show in UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « chrome/browser/ui/website_settings/website_settings_ui.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h"
14 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
15 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
17 #include "base/values.h" 16 #include "base/values.h"
18 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/chrome_notification_types.h" 18 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" 19 #include "chrome/browser/content_settings/web_site_settings_uma_util.h"
21 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
22 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 21 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
23 #include "chrome/browser/extensions/extension_special_storage_policy.h" 22 #include "chrome/browser/extensions/extension_special_storage_policy.h"
24 #include "chrome/browser/notifications/desktop_notification_profile_util.h" 23 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
24 #include "chrome/browser/plugins/plugins_field_trial.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/ui/browser_list.h" 26 #include "chrome/browser/ui/browser_list.h"
27 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 27 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
29 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
30 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
31 #include "chrome/grit/generated_resources.h" 30 #include "chrome/grit/generated_resources.h"
32 #include "chrome/grit/locale_settings.h" 31 #include "chrome/grit/locale_settings.h"
33 #include "components/content_settings/core/browser/content_settings_details.h" 32 #include "components/content_settings/core/browser/content_settings_details.h"
34 #include "components/content_settings/core/browser/content_settings_utils.h" 33 #include "components/content_settings/core/browser/content_settings_utils.h"
35 #include "components/content_settings/core/browser/host_content_settings_map.h" 34 #include "components/content_settings/core/browser/host_content_settings_map.h"
36 #include "components/content_settings/core/common/content_settings.h" 35 #include "components/content_settings/core/common/content_settings.h"
37 #include "components/content_settings/core/common/content_settings_pattern.h" 36 #include "components/content_settings/core/common/content_settings_pattern.h"
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 520 }
522 } 521 }
523 522
524 void ContentSettingsHandler::InitializePage() { 523 void ContentSettingsHandler::InitializePage() {
525 media_settings_ = MediaSettingsInfo(); 524 media_settings_ = MediaSettingsInfo();
526 RefreshFlashMediaSettings(); 525 RefreshFlashMediaSettings();
527 526
528 UpdateHandlersEnabledRadios(); 527 UpdateHandlersEnabledRadios();
529 UpdateAllExceptionsViewsFromModel(); 528 UpdateAllExceptionsViewsFromModel();
530 UpdateProtectedContentExceptionsButton(); 529 UpdateProtectedContentExceptionsButton();
530
531 // For Plugins, allow flag to override displayed content setting.
532 if (PluginsFieldTrial::IsForcePluginPowerSaverEnabled()) {
533 web_ui()->CallJavascriptFunction(
534 "ContentSettings.disablePluginsAllowOption");
535 }
531 } 536 }
532 537
533 void ContentSettingsHandler::OnContentSettingChanged( 538 void ContentSettingsHandler::OnContentSettingChanged(
534 const ContentSettingsPattern& primary_pattern, 539 const ContentSettingsPattern& primary_pattern,
535 const ContentSettingsPattern& secondary_pattern, 540 const ContentSettingsPattern& secondary_pattern,
536 ContentSettingsType content_type, 541 ContentSettingsType content_type,
537 std::string resource_identifier) { 542 std::string resource_identifier) {
538 const ContentSettingsDetails details( 543 const ContentSettingsDetails details(
539 primary_pattern, secondary_pattern, content_type, resource_identifier); 544 primary_pattern, secondary_pattern, content_type, resource_identifier);
540 // TODO(estade): we pretend update_all() is always true. 545 // TODO(estade): we pretend update_all() is always true.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 UpdateFlashMediaLinksVisibility(); 604 UpdateFlashMediaLinksVisibility();
600 } 605 }
601 } 606 }
602 607
603 void ContentSettingsHandler::UpdateSettingDefaultFromModel( 608 void ContentSettingsHandler::UpdateSettingDefaultFromModel(
604 ContentSettingsType type) { 609 ContentSettingsType type) {
605 std::string provider_id; 610 std::string provider_id;
606 ContentSetting default_setting = 611 ContentSetting default_setting =
607 GetContentSettingsMap()->GetDefaultContentSetting(type, &provider_id); 612 GetContentSettingsMap()->GetDefaultContentSetting(type, &provider_id);
608 613
609 // For Plugins, display the obsolete ASK setting as BLOCK. 614 #if defined(ENABLE_PLUGINS)
610 if (type == ContentSettingsType::CONTENT_SETTINGS_TYPE_PLUGINS && 615 default_setting =
611 default_setting == ContentSetting::CONTENT_SETTING_ASK) { 616 PluginsFieldTrial::EffectiveContentSetting(type, default_setting);
612 default_setting = ContentSetting::CONTENT_SETTING_BLOCK; 617 #endif
613 }
614 618
615 base::DictionaryValue filter_settings; 619 base::DictionaryValue filter_settings;
616 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value", 620 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value",
617 ContentSettingToString(default_setting)); 621 ContentSettingToString(default_setting));
618 filter_settings.SetString( 622 filter_settings.SetString(
619 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); 623 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id);
620 624
621 web_ui()->CallJavascriptFunction( 625 web_ui()->CallJavascriptFunction(
622 "ContentSettings.setContentFilterSettingsValue", filter_settings); 626 "ContentSettings.setContentFilterSettingsValue", filter_settings);
623 } 627 }
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 1624
1621 // Exceptions apply only when the feature is enabled. 1625 // Exceptions apply only when the feature is enabled.
1622 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1626 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1623 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1627 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1624 web_ui()->CallJavascriptFunction( 1628 web_ui()->CallJavascriptFunction(
1625 "ContentSettings.enableProtectedContentExceptions", 1629 "ContentSettings.enableProtectedContentExceptions",
1626 base::FundamentalValue(enable_exceptions)); 1630 base::FundamentalValue(enable_exceptions));
1627 } 1631 }
1628 1632
1629 } // namespace options 1633 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings/website_settings_ui.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698