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

Unified Diff: chrome/browser/extensions/extension_content_settings_api.cc

Issue 7980011: Convert the PluginService interface to be an async wrapper around PluginList. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 9 years, 3 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/extensions/extension_content_settings_api.cc
diff --git a/chrome/browser/extensions/extension_content_settings_api.cc b/chrome/browser/extensions/extension_content_settings_api.cc
index b76024e6c056c08b04ecee1ecb09b3a3e19ef729..cc1833b344b9de6a9140eb6085c4f358eeee6aa2 100644
--- a/chrome/browser/extensions/extension_content_settings_api.cc
+++ b/chrome/browser/extensions/extension_content_settings_api.cc
@@ -19,20 +19,13 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_error_utils.h"
-#include "webkit/plugins/npapi/plugin_group.h"
-#include "webkit/plugins/npapi/plugin_list.h"
+#include "content/browser/plugin_service.h"
namespace helpers = extension_content_settings_helpers;
namespace keys = extension_content_settings_api_constants;
namespace pref_helpers = extension_preference_helpers;
namespace pref_keys = extension_preference_api_constants;
-namespace {
-
-webkit::npapi::PluginList* g_plugin_list = NULL;
-
-} // namespace
-
bool ClearContentSettingsFunction::RunImpl() {
std::string content_type_str;
EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &content_type_str));
@@ -265,10 +258,8 @@ bool GetResourceIdentifiersFunction::RunImpl() {
if (content_type == CONTENT_SETTINGS_TYPE_PLUGINS &&
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableResourceContentSettings)) {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&GetResourceIdentifiersFunction::GetPluginsOnFileThread,
- this));
+ PluginService::GetInstance()->GetPluginGroups(
+ base::Bind(&GetResourceIdentifiersFunction::OnGotPluginGroups, this));
} else {
SendResponse(true);
}
@@ -276,16 +267,8 @@ bool GetResourceIdentifiersFunction::RunImpl() {
return true;
}
-void GetResourceIdentifiersFunction::GetPluginsOnFileThread() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- webkit::npapi::PluginList* plugin_list = g_plugin_list;
- if (!plugin_list) {
- plugin_list = webkit::npapi::PluginList::Singleton();
- }
-
- std::vector<webkit::npapi::PluginGroup> groups;
- plugin_list->GetPluginGroups(true, &groups);
-
+void GetResourceIdentifiersFunction::OnGotPluginGroups(
+ std::vector<webkit::npapi::PluginGroup> groups) {
ListValue* list = new ListValue();
for (std::vector<webkit::npapi::PluginGroup>::iterator it = groups.begin();
it != groups.end(); ++it) {
@@ -299,9 +282,3 @@ void GetResourceIdentifiersFunction::GetPluginsOnFileThread() {
BrowserThread::UI, FROM_HERE, base::Bind(
&GetResourceIdentifiersFunction::SendResponse, this, true));
}
-
-// static
-void GetResourceIdentifiersFunction::SetPluginListForTesting(
- webkit::npapi::PluginList* plugin_list) {
- g_plugin_list = plugin_list;
-}

Powered by Google App Engine
This is Rietveld 408576698