summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-01 18:16:56 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-01 18:16:56 +0000
commitbfd04a62ce610d7bb61dbb78811dccbed23589b7 (patch)
tree70bb228c0f00ba1c12c584efd569daccf96b4026 /chrome/browser/net
parenta814d863440f0a154a7299f2d8b440f405c7700e (diff)
downloadchromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.zip
chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.gz
chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.bz2
Remove most header file dependencies on the notification type list. It is
really painful to add more types, since lots of headers include the notification service to derive from the notification observer. This splits that out, so much less of the project should end up including notification_types.h ---Paths modified but not in any changelist: Review URL: http://codereview.chromium.org/19744 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc18
-rw-r--r--chrome/browser/net/chrome_url_request_context.h2
-rw-r--r--chrome/browser/net/dns_global.cc12
3 files changed, 18 insertions, 14 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 7a4c3bb..d98f2d6 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/profile.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "net/http/http_cache.h"
#include "net/http/http_util.h"
@@ -121,14 +122,15 @@ ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile)
prefs_->AddPrefObserver(prefs::kCookieBehavior, this);
NotificationService::current()->AddObserver(
- this, NOTIFY_EXTENSIONS_LOADED, NotificationService::AllSources());
+ this, NotificationType::EXTENSIONS_LOADED,
+ NotificationService::AllSources());
}
// NotificationObserver implementation.
void ChromeURLRequestContext::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (NOTIFY_PREF_CHANGED == type) {
+ if (NotificationType::PREF_CHANGED == type) {
std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
PrefService* prefs = Source<PrefService>(source).ptr();
DCHECK(pref_name_in && prefs);
@@ -147,7 +149,7 @@ void ChromeURLRequestContext::Observe(NotificationType type,
&ChromeURLRequestContext::OnCookiePolicyChange,
type));
}
- } else if (NOTIFY_EXTENSIONS_LOADED == type) {
+ } else if (NotificationType::EXTENSIONS_LOADED == type) {
ExtensionPaths* new_paths = new ExtensionPaths;
ExtensionList* extensions = Details<ExtensionList>(details).ptr();
DCHECK(extensions);
@@ -171,7 +173,8 @@ void ChromeURLRequestContext::CleanupOnUIThread() {
prefs_ = NULL;
NotificationService::current()->RemoveObserver(
- this, NOTIFY_EXTENSIONS_LOADED, NotificationService::AllSources());
+ this, NotificationType::EXTENSIONS_LOADED,
+ NotificationService::AllSources());
}
FilePath ChromeURLRequestContext::GetPathForExtension(const std::string& id) {
@@ -211,9 +214,10 @@ void ChromeURLRequestContext::OnNewExtensions(ExtensionPaths* new_paths) {
ChromeURLRequestContext::~ChromeURLRequestContext() {
DCHECK(NULL == prefs_);
- NotificationService::current()->Notify(NOTIFY_URL_REQUEST_CONTEXT_RELEASED,
- Source<URLRequestContext>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::URL_REQUEST_CONTEXT_RELEASED,
+ Source<URLRequestContext>(this),
+ NotificationService::NoDetails());
delete cookie_store_;
delete http_transaction_factory_;
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index f9cfafac..15d53e8 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -4,7 +4,7 @@
#include "base/file_path.h"
#include "chrome/common/net/cookie_monster_sqlite.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/pref_service.h"
#include "net/url_request/url_request_context.h"
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc
index 3ea79ff..b34de8a 100644
--- a/chrome/browser/net/dns_global.cc
+++ b/chrome/browser/net/dns_global.cc
@@ -16,7 +16,7 @@
#include "chrome/browser/net/referrer.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/session_startup_pref.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_type.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@@ -293,16 +293,16 @@ class OffTheRecordObserver : public NotificationObserver {
void Register() {
NotificationService* service = NotificationService::current();
// TODO(tc): These notification observers are never removed.
- service->AddObserver(this, NOTIFY_BROWSER_CLOSED,
+ service->AddObserver(this, NotificationType::BROWSER_CLOSED,
NotificationService::AllSources());
- service->AddObserver(this, NOTIFY_BROWSER_OPENED,
+ service->AddObserver(this, NotificationType::BROWSER_OPENED,
NotificationService::AllSources());
}
void Observe(NotificationType type, const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_BROWSER_OPENED:
+ switch (type.value) {
+ case NotificationType::BROWSER_OPENED:
if (!Source<Browser>(source)->profile()->IsOffTheRecord())
break;
{
@@ -312,7 +312,7 @@ class OffTheRecordObserver : public NotificationObserver {
OnTheRecord(false);
break;
- case NOTIFY_BROWSER_CLOSED:
+ case NotificationType::BROWSER_CLOSED:
if (!Source<Browser>(source)->profile()->IsOffTheRecord())
break; // Ignore ordinary windows.
{