If a page is navigated within the same render process, the active notifications need to go out of scope so we don't try to fire events on them back to the original page.

BUG=32862
TEST=reload page then close notification

Review URL: http://codereview.chromium.org/549140

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37019 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/renderer/notification_provider.cc b/chrome/renderer/notification_provider.cc
index 30ca716..4489951 100644
--- a/chrome/renderer/notification_provider.cc
+++ b/chrome/renderer/notification_provider.cc
@@ -79,6 +79,10 @@
   return handled;
 }
 
+void NotificationProvider::OnNavigate() {
+  //  manager_.Clear();
+}
+
 bool NotificationProvider::ShowHTML(const WebNotification& notification,
                                     int id) {
   // Disallow HTML notifications from non-HTTP schemes.
@@ -126,9 +130,10 @@
   bool found = manager_.GetNotification(id, &notification);
   // |found| may be false if the WebNotification went out of scope in
   // the page before the associated toast was closed by the user.
-  if (found)
+  if (found) {
     notification.dispatchCloseEvent(by_user);
-  manager_.UnregisterNotification(id);
+    manager_.UnregisterNotification(id);
+  }
 }
 
 void NotificationProvider::OnPermissionRequestComplete(int id) {