diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 01:52:43 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-22 01:52:43 +0000 |
commit | f1c8a2bde28415af7f2af63bfeaa7bc4b781e6d0 (patch) | |
tree | 8f7b62ff82b2315b3f997cb15f249a2994ddbdb9 /chrome/common/net | |
parent | 88cf329e3b89404544ad80a70a5a0a325e420227 (diff) | |
download | chromium_src-f1c8a2bde28415af7f2af63bfeaa7bc4b781e6d0.zip chromium_src-f1c8a2bde28415af7f2af63bfeaa7bc4b781e6d0.tar.gz chromium_src-f1c8a2bde28415af7f2af63bfeaa7bc4b781e6d0.tar.bz2 |
Use a NotificationRegistrar to listen for notifications.
BUG=2381
Review URL: http://codereview.chromium.org/113738
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16702 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/net')
-rw-r--r-- | chrome/common/net/url_request_intercept_job.cc | 11 | ||||
-rw-r--r-- | chrome/common/net/url_request_intercept_job.h | 3 |
2 files changed, 5 insertions, 9 deletions
diff --git a/chrome/common/net/url_request_intercept_job.cc b/chrome/common/net/url_request_intercept_job.cc index b584de6..34f4de0 100644 --- a/chrome/common/net/url_request_intercept_job.cc +++ b/chrome/common/net/url_request_intercept_job.cc @@ -33,23 +33,19 @@ URLRequestInterceptJob::URLRequestInterceptJob(URLRequest* request, read_buffer_(NULL) { cprequest_->data = this; // see FromCPRequest(). - NotificationService::current()->AddObserver( - this, NotificationType::CHROME_PLUGIN_UNLOADED, - Source<ChromePluginLib>(plugin_)); + registrar_.Add(this, NotificationType::CHROME_PLUGIN_UNLOADED, + Source<ChromePluginLib>(plugin_)); } URLRequestInterceptJob::~URLRequestInterceptJob() { if (plugin_) { plugin_->functions().request_funcs->end_request(cprequest_.get(), CPERR_SUCCESS); - DetachPlugin(); } } void URLRequestInterceptJob::DetachPlugin() { - NotificationService::current()->RemoveObserver( - this, NotificationType::CHROME_PLUGIN_UNLOADED, - Source<ChromePluginLib>(plugin_)); + registrar_.RemoveAll(); plugin_ = NULL; } @@ -211,6 +207,5 @@ void URLRequestInterceptJob::Observe(NotificationType type, const NotificationDetails& details) { DCHECK(type == NotificationType::CHROME_PLUGIN_UNLOADED); DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr()); - DetachPlugin(); } diff --git a/chrome/common/net/url_request_intercept_job.h b/chrome/common/net/url_request_intercept_job.h index d15b62a..ba6bbe2 100644 --- a/chrome/common/net/url_request_intercept_job.h +++ b/chrome/common/net/url_request_intercept_job.h @@ -12,7 +12,7 @@ #include "chrome/browser/chrome_plugin_host.h" #include "chrome/common/chrome_plugin_api.h" #include "chrome/common/chrome_plugin_util.h" -#include "chrome/common/notification_observer.h" +#include "chrome/common/notification_registrar.h" class ChromePluginLib; class URLRequest; @@ -52,6 +52,7 @@ class URLRequestInterceptJob void StartAsync(); void DetachPlugin(); + NotificationRegistrar registrar_; scoped_ptr<ScopableCPRequest> cprequest_; ChromePluginLib* plugin_; bool got_headers_; |