diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 22:39:57 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-21 22:39:57 +0000 |
commit | 894bb50fe9a1b145221dd6993c159ab9f7a0fc5d (patch) | |
tree | f201aa2984ce40b3ef3fd50f7d211280d1cd33c1 /chrome/browser/plugin_service.cc | |
parent | 182ac532081125b65bc169b56eb8230063a8d3a6 (diff) | |
download | chromium_src-894bb50fe9a1b145221dd6993c159ab9f7a0fc5d.zip chromium_src-894bb50fe9a1b145221dd6993c159ab9f7a0fc5d.tar.gz chromium_src-894bb50fe9a1b145221dd6993c159ab9f7a0fc5d.tar.bz2 |
Hook up more of extension uninstall.
Also removed all external dependencies from ExtensionsService.
It now only sends out notifications, which other services
consume. This should allow us to unit test the
ExtensionsService frontend, but I haven't added that yet.
Review URL: http://codereview.chromium.org/113493
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16676 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_service.cc')
-rw-r--r-- | chrome/browser/plugin_service.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index eb8ec2a..e2c6215 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -12,11 +12,15 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_plugin_host.h" #include "chrome/browser/chrome_thread.h" +#include "chrome/browser/extensions/extension.h" +#include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/plugin_process_host.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/logging_chrome.h" +#include "chrome/common/notification_type.h" +#include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" #include "webkit/glue/plugins/plugin_constants_win.h" #include "webkit/glue/plugins/plugin_list.h" @@ -53,6 +57,11 @@ PluginService::PluginService() hklm_watcher_.StartWatching(hklm_event_.get(), this); } #endif + + registrar_.Add(this, NotificationType::EXTENSIONS_LOADED, + NotificationService::AllSources()); + registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + NotificationService::AllSources()); } PluginService::~PluginService() { @@ -214,3 +223,32 @@ void PluginService::OnWaitableEventSignaled(base::WaitableEvent* waitable_event) } #endif } + +void PluginService::Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details) { + switch (type.value) { + case NotificationType::EXTENSIONS_LOADED: { + // TODO(mpcomplete): We also need to force a renderer to refresh its + // cache of the plugin list when we inject user scripts, since it could + // have a stale version by the time extensions are loaded. + // See: http://code.google.com/p/chromium/issues/detail?id=12306 + ExtensionList* extensions = Details<ExtensionList>(details).ptr(); + for (ExtensionList::iterator extension = extensions->begin(); + extension != extensions->end(); ++extension) + if (!(*extension)->plugins_dir().empty()) + AddExtraPluginDir((*extension)->plugins_dir()); + break; + } + + case NotificationType::EXTENSION_UNLOADED: { + // TODO(aa): Implement this. Also, will it be possible to delete the + // extension folder if this isn't unloaded? + // See: http://code.google.com/p/chromium/issues/detail?id=12306 + break; + } + + default: + DCHECK(false); + } +} |