summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-08 19:07:31 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-08 19:07:31 +0000
commit07b71c86d06a34f21bbd4109f74fc6b24f2bcd68 (patch)
tree9ad6106963b2db5a94265ae6b2be82fd9d4c13c4
parent0cb6cf7219217ebe982e5b8d222229ca0ae09252 (diff)
downloadchromium_src-07b71c86d06a34f21bbd4109f74fc6b24f2bcd68.zip
chromium_src-07b71c86d06a34f21bbd4109f74fc6b24f2bcd68.tar.gz
chromium_src-07b71c86d06a34f21bbd4109f74fc6b24f2bcd68.tar.bz2
Switch to using FilePathWatcher::Callback instead of FilePathWatcher::Delegate.
BUG=130980 Review URL: https://codereview.chromium.org/11794042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175570 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/plugin_service_impl.cc49
-rw-r--r--content/browser/plugin_service_impl.h12
2 files changed, 26 insertions, 35 deletions
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index 40fd937..7c0de3c 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -69,40 +69,36 @@ void WillLoadPluginsCallback(
CHECK(false) << "Plugin loading should happen out-of-process.";
}
}
-} // namespace
#if defined(OS_MACOSX)
-static void NotifyPluginsOfActivation() {
+void NotifyPluginsOfActivation() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
for (PluginProcessHostIterator iter; !iter.Done(); ++iter)
iter->OnAppActivation();
}
#endif
-#if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID)
-// Delegate class for monitoring directories.
-class PluginDirWatcherDelegate : public FilePathWatcher::Delegate {
- virtual void OnFilePathChanged(const FilePath& path) OVERRIDE {
- VLOG(1) << "Watched path changed: " << path.value();
- // Make the plugin list update itself
- webkit::npapi::PluginList::Singleton()->RefreshPlugins();
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&PluginService::PurgePluginListCache,
- static_cast<BrowserContext*>(NULL), false));
- }
- virtual void OnFilePathError(const FilePath& path) OVERRIDE {
+#if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID)
+void NotifyPluginDirChanged(const FilePath& path, bool error) {
+ if (error) {
// TODO(pastarmovj): Add some sensible error handling. Maybe silently
// stopping the watcher would be enough. Or possibly restart it.
NOTREACHED();
+ return;
}
-
- protected:
- virtual ~PluginDirWatcherDelegate() {}
-};
+ VLOG(1) << "Watched path changed: " << path.value();
+ // Make the plugin list update itself
+ webkit::npapi::PluginList::Singleton()->RefreshPlugins();
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&PluginService::PurgePluginListCache,
+ static_cast<BrowserContext*>(NULL), false));
+}
#endif
+} // namespace
+
// static
PluginService* PluginService::GetInstance() {
return PluginServiceImpl::GetInstance();
@@ -188,7 +184,7 @@ void PluginServiceImpl::StartWatchingPlugins() {
#if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID)
// On ChromeOS the user can't install plugins anyway and on Windows all
// important plugins register themselves in the registry so no need to do that.
- file_watcher_delegate_ = new PluginDirWatcherDelegate();
+
// Get the list of all paths for registering the FilePathWatchers
// that will track and if needed reload the list of plugins on runtime.
std::vector<FilePath> plugin_dirs;
@@ -207,7 +203,7 @@ void PluginServiceImpl::StartWatchingPlugins() {
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
base::Bind(&PluginServiceImpl::RegisterFilePathWatcher, watcher,
- plugin_dirs[i], file_watcher_delegate_));
+ plugin_dirs[i]));
file_watchers_.push_back(watcher);
}
#endif
@@ -601,11 +597,10 @@ PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo(
#if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID)
// static
-void PluginServiceImpl::RegisterFilePathWatcher(
- FilePathWatcher* watcher,
- const FilePath& path,
- FilePathWatcher::Delegate* delegate) {
- bool result = watcher->Watch(path, delegate);
+void PluginServiceImpl::RegisterFilePathWatcher(FilePathWatcher* watcher,
+ const FilePath& path) {
+ bool result = watcher->Watch(path, false,
+ base::Bind(&NotifyPluginDirChanged));
DCHECK(result);
}
#endif
@@ -695,7 +690,7 @@ void PluginServiceImpl::SetPluginListForTesting(
#if defined(OS_MACOSX)
void PluginServiceImpl::AppActivated() {
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(&NotifyPluginsOfActivation));
+ base::Bind(&NotifyPluginsOfActivation));
}
#endif
diff --git a/content/browser/plugin_service_impl.h b/content/browser/plugin_service_impl.h
index 1b7edfa..bb163b6 100644
--- a/content/browser/plugin_service_impl.h
+++ b/content/browser/plugin_service_impl.h
@@ -196,16 +196,13 @@ class CONTENT_EXPORT PluginServiceImpl
// Helper so we can finish opening the channel after looking up the
// plugin.
- void FinishOpenChannelToPlugin(
- const FilePath& plugin_path,
- PluginProcessHost::Client* client);
+ void FinishOpenChannelToPlugin(const FilePath& plugin_path,
+ PluginProcessHost::Client* client);
#if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID)
// Registers a new FilePathWatcher for a given path.
- static void RegisterFilePathWatcher(
- base::files::FilePathWatcher* watcher,
- const FilePath& path,
- base::files::FilePathWatcher::Delegate* delegate);
+ static void RegisterFilePathWatcher(base::files::FilePathWatcher* watcher,
+ const FilePath& path);
#endif
// The plugin list instance.
@@ -223,7 +220,6 @@ class CONTENT_EXPORT PluginServiceImpl
#if defined(OS_POSIX) && !defined(OS_OPENBSD) && !defined(OS_ANDROID)
ScopedVector<base::files::FilePathWatcher> file_watchers_;
- scoped_refptr<PluginDirWatcherDelegate> file_watcher_delegate_;
#endif
std::vector<PepperPluginInfo> ppapi_plugins_;