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

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: New interface as discussed 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..c61de43d9951f00f4cfa9e2dd2a704f49751a8e6 100644
--- a/chrome/browser/extensions/extension_content_settings_api.cc
+++ b/chrome/browser/extensions/extension_content_settings_api.cc
@@ -19,8 +19,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_error_utils.h"
+#include "content/browser/plugin_service.h"
#include "webkit/plugins/npapi/plugin_group.h"
-#include "webkit/plugins/npapi/plugin_list.h"
namespace helpers = extension_content_settings_helpers;
namespace keys = extension_content_settings_api_constants;
@@ -29,7 +29,7 @@ namespace pref_keys = extension_preference_api_constants;
namespace {
-webkit::npapi::PluginList* g_plugin_list = NULL;
+const std::vector<webkit::npapi::PluginGroup>* g_testing_plugin_groups_;
} // namespace
@@ -265,10 +265,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()->LoadPluginList(false,
+ base::Bind(&GetResourceIdentifiersFunction::OnPluginsLoaded, this));
} else {
SendResponse(true);
}
@@ -276,15 +274,12 @@ 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();
- }
-
+void GetResourceIdentifiersFunction::OnPluginsLoaded() {
std::vector<webkit::npapi::PluginGroup> groups;
- plugin_list->GetPluginGroups(true, &groups);
+ if (g_testing_plugin_groups_)
+ groups = *g_testing_plugin_groups_;
+ else
+ PluginService::GetInstance()->GetPluginGroups(&groups);
ListValue* list = new ListValue();
for (std::vector<webkit::npapi::PluginGroup>::iterator it = groups.begin();
@@ -301,7 +296,7 @@ void GetResourceIdentifiersFunction::GetPluginsOnFileThread() {
}
// static
-void GetResourceIdentifiersFunction::SetPluginListForTesting(
- webkit::npapi::PluginList* plugin_list) {
- g_plugin_list = plugin_list;
+void GetResourceIdentifiersFunction::SetPluginGroupsForTesting(
+ const std::vector<webkit::npapi::PluginGroup>* plugin_groups) {
+ g_testing_plugin_groups_ = plugin_groups;
}

Powered by Google App Engine
This is Rietveld 408576698