diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-19 17:38:12 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-19 17:38:12 +0000 |
commit | 6cf85906b0504908e3fd0fafa46be78903bfd6b9 (patch) | |
tree | 564d578de2118da6012571178e9f557da2e164a5 /chrome/browser/session_service.cc | |
parent | dfcb522ab183af2bfd6924e32bf43a8bd173097c (diff) | |
download | chromium_src-6cf85906b0504908e3fd0fafa46be78903bfd6b9.zip chromium_src-6cf85906b0504908e3fd0fafa46be78903bfd6b9.tar.gz chromium_src-6cf85906b0504908e3fd0fafa46be78903bfd6b9.tar.bz2 |
Cleans up notifications for the NavigationController. There were several
notifications before and some of them were very unclear and misused (STATE_CHANGED). This one, and PRUNED were called unnecessarily in some cases as well.
I replaced STATE_CHANGED and INDEX_CHANGED with ENTRY_COMMITTED which is more clear and covers (I think!) all the cases that the callers care about.
I added a simple notification testing helper class, and used in the navigation controller unit tests to make sure we get the proper notifications. I had to change NotificationSource/Details to have a = and copy constructor so I can track them easily in my helper. I don't see why this would be bad.
BUG=1325636,1321376,1325779
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1039 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/session_service.cc')
-rw-r--r-- | chrome/browser/session_service.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/chrome/browser/session_service.cc b/chrome/browser/session_service.cc index 9ed3d9f..da72060 100644 --- a/chrome/browser/session_service.cc +++ b/chrome/browser/session_service.cc @@ -160,7 +160,7 @@ SessionService::~SessionService() { NotificationService::current()->RemoveObserver( this, NOTIFY_NAV_ENTRY_CHANGED, NotificationService::AllSources()); NotificationService::current()->RemoveObserver( - this, NOTIFY_NAV_INDEX_CHANGED, NotificationService::AllSources()); + this, NOTIFY_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); } void SessionService::ResetFromCurrentBrowsers() { @@ -417,7 +417,7 @@ void SessionService::Init(const std::wstring& path) { NotificationService::current()->AddObserver( this, NOTIFY_NAV_ENTRY_CHANGED, NotificationService::AllSources()); NotificationService::current()->AddObserver( - this, NOTIFY_NAV_INDEX_CHANGED, NotificationService::AllSources()); + this, NOTIFY_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); DCHECK(!path.empty()); commands_since_reset_ = 0; @@ -450,7 +450,7 @@ void SessionService::Observe(NotificationType type, changed->index, *changed->changed_entry); break; } - case NOTIFY_NAV_INDEX_CHANGED: + case NOTIFY_NAV_ENTRY_COMMITTED: SetSelectedNavigationIndex(controller->window_id(), controller->session_id(), controller->GetCurrentEntryIndex()); |