From 43211582b1fa8c69136385250e7b0446cf364b5c Mon Sep 17 00:00:00 2001
From: "ananta@chromium.org"
 <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Sun, 10 Jul 2011 15:52:27 +0000
Subject: Moving notification types which are chrome specific to a new header
 file chrome_notification_types.h. This file lives in chrome\common. The
 chrome specific notifications start from NOTIFICATION_CONTENT_END which
 defines the end of the enum used by content to define notification types. The
 notificaton_type.h file in content\common has been renamed to
 content_notification_types.h

BUG=76698
Review URL: http://codereview.chromium.org/7327007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91972 0039d316-1c4b-4281-b951-d872f2087c98
---
 chrome/browser/download/download_browsertest.cc         |  7 ++++---
 chrome/browser/download/download_crx_util.cc            |  3 ++-
 chrome/browser/download/download_item.cc                |  9 +++++----
 chrome/browser/download/download_item.h                 |  2 +-
 chrome/browser/download/download_manager.cc             |  2 +-
 chrome/browser/download/download_request_limiter.cc     | 16 ++++++++--------
 chrome/browser/download/download_request_limiter.h      |  2 +-
 chrome/browser/download/download_util.cc                |  7 ++++---
 chrome/browser/download/mhtml_generation_browsertest.cc |  3 ++-
 chrome/browser/download/mhtml_generation_manager.cc     |  3 ++-
 chrome/browser/download/save_package.cc                 |  4 ++--
 chrome/browser/download/save_page_browsertest.cc        |  3 ++-
 12 files changed, 34 insertions(+), 27 deletions(-)

(limited to 'chrome/browser/download')

diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index 5248ecb..7bebb65 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -29,6 +29,7 @@
 #include "chrome/browser/ui/browser_list.h"
 #include "chrome/browser/ui/browser_window.h"
 #include "chrome/browser/ui/webui/active_downloads_ui.h"
+#include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/chrome_paths.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/url_constants.h"
@@ -1130,7 +1131,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, IncognitoDownload) {
   // message loop runs.  So it isn't possible to get a BROWSER_CLOSED
   // notification inside of a test.
   ui_test_utils::WindowedNotificationObserver signal(
-      NotificationType::BROWSER_CLOSED,
+      chrome::NOTIFICATION_BROWSER_CLOSED,
       Source<Browser>(incognito));
 #endif
 
@@ -1381,7 +1382,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) {
   // message loop runs.  So it isn't possible to get a BROWSER_CLOSED
   // notification inside of a test.
   ui_test_utils::WindowedNotificationObserver signal(
-      NotificationType::BROWSER_CLOSED,
+      chrome::NOTIFICATION_BROWSER_CLOSED,
       Source<Browser>(download_browser));
 #endif
 
@@ -1541,7 +1542,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DISABLED_BrowserCloseAfterDownload) {
   DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG);
 
   ui_test_utils::WindowedNotificationObserver signal(
-      NotificationType::BROWSER_CLOSED,
+      chrome::NOTIFICATION_BROWSER_CLOSED,
       Source<Browser>(browser()));
   browser()->CloseWindow();
   signal.Wait();
