From bfd04a62ce610d7bb61dbb78811dccbed23589b7 Mon Sep 17 00:00:00 2001 From: "brettw@chromium.org" Date: Sun, 1 Feb 2009 18:16:56 +0000 Subject: 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 --- chrome/browser/sessions/session_service.cc | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'chrome/browser/sessions/session_service.cc') diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 4f5861e..5f060d8 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -24,7 +24,6 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_details.h" #include "chrome/common/notification_service.h" -#include "chrome/common/notification_types.h" #include "chrome/common/scoped_vector.h" #include "chrome/common/win_util.h" @@ -366,17 +365,17 @@ SessionService::Handle SessionService::GetLastSession( void SessionService::Init() { // Register for the notifications we're interested in. - registrar_.Add(this, NOTIFY_TAB_PARENTED, + registrar_.Add(this, NotificationType::TAB_PARENTED, NotificationService::AllSources()); - registrar_.Add(this, NOTIFY_TAB_CLOSED, + registrar_.Add(this, NotificationType::TAB_CLOSED, NotificationService::AllSources()); - registrar_.Add(this, NOTIFY_NAV_LIST_PRUNED, + registrar_.Add(this, NotificationType::NAV_LIST_PRUNED, NotificationService::AllSources()); - registrar_.Add(this, NOTIFY_NAV_ENTRY_CHANGED, + registrar_.Add(this, NotificationType::NAV_ENTRY_CHANGED, NotificationService::AllSources()); - registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED, + registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, NotificationService::AllSources()); - registrar_.Add(this, NOTIFY_BROWSER_OPENED, + registrar_.Add(this, NotificationType::BROWSER_OPENED, NotificationService::AllSources()); } @@ -384,8 +383,8 @@ void SessionService::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { // All of our messages have the NavigationController as the source. - switch (type) { - case NOTIFY_BROWSER_OPENED: { + switch (type.value) { + case NotificationType::BROWSER_OPENED: { Browser* browser = Source(source).ptr(); if (browser->profile() != profile() || !should_track_changes_for_browser_type(browser->type())) { @@ -410,21 +409,21 @@ void SessionService::Observe(NotificationType type, break; } - case NOTIFY_TAB_PARENTED: { + case NotificationType::TAB_PARENTED: { NavigationController* controller = Source(source).ptr(); SetTabWindow(controller->window_id(), controller->session_id()); break; } - case NOTIFY_TAB_CLOSED: { + case NotificationType::TAB_CLOSED: { NavigationController* controller = Source(source).ptr(); TabClosed(controller->window_id(), controller->session_id()); break; } - case NOTIFY_NAV_LIST_PRUNED: { + case NotificationType::NAV_LIST_PRUNED: { NavigationController* controller = Source(source).ptr(); Details pruned_details(details); @@ -440,7 +439,7 @@ void SessionService::Observe(NotificationType type, break; } - case NOTIFY_NAV_ENTRY_CHANGED: { + case NotificationType::NAV_ENTRY_CHANGED: { NavigationController* controller = Source(source).ptr(); Details changed(details); @@ -449,7 +448,7 @@ void SessionService::Observe(NotificationType type, break; } - case NOTIFY_NAV_ENTRY_COMMITTED: { + case NotificationType::NAV_ENTRY_COMMITTED: { NavigationController* controller = Source(source).ptr(); int current_entry_index = controller->GetCurrentEntryIndex(); -- cgit v1.1