| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "content/public/browser/user_metrics.h" | 67 #include "content/public/browser/user_metrics.h" |
| 68 #include "content/public/browser/web_contents.h" | 68 #include "content/public/browser/web_contents.h" |
| 69 #include "content/public/browser/web_ui.h" | 69 #include "content/public/browser/web_ui.h" |
| 70 #include "content/public/common/content_switches.h" | 70 #include "content/public/common/content_switches.h" |
| 71 #include "content/public/common/page_zoom.h" | 71 #include "content/public/common/page_zoom.h" |
| 72 #include "content/public/common/url_constants.h" | 72 #include "content/public/common/url_constants.h" |
| 73 #include "extensions/browser/extension_registry.h" | 73 #include "extensions/browser/extension_registry.h" |
| 74 #include "extensions/common/extension_set.h" | 74 #include "extensions/common/extension_set.h" |
| 75 #include "extensions/common/permissions/api_permission.h" | 75 #include "extensions/common/permissions/api_permission.h" |
| 76 #include "extensions/common/permissions/permissions_data.h" | 76 #include "extensions/common/permissions/permissions_data.h" |
| 77 #include "ppapi/features/features.h" |
| 77 #include "ui/base/l10n/l10n_util.h" | 78 #include "ui/base/l10n/l10n_util.h" |
| 78 | 79 |
| 79 #if defined(OS_CHROMEOS) | 80 #if defined(OS_CHROMEOS) |
| 80 #include "components/user_manager/user_manager.h" | 81 #include "components/user_manager/user_manager.h" |
| 81 #endif | 82 #endif |
| 82 | 83 |
| 83 using base::UserMetricsAction; | 84 using base::UserMetricsAction; |
| 84 using content_settings::ContentSettingToString; | 85 using content_settings::ContentSettingToString; |
| 85 using content_settings::ContentSettingFromString; | 86 using content_settings::ContentSettingFromString; |
| 86 using extensions::APIPermission; | 87 using extensions::APIPermission; |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 } | 718 } |
| 718 | 719 |
| 719 void ContentSettingsHandler::UpdateSettingDefaultFromModel( | 720 void ContentSettingsHandler::UpdateSettingDefaultFromModel( |
| 720 ContentSettingsType type) { | 721 ContentSettingsType type) { |
| 721 std::string provider_id; | 722 std::string provider_id; |
| 722 HostContentSettingsMap* host_content_settings_map = | 723 HostContentSettingsMap* host_content_settings_map = |
| 723 HostContentSettingsMapFactory::GetForProfile(GetProfile()); | 724 HostContentSettingsMapFactory::GetForProfile(GetProfile()); |
| 724 ContentSetting default_setting = | 725 ContentSetting default_setting = |
| 725 host_content_settings_map->GetDefaultContentSetting(type, &provider_id); | 726 host_content_settings_map->GetDefaultContentSetting(type, &provider_id); |
| 726 | 727 |
| 727 #if defined(ENABLE_PLUGINS) | 728 #if BUILDFLAG(ENABLE_PLUGINS) |
| 728 default_setting = PluginsFieldTrial::EffectiveContentSetting( | 729 default_setting = PluginsFieldTrial::EffectiveContentSetting( |
| 729 host_content_settings_map, type, default_setting); | 730 host_content_settings_map, type, default_setting); |
| 730 #endif | 731 #endif |
| 731 | 732 |
| 732 // Camera and microphone default content settings cannot be set by the policy. | 733 // Camera and microphone default content settings cannot be set by the policy. |
| 733 // However, the policy can disable them. Treat this case visually in the same | 734 // However, the policy can disable them. Treat this case visually in the same |
| 734 // way as if the policy set the default setting to BLOCK. Furthermore, compare | 735 // way as if the policy set the default setting to BLOCK. Furthermore, compare |
| 735 // the settings with Flash settings and show links to the Flash settings site | 736 // the settings with Flash settings and show links to the Flash settings site |
| 736 // if they differ. | 737 // if they differ. |
| 737 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || | 738 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 | 1493 |
| 1493 // Exceptions apply only when the feature is enabled. | 1494 // Exceptions apply only when the feature is enabled. |
| 1494 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1495 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
| 1495 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1496 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
| 1496 web_ui()->CallJavascriptFunctionUnsafe( | 1497 web_ui()->CallJavascriptFunctionUnsafe( |
| 1497 "ContentSettings.enableProtectedContentExceptions", | 1498 "ContentSettings.enableProtectedContentExceptions", |
| 1498 base::FundamentalValue(enable_exceptions)); | 1499 base::FundamentalValue(enable_exceptions)); |
| 1499 } | 1500 } |
| 1500 | 1501 |
| 1501 } // namespace options | 1502 } // namespace options |
| OLD | NEW |