diff --git a/chrome/browser/download/download_crx_util.cc b/chrome/browser/download/download_crx_util.cc
index ef051c0..53408be 100644
--- a/chrome/browser/download/download_crx_util.cc
+++ b/chrome/browser/download/download_crx_util.cc
@@ -10,6 +10,7 @@
 #include "chrome/browser/extensions/extension_install_ui.h"
 #include "chrome/browser/extensions/extension_service.h"
 #include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_notification_types.h"
 #include "content/common/notification_service.h"
 
 namespace download_crx_util {
@@ -55,7 +56,7 @@ scoped_refptr<CrxInstaller> OpenChromeExtension(
   CHECK(service);
   NotificationService* nservice = NotificationService::current();
   GURL nonconst_download_url = download_item.GetURL();
-  nservice->Notify(NotificationType::EXTENSION_READY_FOR_INSTALL,
+  nservice->Notify(chrome::NOTIFICATION_EXTENSION_READY_FOR_INSTALL,
                    Source<DownloadManager>(profile->GetDownloadManager()),
                    Details<GURL>(&nonconst_download_url));
 
diff --git a/chrome/browser/download/download_item.cc b/chrome/browser/download/download_item.cc
index 7f75dc1..0c3dca1 100644
--- a/chrome/browser/download/download_item.cc
+++ b/chrome/browser/download/download_item.cc
@@ -28,6 +28,7 @@
 #include "chrome/browser/platform_util.h"
 #include "chrome/browser/prefs/pref_service.h"
 #include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/extensions/extension.h"
 #include "chrome/common/pref_names.h"
 #include "content/browser/browser_thread.h"
@@ -462,7 +463,7 @@ void DownloadItem::StartCrxInstall() {
   // will call Completed() on this item.  If this DownloadItem is not
   // around when CRX_INSTALLER_DONE fires, Complete() will not be called.
   registrar_.Add(this,
-                 NotificationType::CRX_INSTALLER_DONE,
+                 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
                  Source<CrxInstaller>(crx_installer.get()));
 
   // The status text and percent complete indicator will change now
@@ -472,17 +473,17 @@ void DownloadItem::StartCrxInstall() {
 }
 
 // NotificationObserver implementation.
-void DownloadItem::Observe(NotificationType type,
+void DownloadItem::Observe(int type,
                            const NotificationSource& source,
                            const NotificationDetails& details) {
   // TODO(rdsmith): Change to DCHECK after http://crbug.com/85408 resolved.
   CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
-  DCHECK(type == NotificationType::CRX_INSTALLER_DONE);
+  DCHECK(type == chrome::NOTIFICATION_CRX_INSTALLER_DONE);
 
   // No need to listen for CRX_INSTALLER_DONE anymore.
   registrar_.Remove(this,
-                    NotificationType::CRX_INSTALLER_DONE,
+                    chrome::NOTIFICATION_CRX_INSTALLER_DONE,
                     source);
 
   auto_opened_ = true;
diff --git a/chrome/browser/download/download_item.h b/chrome/browser/download/download_item.h
index c22a5bf..28afd07 100644
--- a/chrome/browser/download/download_item.h
+++ b/chrome/browser/download/download_item.h
@@ -131,7 +131,7 @@ class DownloadItem : public NotificationObserver {
   void UpdateObservers();
 
   // NotificationObserver implementation.
-  virtual void Observe(NotificationType type,
+  virtual void Observe(int type,
                        const NotificationSource& source,
                        const NotificationDetails& details);
 
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index bdac293..01a0e69 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -42,7 +42,7 @@
 #include "content/browser/renderer_host/render_view_host.h"
 #include "content/browser/renderer_host/resource_dispatcher_host.h"
 #include "content/browser/tab_contents/tab_contents.h"
-#include "content/common/notification_type.h"
+#include "content/common/content_notification_types.h"
 #include "googleurl/src/gurl.h"
 #include "grit/generated_resources.h"
 #include "grit/theme_resources.h"
diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc
index 39f776e..724935a 100644
--- a/chrome/browser/download/download_request_limiter.cc
+++ b/chrome/browser/download/download_request_limiter.cc
@@ -31,9 +31,9 @@ DownloadRequestLimiter::TabDownloadState::TabDownloadState(
       download_count_(0),
       infobar_(NULL) {
   Source<NavigationController> notification_source(controller);
-  registrar_.Add(this, NotificationType::NAV_ENTRY_PENDING,
+  registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING,
                  notification_source);
-  registrar_.Add(this, NotificationType::TAB_CLOSED, notification_source);
+  registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, notification_source);
 
   NavigationEntry* active_entry = originating_controller ?
       originating_controller->GetActiveEntry() : controller->GetActiveEntry();
@@ -91,18 +91,18 @@ void DownloadRequestLimiter::TabDownloadState::Accept() {
 }
 
 void DownloadRequestLimiter::TabDownloadState::Observe(
-    NotificationType type,
+    int type,
     const NotificationSource& source,
     const NotificationDetails& details) {
-  if ((type != NotificationType::NAV_ENTRY_PENDING &&
-       type != NotificationType::TAB_CLOSED) ||
+  if ((type != content::NOTIFICATION_NAV_ENTRY_PENDING &&
+       type != content::NOTIFICATION_TAB_CLOSED) ||
       Source<NavigationController>(source).ptr() != controller_) {
     NOTREACHED();
     return;
   }
 
-  switch (type.value) {
-    case NotificationType::NAV_ENTRY_PENDING: {
+  switch (type) {
+    case content::NOTIFICATION_NAV_ENTRY_PENDING: {
       // NOTE: resetting state on a pending navigate isn't ideal. In particular
       // it is possible that queued up downloads for the page before the
       // pending navigate will be delivered to us after we process this
@@ -131,7 +131,7 @@ void DownloadRequestLimiter::TabDownloadState::Observe(
       break;
     }
 
-    case NotificationType::TAB_CLOSED:
+    case content::NOTIFICATION_TAB_CLOSED:
       // Tab closed, no need to handle closing the dialog as it's owned by the
       // TabContents, break so that we get deleted after switch.
       break;
diff --git a/chrome/browser/download/download_request_limiter.h b/chrome/browser/download/download_request_limiter.h
index e32a81c..135d9af 100644
--- a/chrome/browser/download/download_request_limiter.h
+++ b/chrome/browser/download/download_request_limiter.h
@@ -131,7 +131,7 @@ class DownloadRequestLimiter
 
    private:
     // NotificationObserver method.
-    virtual void Observe(NotificationType type,
+    virtual void Observe(int type,
                          const NotificationSource& source,
                          const NotificationDetails& details);
 
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index 83acdb7..b125e74 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -34,6 +34,7 @@
 #include "chrome/browser/download/download_types.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/ui/browser.h"
+#include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/chrome_paths.h"
 #include "chrome/common/time_format.h"
 #include "content/browser/browser_thread.h"
@@ -860,9 +861,9 @@ void NotifyDownloadInitiated(int render_process_id, int render_view_id) {
   if (!rvh)
     return;
 
-  NotificationService::current()->Notify(NotificationType::DOWNLOAD_INITIATED,
-                                         Source<RenderViewHost>(rvh),
-                                         NotificationService::NoDetails());
+  NotificationService::current()->Notify(
+      chrome::NOTIFICATION_DOWNLOAD_INITIATED, Source<RenderViewHost>(rvh),
+      NotificationService::NoDetails());
 }
 
 int GetUniquePathNumberWithCrDownload(const FilePath& path) {
diff --git a/chrome/browser/download/mhtml_generation_browsertest.cc b/chrome/browser/download/mhtml_generation_browsertest.cc
index 6077b02..914d008 100644
--- a/chrome/browser/download/mhtml_generation_browsertest.cc
+++ b/chrome/browser/download/mhtml_generation_browsertest.cc
@@ -7,6 +7,7 @@
 #include "chrome/browser/download/mhtml_generation_manager.h"
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/chrome_notification_types.h"
 #include "chrome/test/in_process_browser_test.h"
 #include "chrome/test/testing_browser_process.h"
 #include "chrome/test/ui_test_utils.h"
@@ -49,7 +50,7 @@ IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) {
   Source<RenderViewHost> source(tab->render_view_host());
   ui_test_utils::WindowedNotificationObserverWithDetails<
       MHTMLGenerationManager::NotificationDetails> signal(
-          NotificationType::MHTML_GENERATED, source);
+          chrome::NOTIFICATION_MHTML_GENERATED, source);
   mhtml_generation_manager->GenerateMHTML(tab, path);
   signal.Wait();
 
diff --git a/chrome/browser/download/mhtml_generation_manager.cc b/chrome/browser/download/mhtml_generation_manager.cc
index ea98155..632232f 100644
--- a/chrome/browser/download/mhtml_generation_manager.cc
+++ b/chrome/browser/download/mhtml_generation_manager.cc
@@ -6,6 +6,7 @@
 
 #include "base/platform_file.h"
 #include "chrome/browser/tab_contents/tab_util.h"
+#include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/render_messages.h"
 #include "content/browser/renderer_host/render_process_host.h"
 #include "content/browser/renderer_host/render_view_host.h"
@@ -118,7 +119,7 @@ void MHTMLGenerationManager::JobFinished(int job_id, bool success) {
     details.success = success;
 
     NotificationService::current()->Notify(
-        NotificationType::MHTML_GENERATED,
+        chrome::NOTIFICATION_MHTML_GENERATED,
         Source<RenderViewHost>(tab_contents->render_view_host()),
         Details<NotificationDetails>(&details));
   }
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index ddc12b1..8e37206 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -35,6 +35,7 @@
 #include "chrome/browser/tab_contents/tab_util.h"
 #include "chrome/browser/ui/download/download_tab_helper.h"
 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/chrome_paths.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/common/render_messages.h"
@@ -46,7 +47,6 @@
 #include "content/browser/renderer_host/resource_dispatcher_host.h"
 #include "content/browser/tab_contents/tab_contents.h"
 #include "content/common/notification_service.h"
-#include "content/common/notification_type.h"
 #include "grit/generated_resources.h"
 #include "net/base/io_buffer.h"
 #include "net/base/mime_util.h"
@@ -747,7 +747,7 @@ void SavePackage::Finish() {
   download_->MarkAsComplete();
 
   NotificationService::current()->Notify(
-      NotificationType::SAVE_PACKAGE_SUCCESSFULLY_FINISHED,
+      chrome::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED,
       Source<SavePackage>(this),
       Details<GURL>(&page_url_));
 }
diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc
index 88dd702..bbf0f78 100644
--- a/chrome/browser/download/save_page_browsertest.cc
+++ b/chrome/browser/download/save_page_browsertest.cc
@@ -13,6 +13,7 @@
 #include "chrome/browser/ui/download/download_tab_helper.h"
 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
 #include "chrome/browser/ui/webui/active_downloads_ui.h"
+#include "chrome/common/chrome_notification_types.h"
 #include "chrome/common/chrome_paths.h"
 #include "chrome/common/url_constants.h"
 #include "chrome/test/in_process_browser_test.h"
@@ -44,7 +45,7 @@ class SavePageBrowserTest : public InProcessBrowserTest {
   GURL WaitForSavePackageToFinish() {
     ui_test_utils::TestNotificationObserver observer;
     ui_test_utils::RegisterAndWait(&observer,
-        NotificationType::SAVE_PACKAGE_SUCCESSFULLY_FINISHED,
+        chrome::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED,
         NotificationService::AllSources());
     return *Details<GURL>(observer.details()).ptr();
   }
-- 
cgit v1.1