| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugin_updater.h" | 5 #include "chrome/browser/plugin_updater.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "base/version.h" | 14 #include "base/version.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 16 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/chrome_content_client.h" | 18 #include "chrome/common/chrome_content_client.h" |
| 19 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 21 #include "content/browser/browser_thread.h" | 22 #include "content/browser/browser_thread.h" |
| 22 #include "content/common/notification_service.h" | 23 #include "content/common/notification_service.h" |
| 23 #include "webkit/plugins/npapi/plugin_list.h" | 24 #include "webkit/plugins/npapi/plugin_list.h" |
| 24 #include "webkit/plugins/npapi/webplugininfo.h" | 25 #include "webkit/plugins/npapi/webplugininfo.h" |
| 25 | 26 |
| 26 // How long to wait to save the plugin enabled information, which might need to | 27 // How long to wait to save the plugin enabled information, which might need to |
| 27 // go to disk. | 28 // go to disk. |
| 28 #define kPluginUpdateDelayMs (60 * 1000) | 29 #define kPluginUpdateDelayMs (60 * 1000) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 webkit::npapi::PluginList::Singleton()->EnablePlugin(file_path); | 67 webkit::npapi::PluginList::Singleton()->EnablePlugin(file_path); |
| 67 else | 68 else |
| 68 webkit::npapi::PluginList::Singleton()->DisablePlugin(file_path); | 69 webkit::npapi::PluginList::Singleton()->DisablePlugin(file_path); |
| 69 | 70 |
| 70 NotifyPluginStatusChanged(); | 71 NotifyPluginStatusChanged(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 void PluginUpdater::Observe(NotificationType type, | 74 void PluginUpdater::Observe(NotificationType type, |
| 74 const NotificationSource& source, | 75 const NotificationSource& source, |
| 75 const NotificationDetails& details) { | 76 const NotificationDetails& details) { |
| 76 DCHECK_EQ(NotificationType::PREF_CHANGED, type.value); | 77 DCHECK_EQ(chrome::PREF_CHANGED, type.value); |
| 77 const std::string* pref_name = Details<std::string>(details).ptr(); | 78 const std::string* pref_name = Details<std::string>(details).ptr(); |
| 78 if (!pref_name) { | 79 if (!pref_name) { |
| 79 NOTREACHED(); | 80 NOTREACHED(); |
| 80 return; | 81 return; |
| 81 } | 82 } |
| 82 if (*pref_name == prefs::kPluginsDisabledPlugins || | 83 if (*pref_name == prefs::kPluginsDisabledPlugins || |
| 83 *pref_name == prefs::kPluginsDisabledPluginsExceptions || | 84 *pref_name == prefs::kPluginsDisabledPluginsExceptions || |
| 84 *pref_name == prefs::kPluginsEnabledPlugins) { | 85 *pref_name == prefs::kPluginsEnabledPlugins) { |
| 85 PrefService* pref_service = Source<PrefService>(source).ptr(); | 86 PrefService* pref_service = Source<PrefService>(source).ptr(); |
| 86 const ListValue* disabled_list = | 87 const ListValue* disabled_list = |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 prefs->RegisterFilePathPref(prefs::kPluginsLastInternalDirectory, | 346 prefs->RegisterFilePathPref(prefs::kPluginsLastInternalDirectory, |
| 346 internal_dir, | 347 internal_dir, |
| 347 PrefService::UNSYNCABLE_PREF); | 348 PrefService::UNSYNCABLE_PREF); |
| 348 prefs->RegisterListPref(prefs::kPluginsDisabledPlugins, | 349 prefs->RegisterListPref(prefs::kPluginsDisabledPlugins, |
| 349 PrefService::UNSYNCABLE_PREF); | 350 PrefService::UNSYNCABLE_PREF); |
| 350 prefs->RegisterListPref(prefs::kPluginsDisabledPluginsExceptions, | 351 prefs->RegisterListPref(prefs::kPluginsDisabledPluginsExceptions, |
| 351 PrefService::UNSYNCABLE_PREF); | 352 PrefService::UNSYNCABLE_PREF); |
| 352 prefs->RegisterListPref(prefs::kPluginsEnabledPlugins, | 353 prefs->RegisterListPref(prefs::kPluginsEnabledPlugins, |
| 353 PrefService::UNSYNCABLE_PREF); | 354 PrefService::UNSYNCABLE_PREF); |
| 354 } | 355 } |
| OLD | NEW |