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

Unified Diff: chrome/browser/plugin_prefs.h

Issue 10872034: Changing PluginPrefs to use PluginFinder's async interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@test_async
Patch Set: "Fixed review comments and added support for other methods in PluginPrefs to use 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
Index: chrome/browser/plugin_prefs.h
diff --git a/chrome/browser/plugin_prefs.h b/chrome/browser/plugin_prefs.h
index eddb0250f3a120aaa234aa65cf9e9c663e8b4d06..4292f041d9d54b31a64f242076bdfbc07196ef0f 100644
--- a/chrome/browser/plugin_prefs.h
+++ b/chrome/browser/plugin_prefs.h
@@ -13,6 +13,7 @@
#include "base/file_path.h"
#include "base/synchronization/lock.h"
#include "chrome/browser/api/prefs/pref_change_registrar.h"
+#include "chrome/browser/plugin_finder.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/refcounted_profile_keyed_service.h"
#include "content/public/browser/notification_observer.h"
@@ -65,16 +66,14 @@ class PluginPrefs : public RefcountedProfileKeyedService,
// Enable or disable a plugin group.
void EnablePluginGroup(bool enable, const string16& group_name);
- // Returns true if the plug-in state can be enabled or disabled according to
- // |enable|, false if the plug-in state cannot be changed because of a policy.
- bool CanEnablePlugin(bool enable, const FilePath& file_path);
-
- // Enables or disables a specific plugin file, and calls |callback|
- // afterwards.
- // If the plug-in state cannot be changed because of a policy (as indicated
- // by |CanEnablePlugin|), it will be silently ignored.
+ // Enables or disables a specific plugin file, if possible,
+ // and calls |enableCallback| afterwards. If not possible (because the
+ // plug-in state cannot be changed because of a policy), it will silently
Pam (message me for reviews) 2012/08/27 13:18:05 nit: clarify "it": something like "this entire met
ibraaaa 2012/08/28 09:25:52 Done.
+ // be ignored. |canEnabledCallback| will be called after the plug-in
Pam (message me for reviews) 2012/08/27 13:18:05 typo: |canEnableCallback|
ibraaaa 2012/08/28 09:25:52 Done.
+ // change state check is called.
Pam (message me for reviews) 2012/08/27 13:18:05 I don't understand what a "plug-in change state ch
ibraaaa 2012/08/28 09:25:52 Done.
void EnablePlugin(bool enable, const FilePath& file_path,
- const base::Closure& callback);
+ const base::Closure& enableCallback,
+ const base::Callback<void(bool)>& canEnableCallback);
// Enables or disables a plug-in in all profiles, and calls |callback|
// afterwards. This sets a default for profiles which are created later as
@@ -125,20 +124,22 @@ class PluginPrefs : public RefcountedProfileKeyedService,
void EnablePluginGroupInternal(
bool enabled,
const string16& group_name,
- const std::vector<webkit::npapi::PluginGroup>& groups);
+ PluginFinder* plugin_finder,
+ const std::vector<webkit::WebPluginInfo>& plugins);
void EnablePluginInternal(
bool enabled,
const FilePath& path,
+ PluginFinder* plugin_finder,
const base::Closure& callback,
- const std::vector<webkit::npapi::PluginGroup>& groups);
+ const std::vector<webkit::WebPluginInfo>& plugins);
// Called on the file thread to get the data necessary to update the saved
// preferences.
void GetPreferencesDataOnFileThread();
// Called on the UI thread with the plugin data to save the preferences.
- void OnUpdatePreferences(
- const std::vector<webkit::npapi::PluginGroup>& groups);
+ void OnUpdatePreferences(const std::vector<webkit::WebPluginInfo>& plugins,
+ PluginFinder* finder);
// Sends the notification that plugin data has changed.
void NotifyPluginStatusChanged();
@@ -150,6 +151,24 @@ class PluginPrefs : public RefcountedProfileKeyedService,
static bool IsStringMatchedInSet(const string16& name,
const std::set<string16>& pattern_set);
+ // Callback method called by 'EnablePlugin' method.
+ // It performs the logic to check if a plug-in can be enabled.
+ void EnablePluginIfPossibleCallback(
+ bool enabled, const FilePath& path,
+ const base::Closure& enableCallback,
+ const base::Callback<void(bool)>& canEnableCallback,
+ PluginFinder* finder);
+
+ // Callback method that takes in the asynchronously created
+ // plug-in finder instance. It is called by 'EnablePluginGroup'.
+ void GetPluginFinderForEnablePluginGroup(bool enabled,
+ const string16& group_name,
+ PluginFinder* finder);
+
+ // Callback method that takes in the asynchronously created plug-in finder
+ // instance. It is called by 'GetPreferencesDataOnFileThread'.
+ void GetPluginFinderForGetPreferencesDataOnFileThread(PluginFinder* finder);
+
// Guards access to the following data structures.
mutable base::Lock lock_;

Powered by Google App Engine
This is Rietveld 408576698