| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/plugins/plugins_handler.h" | 5 #include "chrome/browser/ui/webui/plugins/plugins_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 callback.Run(show_details_.GetValue()); | 156 callback.Run(show_details_.GetValue()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void PluginsHandler::SaveShowDetailsToPrefs(bool details_mode) { | 159 void PluginsHandler::SaveShowDetailsToPrefs(bool details_mode) { |
| 160 show_details_.SetValue(details_mode); | 160 show_details_.SetValue(details_mode); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void PluginsHandler::SetPluginAlwaysAllowed(const mojo::String& plugin, | 163 void PluginsHandler::SetPluginAlwaysAllowed(const mojo::String& plugin, |
| 164 bool allowed) { | 164 bool allowed) { |
| 165 Profile* profile = Profile::FromWebUI(web_ui_); | 165 Profile* profile = Profile::FromWebUI(web_ui_); |
| 166 HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting( | 166 HostContentSettingsMapFactory::GetForProfile(profile) |
| 167 ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), | 167 ->SetContentSettingCustomScope( |
| 168 CONTENT_SETTINGS_TYPE_PLUGINS, plugin.get(), | 168 ContentSettingsPattern::Wildcard(), |
| 169 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_DEFAULT); | 169 ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_PLUGINS, |
| 170 plugin.get(), |
| 171 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_DEFAULT); |
| 170 | 172 |
| 171 // Keep track of the whitelist separately, so that we can distinguish plugins | 173 // Keep track of the whitelist separately, so that we can distinguish plugins |
| 172 // whitelisted by the user from automatically whitelisted ones. | 174 // whitelisted by the user from automatically whitelisted ones. |
| 173 DictionaryPrefUpdate update(profile->GetPrefs(), | 175 DictionaryPrefUpdate update(profile->GetPrefs(), |
| 174 prefs::kContentSettingsPluginWhitelist); | 176 prefs::kContentSettingsPluginWhitelist); |
| 175 update->SetBoolean(plugin, allowed); | 177 update->SetBoolean(plugin, allowed); |
| 176 } | 178 } |
| 177 | 179 |
| 178 void PluginsHandler::GetPluginsData(const GetPluginsDataCallback& callback) { | 180 void PluginsHandler::GetPluginsData(const GetPluginsDataCallback& callback) { |
| 179 if (weak_ptr_factory_.HasWeakPtrs()) | 181 if (weak_ptr_factory_.HasWeakPtrs()) |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 346 } |
| 345 | 347 |
| 346 if (plugins_enabled_by_policy) | 348 if (plugins_enabled_by_policy) |
| 347 return "enabledByPolicy"; | 349 return "enabledByPolicy"; |
| 348 if (plugins_disabled_by_policy) | 350 if (plugins_disabled_by_policy) |
| 349 return "disabledByPolicy"; | 351 return "disabledByPolicy"; |
| 350 if (plugins_managed_by_policy) | 352 if (plugins_managed_by_policy) |
| 351 return "managedByPolicy"; | 353 return "managedByPolicy"; |
| 352 return group_enabled ? "enabledByUser" : "disabledByUser"; | 354 return group_enabled ? "enabledByUser" : "disabledByUser"; |
| 353 } | 355 } |
| OLD | NEW |