summaryrefslogtreecommitdiffstats
path: root/chrome/browser/jsmessage_box_handler.cc
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-15 20:10:49 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-15 20:10:49 +0000
commit849890b62b75f95cf91ebd3fe49f1525ff6595bd (patch)
treed41eef8bb5a3e52ef3a8e356d08d99dd3baacd9f /chrome/browser/jsmessage_box_handler.cc
parent3a453fa1f16dfa4168e52790e329148366abb05f (diff)
downloadchromium_src-849890b62b75f95cf91ebd3fe49f1525ff6595bd.zip
chromium_src-849890b62b75f95cf91ebd3fe49f1525ff6595bd.tar.gz
chromium_src-849890b62b75f95cf91ebd3fe49f1525ff6595bd.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. As part of this, I got very frustrated recompiling the world whenever navigation_types.h changed. So I removed this dependency from the notification service which everybody includes. Most of the changed files are adding notification_types.h in the .cc file where it's needed. BUG=1325636,1321376,1325779 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/jsmessage_box_handler.cc')
-rw-r--r--chrome/browser/jsmessage_box_handler.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/chrome/browser/jsmessage_box_handler.cc b/chrome/browser/jsmessage_box_handler.cc
index 09b9757..549981a 100644
--- a/chrome/browser/jsmessage_box_handler.cc
+++ b/chrome/browser/jsmessage_box_handler.cc
@@ -63,7 +63,7 @@ void JavascriptMessageBoxHandler::RunJavascriptMessageBox(
JavascriptMessageBoxHandler::~JavascriptMessageBoxHandler() {
NotificationService::current()->
- RemoveObserver(this, NOTIFY_NAV_STATE_CHANGED,
+ RemoveObserver(this, NOTIFY_NAV_ENTRY_COMMITTED,
NotificationService::AllSources());
NotificationService::current()->
RemoveObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED,
@@ -188,7 +188,7 @@ void JavascriptMessageBoxHandler::Observe(NotificationType type,
if (!web_contents_)
return;
- if (type == NOTIFY_NAV_STATE_CHANGED &&
+ if (type == NOTIFY_NAV_ENTRY_COMMITTED &&
Source<NavigationController>(source).ptr() == web_contents_->controller())
web_contents_gone = true;
@@ -230,7 +230,7 @@ JavascriptMessageBoxHandler::JavascriptMessageBoxHandler(
// Make sure we get navigation notifications so we know when our parent
// contents will disappear or navigate to a different page.
NotificationService::current()->
- AddObserver(this, NOTIFY_NAV_STATE_CHANGED,
+ AddObserver(this, NOTIFY_NAV_ENTRY_COMMITTED,
NotificationService::AllSources());
NotificationService::current()->
AddObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED,