| 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/plugin_prefs.h" | 5 #include "chrome/browser/plugin_prefs.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 base::LazyInstance<std::map<FilePath, bool> > g_default_plugin_state = | 45 base::LazyInstance<std::map<FilePath, bool> > g_default_plugin_state = |
| 46 LAZY_INSTANCE_INITIALIZER; | 46 LAZY_INSTANCE_INITIALIZER; |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 // How long to wait to save the plugin enabled information, which might need to | 50 // How long to wait to save the plugin enabled information, which might need to |
| 51 // go to disk. | 51 // go to disk. |
| 52 #define kPluginUpdateDelayMs (60 * 1000) | 52 #define kPluginUpdateDelayMs (60 * 1000) |
| 53 | 53 |
| 54 // static | 54 // static |
| 55 PluginPrefs* PluginPrefs::GetForProfile(Profile* profile) { | 55 scoped_refptr<PluginPrefs> PluginPrefs::GetForProfile(Profile* profile) { |
| 56 return PluginPrefsFactory::GetInstance()->GetPrefsForProfile(profile); | 56 return PluginPrefsFactory::GetPrefsForProfile(profile); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // static | 59 // static |
| 60 PluginPrefs* PluginPrefs::GetForTestingProfile(Profile* profile) { | 60 scoped_refptr<PluginPrefs> PluginPrefs::GetForTestingProfile( |
| 61 ProfileKeyedBase* prefs = | 61 Profile* profile) { |
| 62 return static_cast<PluginPrefs*>( |
| 62 PluginPrefsFactory::GetInstance()->SetTestingFactoryAndUse( | 63 PluginPrefsFactory::GetInstance()->SetTestingFactoryAndUse( |
| 63 profile, &PluginPrefsFactory::CreatePrefsForProfile); | 64 profile, &PluginPrefsFactory::CreateForTestingProfile).get()); |
| 64 return static_cast<PluginPrefs*>(prefs); | |
| 65 } | 65 } |
| 66 | 66 |
| 67 void PluginPrefs::SetPluginListForTesting( | 67 void PluginPrefs::SetPluginListForTesting( |
| 68 webkit::npapi::PluginList* plugin_list) { | 68 webkit::npapi::PluginList* plugin_list) { |
| 69 plugin_list_ = plugin_list; | 69 plugin_list_ = plugin_list; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void PluginPrefs::EnablePluginGroup(bool enabled, const string16& group_name) { | 72 void PluginPrefs::EnablePluginGroup(bool enabled, const string16& group_name) { |
| 73 PluginService::GetInstance()->GetPluginGroups( | 73 PluginService::GetInstance()->GetPluginGroups( |
| 74 base::Bind(&PluginPrefs::EnablePluginGroupInternal, | 74 base::Bind(&PluginPrefs::EnablePluginGroupInternal, |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 } | 529 } |
| 530 } | 530 } |
| 531 | 531 |
| 532 void PluginPrefs::NotifyPluginStatusChanged() { | 532 void PluginPrefs::NotifyPluginStatusChanged() { |
| 533 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 533 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 534 content::NotificationService::current()->Notify( | 534 content::NotificationService::current()->Notify( |
| 535 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, | 535 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, |
| 536 content::Source<Profile>(profile_), | 536 content::Source<Profile>(profile_), |
| 537 content::NotificationService::NoDetails()); | 537 content::NotificationService::NoDetails()); |
| 538 } | 538 } |
| OLD | NEW |