| 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/plugins_ui.h" | 5 #include "chrome/browser/ui/webui/plugins_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 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/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/memory/ref_counted_memory.h" | 14 #include "base/memory/ref_counted_memory.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/prefs/pref_member.h" | 20 #include "base/prefs/pref_member.h" |
| 21 #include "base/prefs/pref_service.h" | 21 #include "base/prefs/pref_service.h" |
| 22 #include "base/prefs/scoped_user_pref_update.h" | 22 #include "base/prefs/scoped_user_pref_update.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/values.h" | 24 #include "base/values.h" |
| 25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 26 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 26 #include "chrome/browser/plugins/plugin_finder.h" | 27 #include "chrome/browser/plugins/plugin_finder.h" |
| 27 #include "chrome/browser/plugins/plugin_metadata.h" | 28 #include "chrome/browser/plugins/plugin_metadata.h" |
| 28 #include "chrome/browser/plugins/plugin_prefs.h" | 29 #include "chrome/browser/plugins/plugin_prefs.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
| 31 #include "chrome/browser/ui/browser_window.h" | 32 #include "chrome/browser/ui/browser_window.h" |
| 32 #include "chrome/common/chrome_content_client.h" | 33 #include "chrome/common/chrome_content_client.h" |
| 33 #include "chrome/common/chrome_paths.h" | 34 #include "chrome/common/chrome_paths.h" |
| 34 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
| 35 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 return; | 295 return; |
| 295 } | 296 } |
| 296 | 297 |
| 297 std::string plugin; | 298 std::string plugin; |
| 298 bool allowed = false; | 299 bool allowed = false; |
| 299 if (!args->GetString(0, &plugin) || !args->GetBoolean(1, &allowed)) { | 300 if (!args->GetString(0, &plugin) || !args->GetBoolean(1, &allowed)) { |
| 300 NOTREACHED(); | 301 NOTREACHED(); |
| 301 return; | 302 return; |
| 302 } | 303 } |
| 303 Profile* profile = Profile::FromWebUI(web_ui()); | 304 Profile* profile = Profile::FromWebUI(web_ui()); |
| 304 profile->GetHostContentSettingsMap()->SetContentSetting( | 305 HostContentSettingsMapFactory::GetForProfile(profile)->SetContentSetting( |
| 305 ContentSettingsPattern::Wildcard(), | 306 ContentSettingsPattern::Wildcard(), |
| 306 ContentSettingsPattern::Wildcard(), | 307 ContentSettingsPattern::Wildcard(), |
| 307 CONTENT_SETTINGS_TYPE_PLUGINS, | 308 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 308 plugin, | 309 plugin, |
| 309 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_DEFAULT); | 310 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_DEFAULT); |
| 310 | 311 |
| 311 // Keep track of the whitelist separately, so that we can distinguish plugins | 312 // Keep track of the whitelist separately, so that we can distinguish plugins |
| 312 // whitelisted by the user from automatically whitelisted ones. | 313 // whitelisted by the user from automatically whitelisted ones. |
| 313 DictionaryPrefUpdate update(profile->GetPrefs(), | 314 DictionaryPrefUpdate update(profile->GetPrefs(), |
| 314 prefs::kContentSettingsPluginWhitelist); | 315 prefs::kContentSettingsPluginWhitelist); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 522 } |
| 522 | 523 |
| 523 // static | 524 // static |
| 524 void PluginsUI::RegisterProfilePrefs( | 525 void PluginsUI::RegisterProfilePrefs( |
| 525 user_prefs::PrefRegistrySyncable* registry) { | 526 user_prefs::PrefRegistrySyncable* registry) { |
| 526 registry->RegisterBooleanPref(prefs::kPluginsShowDetails, false); | 527 registry->RegisterBooleanPref(prefs::kPluginsShowDetails, false); |
| 527 registry->RegisterDictionaryPref( | 528 registry->RegisterDictionaryPref( |
| 528 prefs::kContentSettingsPluginWhitelist, | 529 prefs::kContentSettingsPluginWhitelist, |
| 529 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 530 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 530 } | 531 } |
| OLD | NEW |