Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4691)

Unified Diff: chrome/browser/plugin_status_pref_setter.cc

Issue 10387161: Pepper Flash settings integration: add UI for "deauthorize content licenses". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes in response to Scott's suggestions Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/plugin_status_pref_setter.cc
diff --git a/chrome/browser/plugin_data_remover_helper.cc b/chrome/browser/plugin_status_pref_setter.cc
similarity index 50%
copy from chrome/browser/plugin_data_remover_helper.cc
copy to chrome/browser/plugin_status_pref_setter.cc
index 36470f5f38c7bdb8c87b53b8037d01b277714505..a3dd74335e4dc10c768c1b48a040ab26790cf1b2 100644
--- a/chrome/browser/plugin_data_remover_helper.cc
+++ b/chrome/browser/plugin_status_pref_setter.cc
@@ -2,54 +2,44 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/plugin_data_remover_helper.h"
-
-#include <string>
+#include "chrome/browser/plugin_status_pref_setter.h"
#include "base/bind.h"
+#include "chrome/browser/pepper_flash_settings_manager.h"
+#include "chrome/browser/plugin_data_remover_helper.h"
#include "chrome/browser/plugin_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_source.h"
-#include "content/public/browser/plugin_data_remover.h"
#include "content/public/browser/plugin_service.h"
#include "webkit/plugins/webplugininfo.h"
using content::BrowserThread;
using content::PluginService;
-PluginDataRemoverHelper::PluginDataRemoverHelper()
+PluginStatusPrefSetter::PluginStatusPrefSetter()
: profile_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {}
-PluginDataRemoverHelper::~PluginDataRemoverHelper() {
+PluginStatusPrefSetter::~PluginStatusPrefSetter() {
}
-void PluginDataRemoverHelper::Init(const char* pref_name,
- Profile* profile,
- content::NotificationObserver* observer) {
- pref_.Init(pref_name, profile->GetPrefs(), observer);
+void PluginStatusPrefSetter::Init(Profile* profile,
+ content::NotificationObserver* observer) {
+ clear_plugin_lso_data_enabled_.Init(prefs::kClearPluginLSODataEnabled,
+ profile->GetPrefs(), observer);
+ pepper_flash_settings_enabled_.Init(prefs::kPepperFlashSettingsEnabled,
+ profile->GetPrefs(), observer);
profile_ = profile;
registrar_.Add(this, chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED,
content::Source<Profile>(profile));
StartUpdate();
}
-// static
-bool PluginDataRemoverHelper::IsSupported(PluginPrefs* plugin_prefs) {
- std::vector<webkit::WebPluginInfo> plugins;
- content::PluginDataRemover::GetSupportedPlugins(&plugins);
- for (std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin();
- it != plugins.end(); ++it) {
- if (plugin_prefs->IsPluginEnabled(*it))
- return true;
- }
- return false;
-}
-
-void PluginDataRemoverHelper::Observe(
+void PluginStatusPrefSetter::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -60,18 +50,22 @@ void PluginDataRemoverHelper::Observe(
}
}
-void PluginDataRemoverHelper::StartUpdate() {
+void PluginStatusPrefSetter::StartUpdate() {
PluginService::GetInstance()->GetPlugins(
- base::Bind(&PluginDataRemoverHelper::GotPlugins, factory_.GetWeakPtr(),
+ base::Bind(&PluginStatusPrefSetter::GotPlugins, factory_.GetWeakPtr(),
PluginPrefs::GetForProfile(profile_)));
}
-void PluginDataRemoverHelper::GotPlugins(
+void PluginStatusPrefSetter::GotPlugins(
scoped_refptr<PluginPrefs> plugin_prefs,
- const std::vector<webkit::WebPluginInfo>& plugins) {
+ const std::vector<webkit::WebPluginInfo>& /* plugins */) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- bool supported = IsSupported(plugin_prefs);
- // Set the value on the PrefService instead of through the PrefMember to
- // notify observers if it changed.
- profile_->GetPrefs()->SetBoolean(pref_.GetPrefName().c_str(), supported);
+ // Set the values on the PrefService instead of through the PrefMembers to
+ // notify observers if they changed.
+ profile_->GetPrefs()->SetBoolean(
+ clear_plugin_lso_data_enabled_.GetPrefName().c_str(),
+ PluginDataRemoverHelper::IsSupported(plugin_prefs));
+ profile_->GetPrefs()->SetBoolean(
+ pepper_flash_settings_enabled_.GetPrefName().c_str(),
+ PepperFlashSettingsManager::IsPepperFlashInUse(plugin_prefs, NULL));
}

Powered by Google App Engine
This is Rietveld 408576698