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

Unified Diff: chrome/browser/ui/webui/plugins_ui.cc

Issue 10872034: Changing PluginPrefs to use PluginFinder's async interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@test_async
Patch Set: Converted PluginPref#CanEnablePlugin to use PluginFinder's async interface. Created 8 years, 4 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
« chrome/browser/plugin_prefs.h ('K') | « chrome/browser/plugin_prefs.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/plugins_ui.cc
diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc
index 1b9676f66e7579a50c5f86043bab5fce23968cf8..bdcdcad2c219ff77f8b2266581681c6c4ef7bf53 100644
--- a/chrome/browser/ui/webui/plugins_ui.cc
+++ b/chrome/browser/ui/webui/plugins_ui.cc
@@ -66,6 +66,15 @@ using webkit::WebPluginInfo;
namespace {
+// Helper callback method to process result of CanEnablePlugin method.
+void EnablePluginOrDieCallback(bool enable,
+ const FilePath& file_path,
+ scoped_refptr<PluginPrefs> plugin_prefs,
+ bool can_enable) {
+ DCHECK(can_enable);
+ plugin_prefs->EnablePlugin(enable, file_path, base::Bind(&base::DoNothing));
+}
+
ChromeWebUIDataSource* CreatePluginsUIHTMLSource() {
ChromeWebUIDataSource* source =
new ChromeWebUIDataSource(chrome::kChromeUIPluginsHost);
@@ -240,7 +249,7 @@ void PluginsDOMHandler::HandleEnablePluginMessage(const ListValue* args) {
}
bool enable = enable_str == "true";
- PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile);
+ scoped_refptr<PluginPrefs> plugin_prefs(PluginPrefs::GetForProfile(profile));
if (is_group_str == "true") {
string16 group_name;
if (!args->GetString(0, &group_name)) {
@@ -266,9 +275,10 @@ void PluginsDOMHandler::HandleEnablePluginMessage(const ListValue* args) {
NOTREACHED();
return;
}
- DCHECK(plugin_prefs->CanEnablePlugin(enable, FilePath(file_path)));
- plugin_prefs->EnablePlugin(enable, FilePath(file_path),
- base::Bind(&base::DoNothing));
+
+ plugin_prefs->CanEnablePlugin(enable, FilePath(file_path),
+ base::Bind(&EnablePluginOrDieCallback, enable, FilePath(file_path),
+ plugin_prefs));
}
}
« chrome/browser/plugin_prefs.h ('K') | « chrome/browser/plugin_prefs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698