diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-10 15:52:27 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-10 15:52:27 +0000 |
commit | 43211582b1fa8c69136385250e7b0446cf364b5c (patch) | |
tree | 655ab01543012b6fd5699dee8fab92876959b7d9 /chrome | |
parent | d43970a7ceee5fc5433787b0f28b64234a4039f2 (diff) | |
download | chromium_src-43211582b1fa8c69136385250e7b0446cf364b5c.zip chromium_src-43211582b1fa8c69136385250e7b0446cf364b5c.tar.gz chromium_src-43211582b1fa8c69136385250e7b0446cf364b5c.tar.bz2 |
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
Diffstat (limited to 'chrome')
757 files changed, 4514 insertions, 3287 deletions
diff --git a/chrome/browser/accessibility/accessibility_win_browsertest.cc b/chrome/browser/accessibility/accessibility_win_browsertest.cc index c1df50a..6af144f 100644 --- a/chrome/browser/accessibility/accessibility_win_browsertest.cc +++ b/chrome/browser/accessibility/accessibility_win_browsertest.cc @@ -17,7 +17,7 @@ #include "chrome/test/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #include "ia2_api_all.h" // Generated NOLINT #include "ISimpleDOMNode.h" // Generated NOLINT @@ -337,7 +337,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, // Wait for the initial accessibility tree to load. Busy state should clear. ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); document1_checker.SetExpectedState( STATE_SYSTEM_READONLY | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED); document1_checker.CheckAccessible(GetRendererAccessible()); @@ -348,7 +348,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, "</body></html>"); browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check the browser's copy of the renderer accessibility tree. AccessibleChecker button_checker(L"push", ROLE_SYSTEM_PUSHBUTTON, L"push"); @@ -388,7 +388,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); GetRendererAccessible(); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check the browser's copy of the renderer accessibility tree. AccessibleChecker list_marker_checker(L"", ROLE_SYSTEM_LISTITEM, L"\x2022"); @@ -409,7 +409,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, // Set focus to the radio group. ExecuteScript(L"document.body.children[0].focus()"); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check that the accessibility tree of the browser has been updated. radio_group_checker.SetExpectedState( @@ -420,7 +420,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, ExecuteScript( L"document.body.children[0].setAttribute('aria-activedescendant', 'li')"); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check that the accessibility tree of the browser has been updated. list_item_checker.SetExpectedState( @@ -436,7 +436,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); GetRendererAccessible(); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check the browser's copy of the renderer accessibility tree. AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L""); @@ -451,7 +451,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, // Check the checkbox. ExecuteScript(L"document.body.children[0].checked=true"); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check that the accessibility tree of the browser has been updated. checkbox_checker.SetExpectedState( @@ -467,7 +467,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); GetRendererAccessible(); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check the browser's copy of the renderer accessibility tree. AccessibleChecker body_checker(L"", L"body", L""); @@ -478,7 +478,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, // Change the children of the document body. ExecuteScript(L"document.body.innerHTML='<b>new text</b>'"); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check that the accessibility tree of the browser has been updated. AccessibleChecker text_checker(L"new text", ROLE_SYSTEM_TEXT, L""); @@ -495,7 +495,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); GetRendererAccessible(); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check the accessible tree of the browser. AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); @@ -504,7 +504,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, // Change the children of the document body. ExecuteScript(L"document.body.children[0].style.visibility='visible'"); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check that the accessibility tree of the browser has been updated. AccessibleChecker static_text_checker(L"text", ROLE_SYSTEM_TEXT, L""); @@ -522,7 +522,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); GetRendererAccessible(); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check the browser's copy of the renderer accessibility tree. AccessibleChecker div_checker(L"", L"div", L""); @@ -535,7 +535,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, // Focus the div in the document ExecuteScript(L"document.body.children[0].focus()"); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check that the accessibility tree of the browser has been updated. div_checker.SetExpectedState( @@ -550,7 +550,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, SELFLAG_TAKEFOCUS, CreateI4Variant(CHILDID_SELF)); ASSERT_EQ(S_OK, hr); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check that the accessibility tree of the browser has been updated. div_checker.SetExpectedState( @@ -565,7 +565,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); GetRendererAccessible(); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check the browser's copy of the renderer accessibility tree. @@ -580,7 +580,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, // Set the value of the text control ExecuteScript(L"document.body.children[0].value='new value'"); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Check that the accessibility tree of the browser has been updated. text_field_checker.SetExpectedValue(L"new value"); @@ -602,7 +602,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); GetRendererAccessible(); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Get the accessibility object for the browser window. HWND browser_hwnd = browser()->window()->GetNativeHandle(); @@ -626,7 +626,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, browser()->OpenURL(tree_url, GURL(), CURRENT_TAB, PageTransition::TYPED); GetRendererAccessible(); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); // Get the IAccessible object for the document. base::win::ScopedComPtr<IAccessible> document_accessible( diff --git a/chrome/browser/accessibility/renderer_accessibility_browsertest.cc b/chrome/browser/accessibility/renderer_accessibility_browsertest.cc index 6c4c0b7..123e559 100644 --- a/chrome/browser/accessibility/renderer_accessibility_browsertest.cc +++ b/chrome/browser/accessibility/renderer_accessibility_browsertest.cc @@ -15,7 +15,7 @@ #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #if defined(OS_WIN) #include <atlbase.h> @@ -40,7 +40,7 @@ class RendererAccessibilityBrowserTest : public InProcessBrowserTest { view_host->set_save_accessibility_tree_for_testing(true); view_host->EnableRendererAccessibility(); ui_test_utils::WaitForNotification( - NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); + content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); return view_host->accessibility_tree(); } diff --git a/chrome/browser/accessibility_events.cc b/chrome/browser/accessibility_events.cc index d0fa35f..79a1126 100644 --- a/chrome/browser/accessibility_events.cc +++ b/chrome/browser/accessibility_events.cc @@ -8,13 +8,13 @@ #include "chrome/browser/extensions/extension_accessibility_api_constants.h" #include "chrome/browser/profiles/profile.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace keys = extension_accessibility_api_constants; void SendAccessibilityNotification( - NotificationType type, AccessibilityControlInfo* info) { + int type, AccessibilityControlInfo* info) { Profile *profile = info->profile(); if (profile->ShouldSendAccessibilityEvents()) { NotificationService::current()->Notify( diff --git a/chrome/browser/accessibility_events.h b/chrome/browser/accessibility_events.h index 3d0ae6a..072bd9e 100644 --- a/chrome/browser/accessibility_events.h +++ b/chrome/browser/accessibility_events.h @@ -10,7 +10,6 @@ class AccessibilityControlInfo; class DictionaryValue; -class NotificationType; class Profile; // Use the NotificationService to post the given accessibility @@ -18,7 +17,7 @@ class Profile; // listeners. Will not send if the profile's pause level is nonzero // (using profile->PauseAccessibilityEvents). void SendAccessibilityNotification( - NotificationType type, AccessibilityControlInfo* info); + int type, AccessibilityControlInfo* info); // Abstract parent class for accessibility information about a control // passed to event listeners. diff --git a/chrome/browser/alternate_nav_url_fetcher.cc b/chrome/browser/alternate_nav_url_fetcher.cc index 0511aa4..815e0dc 100644 --- a/chrome/browser/alternate_nav_url_fetcher.cc +++ b/chrome/browser/alternate_nav_url_fetcher.cc @@ -26,17 +26,17 @@ AlternateNavURLFetcher::AlternateNavURLFetcher( state_(NOT_STARTED), navigated_to_entry_(false), infobar_contents_(NULL) { - registrar_.Add(this, NotificationType::NAV_ENTRY_PENDING, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, NotificationService::AllSources()); } AlternateNavURLFetcher::~AlternateNavURLFetcher() {} -void AlternateNavURLFetcher::Observe(NotificationType type, +void AlternateNavURLFetcher::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::NAV_ENTRY_PENDING: + switch (type) { + case content::NOTIFICATION_NAV_ENTRY_PENDING: // If we've already received a notification for the same controller, we // should delete ourselves as that indicates that the page is being // re-loaded so this instance is now stale. @@ -51,9 +51,9 @@ void AlternateNavURLFetcher::Observe(NotificationType type, // Start listening for the commit notification. We also need to listen // for the tab close command since that means the load will never // commit! - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(controller_)); - registrar_.Add(this, NotificationType::TAB_CLOSED, + registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, Source<NavigationController>(controller_)); DCHECK_EQ(NOT_STARTED, state_); @@ -66,15 +66,15 @@ void AlternateNavURLFetcher::Observe(NotificationType type, } break; - case NotificationType::NAV_ENTRY_COMMITTED: + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: // The page was navigated, we can show the infobar now if necessary. - registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(controller_)); navigated_to_entry_ = true; ShowInfobarIfPossible(); break; - case NotificationType::TAB_CLOSED: + case content::NOTIFICATION_TAB_CLOSED: // We have been closed. In order to prevent the URLFetcher from trying to // access the controller that will be invalid, we delete ourselves. // This deletes the URLFetcher and insures its callback won't be called. diff --git a/chrome/browser/alternate_nav_url_fetcher.h b/chrome/browser/alternate_nav_url_fetcher.h index 13b8bd7..07fdf33 100644 --- a/chrome/browser/alternate_nav_url_fetcher.h +++ b/chrome/browser/alternate_nav_url_fetcher.h @@ -47,7 +47,7 @@ class AlternateNavURLFetcher : public NotificationObserver, private: // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 61e8e09..db0a2d1 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -52,6 +52,7 @@ #include "content/browser/browser_thread.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/user_metrics.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -474,7 +475,7 @@ void RecordLastRunAppBundlePath() { return; NotificationService::current()->Notify( - NotificationType::NO_KEY_WINDOW, + chrome::NOTIFICATION_NO_KEY_WINDOW, NotificationService::AllSources(), NotificationService::NoDetails()); } @@ -549,7 +550,7 @@ void RecordLastRunAppBundlePath() { // This is called after profiles have been loaded and preferences registered. // It is safe to access the default profile here. - (void)applicationDidBecomeActive:(NSNotification*)notify { - NotificationService::current()->Notify(NotificationType::APP_ACTIVATED, + NotificationService::current()->Notify(chrome::NOTIFICATION_APP_ACTIVATED, NotificationService::AllSources(), NotificationService::NoDetails()); } diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index ab72ec2..fff149f 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -30,6 +30,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/ui/webui/history_ui.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -984,7 +985,7 @@ void AutocompleteController::NotifyChanged(bool notify_default_match) { delegate_->OnResultChanged(notify_default_match); if (done_) { NotificationService::current()->Notify( - NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_READY, + chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, Source<AutocompleteController>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/autocomplete/autocomplete_browsertest.cc b/chrome/browser/autocomplete/autocomplete_browsertest.cc index 6266554..e6f5544 100644 --- a/chrome/browser/autocomplete/autocomplete_browsertest.cc +++ b/chrome/browser/autocomplete/autocomplete_browsertest.cc @@ -24,7 +24,7 @@ #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #include "testing/gtest/include/gtest/gtest.h" // Autocomplete test is flaky on ChromeOS. diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 5d27978..8bee00e 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -31,6 +31,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "content/browser/user_metrics.h" #include "content/common/notification_service.h" @@ -500,7 +501,7 @@ void AutocompleteEditModel::OpenMatch(const AutocompleteMatch& match, else if (!has_temporary_text_) log.inline_autocompleted_length = inline_autocomplete_text_.length(); NotificationService::current()->Notify( - NotificationType::OMNIBOX_OPENED_URL, Source<Profile>(profile_), + chrome::NOTIFICATION_OMNIBOX_OPENED_URL, Source<Profile>(profile_), Details<AutocompleteLog>(&log)); } @@ -590,7 +591,7 @@ const AutocompleteResult& AutocompleteEditModel::result() const { void AutocompleteEditModel::OnSetFocus(bool control_down) { has_focus_ = true; control_key_state_ = control_down ? DOWN_WITHOUT_CHANGE : UP; - NotificationService::current()->Notify(NotificationType::OMNIBOX_FOCUSED, + NotificationService::current()->Notify(chrome::NOTIFICATION_OMNIBOX_FOCUSED, Source<AutocompleteEditModel>(this), NotificationService::NoDetails()); InstantController* instant = controller_->GetInstant(); diff --git a/chrome/browser/autocomplete/autocomplete_unittest.cc b/chrome/browser/autocomplete/autocomplete_unittest.cc index 08b4885..2b2a17b 100644 --- a/chrome/browser/autocomplete/autocomplete_unittest.cc +++ b/chrome/browser/autocomplete/autocomplete_unittest.cc @@ -14,6 +14,7 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/testing_browser_process.h" #include "chrome/test/testing_browser_process_test.h" #include "chrome/test/testing_profile.h" @@ -122,7 +123,7 @@ class AutocompleteProviderTest : public testing::Test, private: // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -159,7 +160,8 @@ void AutocompleteProviderTest::ResetControllerWithTestProviders( // The providers don't complete synchronously, so listen for "result updated" // notifications. - registrar_.Add(this, NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_READY, + registrar_.Add(this, + chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, NotificationService::AllSources()); } @@ -230,7 +232,7 @@ void AutocompleteProviderTest::RunExactKeymatchTest( controller_->result().default_match()->provider); } -void AutocompleteProviderTest::Observe(NotificationType type, +void AutocompleteProviderTest::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (controller_->done()) { diff --git a/chrome/browser/autocomplete/extension_app_provider.cc b/chrome/browser/autocomplete/extension_app_provider.cc index e82250c..0a68e8c 100644 --- a/chrome/browser/autocomplete/extension_app_provider.cc +++ b/chrome/browser/autocomplete/extension_app_provider.cc @@ -13,6 +13,7 @@ #include "chrome/browser/history/history.h" #include "chrome/browser/history/url_database.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "ui/base/l10n/l10n_util.h" @@ -103,13 +104,13 @@ void ExtensionAppProvider::RefreshAppList() { } void ExtensionAppProvider::RegisterForNotifications() { - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UNINSTALLED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, NotificationService::AllSources()); } -void ExtensionAppProvider::Observe(NotificationType type, +void ExtensionAppProvider::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { RefreshAppList(); diff --git a/chrome/browser/autocomplete/extension_app_provider.h b/chrome/browser/autocomplete/extension_app_provider.h index 54480d7..f7fce2e 100644 --- a/chrome/browser/autocomplete/extension_app_provider.h +++ b/chrome/browser/autocomplete/extension_app_provider.h @@ -58,7 +58,7 @@ class ExtensionAppProvider : public AutocompleteProvider, const GURL& url); // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc index 8547b587..512d66f 100644 --- a/chrome/browser/autocomplete/history_quick_provider.cc +++ b/chrome/browser/autocomplete/history_quick_provider.cc @@ -22,8 +22,8 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "googleurl/src/url_parse.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "googleurl/src/url_util.h" #include "net/base/escape.h" #include "net/base/net_util.h" diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc index abf30e0..00580ef 100644 --- a/chrome/browser/autocomplete/keyword_provider.cc +++ b/chrome/browser/autocomplete/keyword_provider.cc @@ -16,6 +16,7 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" #include "grit/generated_resources.h" @@ -63,12 +64,13 @@ KeywordProvider::KeywordProvider(ACProviderListener* listener, Profile* profile) // Extension suggestions always come from the original profile, since that's // where extensions run. We use the input ID to distinguish whether the // suggestions are meant for us. - registrar_.Add(this, NotificationType::EXTENSION_OMNIBOX_SUGGESTIONS_READY, - Source<Profile>(profile->GetOriginalProfile())); registrar_.Add(this, - NotificationType::EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, + chrome::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY, Source<Profile>(profile->GetOriginalProfile())); - registrar_.Add(this, NotificationType::EXTENSION_OMNIBOX_INPUT_ENTERED, + registrar_.Add( + this, chrome::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, + Source<Profile>(profile->GetOriginalProfile())); + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, Source<Profile>(profile)); } @@ -451,15 +453,15 @@ AutocompleteMatch KeywordProvider::CreateAutocompleteMatch( return result; } -void KeywordProvider::Observe(NotificationType type, +void KeywordProvider::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { TemplateURLService* model = profile_ ? TemplateURLServiceFactory::GetForProfile(profile_) : model_; const AutocompleteInput& input = extension_suggest_last_input_; - switch (type.value) { - case NotificationType::EXTENSION_OMNIBOX_INPUT_ENTERED: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED: // Input has been accepted, so we're done with this input session. Ensure // we don't send the OnInputCancelled event, or handle any more stray // suggestions_ready events. @@ -467,7 +469,7 @@ void KeywordProvider::Observe(NotificationType type, current_input_id_ = 0; return; - case NotificationType::EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED: { + case chrome::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED: { // It's possible to change the default suggestion while not in an editing // session. string16 keyword, remaining_input; @@ -484,7 +486,7 @@ void KeywordProvider::Observe(NotificationType type, return; } - case NotificationType::EXTENSION_OMNIBOX_SUGGESTIONS_READY: { + case chrome::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY: { const ExtensionOmniboxSuggestions& suggestions = *Details<ExtensionOmniboxSuggestions>(details).ptr(); if (suggestions.request_id != current_input_id_) diff --git a/chrome/browser/autocomplete/keyword_provider.h b/chrome/browser/autocomplete/keyword_provider.h index 7e4518c..612be69 100644 --- a/chrome/browser/autocomplete/keyword_provider.h +++ b/chrome/browser/autocomplete/keyword_provider.h @@ -133,7 +133,7 @@ class KeywordProvider : public AutocompleteProvider, void MaybeEndExtensionKeywordMode(); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/autocomplete/shortcuts_provider.cc b/chrome/browser/autocomplete/shortcuts_provider.cc index 9c57298..b8aee2a6 100644 --- a/chrome/browser/autocomplete/shortcuts_provider.cc +++ b/chrome/browser/autocomplete/shortcuts_provider.cc @@ -22,11 +22,11 @@ #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "googleurl/src/url_parse.h" #include "googleurl/src/url_util.h" #include "net/base/escape.h" @@ -81,9 +81,9 @@ ShortcutsProvider::ShortcutsProvider(ACProviderListener* listener, Profile* profile) : AutocompleteProvider(listener, profile, "ShortcutsProvider"), languages_(profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)) { - notification_registrar_.Add(this, NotificationType::OMNIBOX_OPENED_URL, + notification_registrar_.Add(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, Source<Profile>(profile)); - notification_registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, + notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, Source<Profile>(profile)); } @@ -129,17 +129,17 @@ void ShortcutsProvider::DeleteMatch(const AutocompleteMatch& match) { history_service->DeleteURL(match.destination_url); } -void ShortcutsProvider::Observe(NotificationType type, +void ShortcutsProvider::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::HISTORY_URLS_DELETED) { + if (type == chrome::NOTIFICATION_HISTORY_URLS_DELETED) { const std::set<GURL>& urls = Details<const history::URLsDeletedDetails>(details)->urls; DeleteShortcutsWithURLs(urls); return; } - DCHECK(type == NotificationType::OMNIBOX_OPENED_URL); + DCHECK(type == chrome::NOTIFICATION_OMNIBOX_OPENED_URL); AutocompleteLog* log = Details<AutocompleteLog>(details).ptr(); string16 text_lowercase(base::i18n::ToLower(log->text)); diff --git a/chrome/browser/autocomplete/shortcuts_provider.h b/chrome/browser/autocomplete/shortcuts_provider.h index 342f6b0..0fcb085 100644 --- a/chrome/browser/autocomplete/shortcuts_provider.h +++ b/chrome/browser/autocomplete/shortcuts_provider.h @@ -81,7 +81,7 @@ class ShortcutsProvider : public AutocompleteProvider, static const int kMaxScore; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index 80d582d..cf0f26ca 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -19,6 +19,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/render_messages.h" #include "chrome/renderer/translate_helper.h" #include "chrome/test/in_process_browser_test.h" @@ -183,7 +184,7 @@ class AutofillTest : public InProcessBrowserTest { LOG(WARNING) << "Typing 'M' to bring up the Autofill popup."; ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_M, false, true, false, false, - NotificationType::AUTOFILL_DID_SHOW_SUGGESTIONS, + chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, Source<RenderViewHost>(render_view_host()))); // Press the down arrow to select the suggestion and preview the autofilled @@ -191,7 +192,7 @@ class AutofillTest : public InProcessBrowserTest { LOG(WARNING) << "Simulating down arrow press to initiate Autofill preview."; ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_DOWN, false, false, false, false, - NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, Source<RenderViewHost>(render_view_host()))); // The previewed values should not be accessible to JavaScript. @@ -211,7 +212,7 @@ class AutofillTest : public InProcessBrowserTest { LOG(WARNING) << "Simulating Return press to fill the form."; ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_RETURN, false, false, false, false, - NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, Source<RenderViewHost>(render_view_host()))); // The form should be filled. @@ -251,20 +252,20 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, AutofillViaDownArrow) { // shown. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_DOWN, false, false, false, false, - NotificationType::AUTOFILL_DID_SHOW_SUGGESTIONS, + chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, Source<RenderViewHost>(render_view_host()))); // Press the down arrow to select the suggestion and preview the autofilled // form. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_DOWN, false, false, false, false, - NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, Source<RenderViewHost>(render_view_host()))); // Press Enter to accept the autofill suggestions. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_RETURN, false, false, false, false, - NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, Source<RenderViewHost>(render_view_host()))); // The form should be filled. @@ -308,20 +309,20 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, OnChangeAfterAutofill) { // shown. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_M, false, true, false, false, - NotificationType::AUTOFILL_DID_SHOW_SUGGESTIONS, + chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, Source<RenderViewHost>(render_view_host()))); // Press the down arrow to select the suggestion and preview the autofilled // form. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_DOWN, false, false, false, false, - NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, Source<RenderViewHost>(render_view_host()))); // Press Enter to accept the autofill suggestions. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_RETURN, false, false, false, false, - NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, Source<RenderViewHost>(render_view_host()))); // The form should be filled. @@ -484,7 +485,7 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, AutofillAfterTranslate) { L"cr.googleTranslate.onTranslateElementLoad();")); // Simulate the render notifying the translation has been done. - ui_test_utils::WaitForNotification(NotificationType::PAGE_TRANSLATED); + ui_test_utils::WaitForNotification(chrome::NOTIFICATION_PAGE_TRANSLATED); TryBasicFormFill(); } diff --git a/chrome/browser/autofill/autofill_feedback_infobar_delegate.h b/chrome/browser/autofill/autofill_feedback_infobar_delegate.h index 9249fe4..7c16863 100644 --- a/chrome/browser/autofill/autofill_feedback_infobar_delegate.h +++ b/chrome/browser/autofill/autofill_feedback_infobar_delegate.h @@ -11,7 +11,6 @@ #include "chrome/browser/tab_contents/link_infobar_delegate.h" #include "webkit/glue/window_open_disposition.h" -class NotificationType; class TabContents; // An InfoBar delegate that prompts the user to provide additional feedback for diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index db18012..e0c4369 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -35,6 +35,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/autofill_messages.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/guid.h" #include "chrome/common/pref_names.h" @@ -42,7 +43,6 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "ipc/ipc_message_macros.h" @@ -724,14 +724,14 @@ void AutofillManager::OnShowAutofillDialog() { void AutofillManager::OnDidFillAutofillFormData() { NotificationService::current()->Notify( - NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, Source<RenderViewHost>(tab_contents()->render_view_host()), NotificationService::NoDetails()); } void AutofillManager::OnDidShowAutofillSuggestions() { NotificationService::current()->Notify( - NotificationType::AUTOFILL_DID_SHOW_SUGGESTIONS, + chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, Source<RenderViewHost>(tab_contents()->render_view_host()), NotificationService::NoDetails()); } diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc index 5d1b57f..8d31122 100644 --- a/chrome/browser/autofill/personal_data_manager_unittest.cc +++ b/chrome/browser/autofill/personal_data_manager_unittest.cc @@ -18,11 +18,11 @@ #include "chrome/test/testing_browser_process.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_observer_mock.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/form_data.h" diff --git a/chrome/browser/automation/automation_browser_tracker.cc b/chrome/browser/automation/automation_browser_tracker.cc index 768402d..f5a0873 100644 --- a/chrome/browser/automation/automation_browser_tracker.cc +++ b/chrome/browser/automation/automation_browser_tracker.cc @@ -4,6 +4,7 @@ #include "chrome/browser/automation/automation_browser_tracker.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_source.h" AutomationBrowserTracker::AutomationBrowserTracker( @@ -14,11 +15,11 @@ AutomationBrowserTracker::AutomationBrowserTracker( AutomationBrowserTracker::~AutomationBrowserTracker() {} void AutomationBrowserTracker::AddObserver(Browser* resource) { - registrar_.Add(this, NotificationType::BROWSER_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, Source<Browser>(resource)); } void AutomationBrowserTracker::RemoveObserver(Browser* resource) { - registrar_.Remove(this, NotificationType::BROWSER_CLOSED, + registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_CLOSED, Source<Browser>(resource)); } diff --git a/chrome/browser/automation/automation_extension_tracker.cc b/chrome/browser/automation/automation_extension_tracker.cc index 45c1964..9c75c7a 100644 --- a/chrome/browser/automation/automation_extension_tracker.cc +++ b/chrome/browser/automation/automation_extension_tracker.cc @@ -5,13 +5,14 @@ #include "chrome/browser/automation/automation_extension_tracker.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/common/notification_service.h" AutomationExtensionTracker::AutomationExtensionTracker( IPC::Message::Sender* automation) : AutomationResourceTracker<const Extension*>(automation) { - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); } @@ -22,10 +23,10 @@ void AutomationExtensionTracker::AddObserver(const Extension* resource) {} void AutomationExtensionTracker::RemoveObserver(const Extension* resource) {} -void AutomationExtensionTracker::Observe(NotificationType type, +void AutomationExtensionTracker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::EXTENSION_UNLOADED) { + if (type != chrome::NOTIFICATION_EXTENSION_UNLOADED) { NOTREACHED(); return; } diff --git a/chrome/browser/automation/automation_extension_tracker.h b/chrome/browser/automation/automation_extension_tracker.h index 05f16b5..92b02ec 100644 --- a/chrome/browser/automation/automation_extension_tracker.h +++ b/chrome/browser/automation/automation_extension_tracker.h @@ -32,7 +32,7 @@ class AutomationExtensionTracker // Observe expects the NotificationSource to be the object that is closing. // This is not true for the relevant extension notifications, so we have to // the observation ourselves. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); }; diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index 0323870..c8f13d5 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -60,6 +60,7 @@ #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/common/automation_messages.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" @@ -96,9 +97,9 @@ InitialLoadObserver::InitialLoadObserver(size_t tab_count, outstanding_tab_count_(tab_count), init_time_(base::TimeTicks::Now()) { if (outstanding_tab_count_ > 0) { - registrar_.Add(this, NotificationType::LOAD_START, + registrar_.Add(this, content::NOTIFICATION_LOAD_START, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); } } @@ -106,15 +107,15 @@ InitialLoadObserver::InitialLoadObserver(size_t tab_count, InitialLoadObserver::~InitialLoadObserver() { } -void InitialLoadObserver::Observe(NotificationType type, +void InitialLoadObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::LOAD_START) { + if (type == content::NOTIFICATION_LOAD_START) { if (outstanding_tab_count_ > loading_tabs_.size()) loading_tabs_.insert(TabTimeMap::value_type( source.map_key(), TabTime(base::TimeTicks::Now()))); - } else if (type == NotificationType::LOAD_STOP) { + } else if (type == content::NOTIFICATION_LOAD_STOP) { if (outstanding_tab_count_ > finished_tabs_.size()) { TabTimeMap::iterator iter = loading_tabs_.find(source.map_key()); if (iter != loading_tabs_.end()) { @@ -159,17 +160,17 @@ void InitialLoadObserver::ConditionMet() { NewTabUILoadObserver::NewTabUILoadObserver(AutomationProvider* automation) : automation_(automation->AsWeakPtr()) { - registrar_.Add(this, NotificationType::INITIAL_NEW_TAB_UI_LOAD, + registrar_.Add(this, chrome::NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD, NotificationService::AllSources()); } NewTabUILoadObserver::~NewTabUILoadObserver() { } -void NewTabUILoadObserver::Observe(NotificationType type, +void NewTabUILoadObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::INITIAL_NEW_TAB_UI_LOAD) { + if (type == chrome::NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD) { Details<int> load_time(details); if (automation_) { automation_->Send( @@ -190,7 +191,7 @@ NavigationControllerRestoredObserver::NavigationControllerRestoredObserver( if (FinishedRestoring()) { SendDone(); } else { - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); } } @@ -199,7 +200,7 @@ NavigationControllerRestoredObserver::~NavigationControllerRestoredObserver() { } void NavigationControllerRestoredObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { if (FinishedRestoring()) { SendDone(); @@ -236,12 +237,12 @@ NavigationNotificationObserver::NavigationNotificationObserver( use_json_interface_(use_json_interface) { DCHECK_LT(0, navigations_remaining_); Source<NavigationController> source(controller_); - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, source); - registrar_.Add(this, NotificationType::LOAD_START, source); - registrar_.Add(this, NotificationType::LOAD_STOP, source); - registrar_.Add(this, NotificationType::AUTH_NEEDED, source); - registrar_.Add(this, NotificationType::AUTH_SUPPLIED, source); - registrar_.Add(this, NotificationType::AUTH_CANCELLED, source); + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source); + registrar_.Add(this, content::NOTIFICATION_LOAD_START, source); + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); + registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source); + registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, source); + registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, source); if (include_current_navigation && controller->tab_contents()->is_loading()) navigation_started_ = true; @@ -251,7 +252,7 @@ NavigationNotificationObserver::~NavigationNotificationObserver() { } void NavigationNotificationObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { if (!automation_) { delete this; @@ -263,26 +264,26 @@ void NavigationNotificationObserver::Observe( // afer the load has started (but not after the entry was committed, as // WaitForNavigation compares times of the last navigation). // - when this is used with a page requiring authentication, we will not get - // a NotificationType::NAV_ENTRY_COMMITTED until after we authenticate, so - // we need the NotificationType::LOAD_START. - if (type == NotificationType::NAV_ENTRY_COMMITTED || - type == NotificationType::LOAD_START) { + // a chrome::NAV_ENTRY_COMMITTED until after we authenticate, so + // we need the chrome::LOAD_START. + if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED || + type == content::NOTIFICATION_LOAD_START) { navigation_started_ = true; - } else if (type == NotificationType::LOAD_STOP) { + } else if (type == content::NOTIFICATION_LOAD_STOP) { if (navigation_started_) { navigation_started_ = false; if (--navigations_remaining_ == 0) ConditionMet(AUTOMATION_MSG_NAVIGATION_SUCCESS); } - } else if (type == NotificationType::AUTH_SUPPLIED || - type == NotificationType::AUTH_CANCELLED) { + } else if (type == chrome::NOTIFICATION_AUTH_SUPPLIED || + type == chrome::NOTIFICATION_AUTH_CANCELLED) { // The LoginHandler for this tab is no longer valid. automation_->RemoveLoginHandler(controller_); // Treat this as if navigation started again, since load start/stop don't // occur while authentication is ongoing. navigation_started_ = true; - } else if (type == NotificationType::AUTH_NEEDED) { + } else if (type == chrome::NOTIFICATION_AUTH_NEEDED) { // Remember the login handler that wants authentication. // We do this in all cases (not just when navigation_started_ == true) so // tests can still wait for auth dialogs outside of navigation. @@ -317,7 +318,7 @@ void NavigationNotificationObserver::ConditionMet( } TabStripNotificationObserver::TabStripNotificationObserver( - NotificationType notification, AutomationProvider* automation) + int notification, AutomationProvider* automation) : automation_(automation->AsWeakPtr()), notification_(notification) { registrar_.Add(this, notification_, NotificationService::AllSources()); @@ -326,11 +327,11 @@ TabStripNotificationObserver::TabStripNotificationObserver( TabStripNotificationObserver::~TabStripNotificationObserver() { } -void TabStripNotificationObserver::Observe(NotificationType type, +void TabStripNotificationObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (type == notification_) { - if (type == NotificationType::TAB_PARENTED) + if (type == content::NOTIFICATION_TAB_PARENTED) ObserveTab(&(Source<TabContentsWrapper>(source).ptr()->controller())); else ObserveTab(Source<NavigationController>(source).ptr()); @@ -343,7 +344,8 @@ void TabStripNotificationObserver::Observe(NotificationType type, TabAppendedNotificationObserver::TabAppendedNotificationObserver( Browser* parent, AutomationProvider* automation, IPC::Message* reply_message) - : TabStripNotificationObserver(NotificationType::TAB_PARENTED, automation), + : TabStripNotificationObserver(content::NOTIFICATION_TAB_PARENTED, + automation), parent_(parent), reply_message_(reply_message) { } @@ -370,7 +372,7 @@ TabClosedNotificationObserver::TabClosedNotificationObserver( AutomationProvider* automation, bool wait_until_closed, IPC::Message* reply_message) : TabStripNotificationObserver(wait_until_closed ? - NotificationType::TAB_CLOSED : NotificationType::TAB_CLOSING, + content::NOTIFICATION_TAB_CLOSED : content::NOTIFICATION_TAB_CLOSING, automation), reply_message_(reply_message), for_browser_command_(false) { @@ -461,11 +463,11 @@ ExtensionInstallNotificationObserver::ExtensionInstallNotificationObserver( : automation_(automation->AsWeakPtr()), id_(id), reply_message_(reply_message) { - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_INSTALL_ERROR, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, NotificationService::AllSources()); } @@ -473,14 +475,14 @@ ExtensionInstallNotificationObserver::~ExtensionInstallNotificationObserver() { } void ExtensionInstallNotificationObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_LOADED: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_LOADED: SendResponse(AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED); break; - case NotificationType::EXTENSION_INSTALL_ERROR: - case NotificationType::EXTENSION_UPDATE_DISABLED: + case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: + case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: SendResponse(AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); break; default: @@ -518,9 +520,9 @@ ExtensionUninstallObserver::ExtensionUninstallObserver( : automation_(automation->AsWeakPtr()), reply_message_(reply_message), id_(id) { - registrar_.Add(this, NotificationType::EXTENSION_UNINSTALLED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UNINSTALL_NOT_ALLOWED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, NotificationService::AllSources()); } @@ -528,7 +530,7 @@ ExtensionUninstallObserver::~ExtensionUninstallObserver() { } void ExtensionUninstallObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { if (!automation_) { @@ -536,8 +538,8 @@ void ExtensionUninstallObserver::Observe( return; } - switch (type.value) { - case NotificationType::EXTENSION_UNINSTALLED: { + switch (type) { + case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { UninstalledExtensionInfo* info = Details<UninstalledExtensionInfo>(details).ptr(); if (id_ == info->extension_id) { @@ -551,7 +553,7 @@ void ExtensionUninstallObserver::Observe( break; } - case NotificationType::EXTENSION_UNINSTALL_NOT_ALLOWED: { + case chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED: { const Extension* extension = Details<Extension>(details).ptr(); if (id_ == extension->id()) { scoped_ptr<DictionaryValue> return_value(new DictionaryValue); @@ -577,13 +579,13 @@ ExtensionReadyNotificationObserver::ExtensionReadyNotificationObserver( id_(id), reply_message_(reply_message), extension_(NULL) { - registrar_.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_INSTALL_ERROR, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, NotificationService::AllSources()); } @@ -591,27 +593,27 @@ ExtensionReadyNotificationObserver::~ExtensionReadyNotificationObserver() { } void ExtensionReadyNotificationObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { if (!automation_) { delete this; return; } - switch (type.value) { - case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: // Only continue on with this method if our extension has been loaded // and all the extension hosts have stopped loading. if (!extension_ || !DidExtensionHostsStopLoading(manager_)) return; break; - case NotificationType::EXTENSION_LOADED: + case chrome::NOTIFICATION_EXTENSION_LOADED: extension_ = Details<const Extension>(details).ptr(); if (!DidExtensionHostsStopLoading(manager_)) return; break; - case NotificationType::EXTENSION_INSTALL_ERROR: - case NotificationType::EXTENSION_UPDATE_DISABLED: + case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: + case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: break; default: NOTREACHED(); @@ -638,7 +640,7 @@ void ExtensionReadyNotificationObserver::Observe( ExtensionUnloadNotificationObserver::ExtensionUnloadNotificationObserver() : did_receive_unload_notification_(false) { - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); } @@ -646,9 +648,9 @@ ExtensionUnloadNotificationObserver::~ExtensionUnloadNotificationObserver() { } void ExtensionUnloadNotificationObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::EXTENSION_UNLOADED) { + if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { did_receive_unload_notification_ = true; } else { NOTREACHED(); @@ -660,19 +662,19 @@ ExtensionsUpdatedObserver::ExtensionsUpdatedObserver( IPC::Message* reply_message) : manager_(manager), automation_(automation->AsWeakPtr()), reply_message_(reply_message), updater_finished_(false) { - registrar_.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_INSTALL_ERROR, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_INSTALL_NOT_ALLOWED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UPDATE_FOUND, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UPDATING_FINISHED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED, NotificationService::AllSources()); } @@ -680,7 +682,7 @@ ExtensionsUpdatedObserver::~ExtensionsUpdatedObserver() { } void ExtensionsUpdatedObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { if (!automation_) { delete this; @@ -696,21 +698,21 @@ void ExtensionsUpdatedObserver::Observe( // (3) encountering an error. Finally, notifications are also sent whenever // an extension host stops loading. Updating is not considered complete if // any extension hosts are still loading. - switch (type.value) { - case NotificationType::EXTENSION_UPDATE_FOUND: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND: // Extension updater has identified an extension that needs to be updated. in_progress_updates_.insert(*(Details<const std::string>(details).ptr())); break; - case NotificationType::EXTENSION_UPDATING_FINISHED: + case chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED: // Extension updater has completed notifying all extensions to update // themselves. updater_finished_ = true; break; - case NotificationType::EXTENSION_LOADED: - case NotificationType::EXTENSION_INSTALL_NOT_ALLOWED: - case NotificationType::EXTENSION_UPDATE_DISABLED: { + case chrome::NOTIFICATION_EXTENSION_LOADED: + case chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED: + case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: { // An extension has either completed update installation and is now // loaded, or else the install has been skipped because it is // either not allowed or else has been disabled. @@ -719,14 +721,14 @@ void ExtensionsUpdatedObserver::Observe( break; } - case NotificationType::EXTENSION_INSTALL_ERROR: { + case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: { // An extension had an error on update installation. CrxInstaller* installer = Source<CrxInstaller>(source).ptr(); in_progress_updates_.erase(installer->expected_id()); break; } - case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: + case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: // Break out to the conditional check below to see if all extension hosts // have stopped loading. break; @@ -751,9 +753,9 @@ void ExtensionsUpdatedObserver::Observe( ExtensionTestResultNotificationObserver:: ExtensionTestResultNotificationObserver(AutomationProvider* automation) : automation_(automation->AsWeakPtr()) { - registrar_.Add(this, NotificationType::EXTENSION_TEST_PASSED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_PASSED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_TEST_FAILED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_FAILED, NotificationService::AllSources()); } @@ -762,15 +764,15 @@ ExtensionTestResultNotificationObserver:: } void ExtensionTestResultNotificationObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_TEST_PASSED: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_TEST_PASSED: results_.push_back(true); messages_.push_back(""); break; - case NotificationType::EXTENSION_TEST_FAILED: + case chrome::NOTIFICATION_EXTENSION_TEST_FAILED: results_.push_back(false); messages_.push_back(*(Details<std::string>(details).ptr())); break; @@ -809,9 +811,9 @@ BrowserOpenedNotificationObserver::BrowserOpenedNotificationObserver( reply_message_(reply_message), new_window_id_(extension_misc::kUnknownWindowId), for_browser_command_(false) { - registrar_.Add(this, NotificationType::BROWSER_OPENED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); } @@ -819,19 +821,19 @@ BrowserOpenedNotificationObserver::~BrowserOpenedNotificationObserver() { } void BrowserOpenedNotificationObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { if (!automation_) { delete this; return; } - if (type.value == NotificationType::BROWSER_OPENED) { + if (type == chrome::NOTIFICATION_BROWSER_OPENED) { // Store the new browser ID and continue waiting for a new tab within it // to stop loading. new_window_id_ = ExtensionTabUtil::GetWindowId( Source<Browser>(source).ptr()); - } else if (type.value == NotificationType::LOAD_STOP) { + } else if (type == content::NOTIFICATION_LOAD_STOP) { // Only send the result if the loaded tab is in the new window. NavigationController* controller = Source<NavigationController>(source).ptr(); @@ -864,16 +866,16 @@ BrowserClosedNotificationObserver::BrowserClosedNotificationObserver( : automation_(automation->AsWeakPtr()), reply_message_(reply_message), for_browser_command_(false) { - registrar_.Add(this, NotificationType::BROWSER_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, Source<Browser>(browser)); } BrowserClosedNotificationObserver::~BrowserClosedNotificationObserver() {} void BrowserClosedNotificationObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_CLOSED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSED); if (!automation_) { delete this; @@ -905,9 +907,9 @@ BrowserCountChangeNotificationObserver::BrowserCountChangeNotificationObserver( : target_count_(target_count), automation_(automation->AsWeakPtr()), reply_message_(reply_message) { - registrar_.Add(this, NotificationType::BROWSER_OPENED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::BROWSER_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, NotificationService::AllSources()); } @@ -915,13 +917,13 @@ BrowserCountChangeNotificationObserver:: ~BrowserCountChangeNotificationObserver() {} void BrowserCountChangeNotificationObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_OPENED || - type == NotificationType::BROWSER_CLOSED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_OPENED || + type == chrome::NOTIFICATION_BROWSER_CLOSED); int current_count = static_cast<int>(BrowserList::size()); - if (type == NotificationType::BROWSER_CLOSED) { + if (type == chrome::NOTIFICATION_BROWSER_CLOSED) { // At the time of the notification the browser being closed is not removed // from the list. The real count is one less than the reported count. DCHECK_LT(0, current_count); @@ -945,7 +947,7 @@ AppModalDialogShownObserver::AppModalDialogShownObserver( AutomationProvider* automation, IPC::Message* reply_message) : automation_(automation->AsWeakPtr()), reply_message_(reply_message) { - registrar_.Add(this, NotificationType::APP_MODAL_DIALOG_SHOWN, + registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, NotificationService::AllSources()); } @@ -953,9 +955,9 @@ AppModalDialogShownObserver::~AppModalDialogShownObserver() { } void AppModalDialogShownObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::APP_MODAL_DIALOG_SHOWN); + DCHECK(type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN); if (automation_) { AutomationMsg_WaitForAppModalDialogToBeShown::WriteReplyParams( @@ -970,23 +972,23 @@ namespace { // Define mapping from command to notification struct CommandNotification { int command; - NotificationType::Type notification_type; + int notification_type; }; const struct CommandNotification command_notifications[] = { - {IDC_DUPLICATE_TAB, NotificationType::TAB_PARENTED}, + {IDC_DUPLICATE_TAB, content::NOTIFICATION_TAB_PARENTED}, // Returns as soon as the restored tab is created. To further wait until // the content page is loaded, use WaitForTabToBeRestored. - {IDC_RESTORE_TAB, NotificationType::TAB_PARENTED}, + {IDC_RESTORE_TAB, content::NOTIFICATION_TAB_PARENTED}, // For the following commands, we need to wait for a new tab to be created, // load to finish, and title to change. - {IDC_MANAGE_EXTENSIONS, NotificationType::TAB_CONTENTS_TITLE_UPDATED}, - {IDC_OPTIONS, NotificationType::TAB_CONTENTS_TITLE_UPDATED}, - {IDC_PRINT, NotificationType::TAB_CONTENTS_TITLE_UPDATED}, - {IDC_SHOW_DOWNLOADS, NotificationType::TAB_CONTENTS_TITLE_UPDATED}, - {IDC_SHOW_HISTORY, NotificationType::TAB_CONTENTS_TITLE_UPDATED}, + {IDC_MANAGE_EXTENSIONS, content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED}, + {IDC_OPTIONS, content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED}, + {IDC_PRINT, content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED}, + {IDC_SHOW_DOWNLOADS, content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED}, + {IDC_SHOW_HISTORY, content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED}, }; } // namespace @@ -1046,7 +1048,7 @@ bool ExecuteBrowserCommandObserver::CreateAndRegisterObserver( } void ExecuteBrowserCommandObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { if (type == notification_type_) { if (automation_) { @@ -1063,19 +1065,19 @@ void ExecuteBrowserCommandObserver::Observe( ExecuteBrowserCommandObserver::ExecuteBrowserCommandObserver( AutomationProvider* automation, IPC::Message* reply_message) : automation_(automation->AsWeakPtr()), - notification_type_(NotificationType::ALL), + notification_type_(content::NOTIFICATION_ALL), reply_message_(reply_message) { } bool ExecuteBrowserCommandObserver::Register(int command) { - if (!GetNotificationType(command, ¬ification_type_)) + if (!Getint(command, ¬ification_type_)) return false; registrar_.Add(this, notification_type_, NotificationService::AllSources()); return true; } -bool ExecuteBrowserCommandObserver::GetNotificationType( - int command, NotificationType::Type* type) { +bool ExecuteBrowserCommandObserver::Getint( + int command, int* type) { if (!type) return false; bool found = false; @@ -1096,7 +1098,7 @@ FindInPageNotificationObserver::FindInPageNotificationObserver( active_match_ordinal_(-1), reply_with_json_(reply_with_json), reply_message_(reply_message) { - registrar_.Add(this, NotificationType::FIND_RESULT_AVAILABLE, + registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, Source<TabContents>(parent_tab)); } @@ -1104,7 +1106,7 @@ FindInPageNotificationObserver::~FindInPageNotificationObserver() { } void FindInPageNotificationObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { Details<FindNotificationDetails> find_details(details); if (!(find_details->final_update() && reply_message_ != NULL)) { @@ -1152,16 +1154,16 @@ void FindInPageNotificationObserver::Observe( const int FindInPageNotificationObserver::kFindInPageRequestId = -1; DomOperationObserver::DomOperationObserver() { - registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, + registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, NotificationService::AllSources()); } DomOperationObserver::~DomOperationObserver() {} void DomOperationObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (NotificationType::DOM_OPERATION_RESPONSE == type) { + if (chrome::NOTIFICATION_DOM_OPERATION_RESPONSE == type) { Details<DomOperationNotificationDetails> dom_op_details(details); OnDomOperationCompleted(dom_op_details->json()); } @@ -1199,7 +1201,7 @@ DocumentPrintedNotificationObserver::DocumentPrintedNotificationObserver( : automation_(automation->AsWeakPtr()), success_(false), reply_message_(reply_message) { - registrar_.Add(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, NotificationService::AllSources()); } @@ -1211,10 +1213,10 @@ DocumentPrintedNotificationObserver::~DocumentPrintedNotificationObserver() { } void DocumentPrintedNotificationObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::PRINT_JOB_EVENT); + DCHECK(type == chrome::NOTIFICATION_PRINT_JOB_EVENT); switch (Details<printing::JobEventDetails>(details)->type()) { case printing::JobEventDetails::JOB_DONE: { // Succeeded. @@ -1246,7 +1248,7 @@ void DocumentPrintedNotificationObserver::Observe( } MetricEventDurationObserver::MetricEventDurationObserver() { - registrar_.Add(this, NotificationType::METRIC_EVENT_DURATION, + registrar_.Add(this, chrome::NOTIFICATION_METRIC_EVENT_DURATION, NotificationService::AllSources()); } @@ -1260,9 +1262,9 @@ int MetricEventDurationObserver::GetEventDurationMs( return it->second; } -void MetricEventDurationObserver::Observe(NotificationType type, +void MetricEventDurationObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::METRIC_EVENT_DURATION) { + if (type != chrome::NOTIFICATION_METRIC_EVENT_DURATION) { NOTREACHED(); return; } @@ -1277,13 +1279,13 @@ PageTranslatedObserver::PageTranslatedObserver(AutomationProvider* automation, TabContents* tab_contents) : automation_(automation->AsWeakPtr()), reply_message_(reply_message) { - registrar_.Add(this, NotificationType::PAGE_TRANSLATED, + registrar_.Add(this, chrome::NOTIFICATION_PAGE_TRANSLATED, Source<TabContents>(tab_contents)); } PageTranslatedObserver::~PageTranslatedObserver() {} -void PageTranslatedObserver::Observe(NotificationType type, +void PageTranslatedObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (!automation_) { @@ -1291,7 +1293,7 @@ void PageTranslatedObserver::Observe(NotificationType type, return; } - DCHECK(type == NotificationType::PAGE_TRANSLATED); + DCHECK(type == chrome::NOTIFICATION_PAGE_TRANSLATED); AutomationJSONReply reply(automation_, reply_message_.release()); PageTranslatedDetails* translated_details = @@ -1311,16 +1313,16 @@ TabLanguageDeterminedObserver::TabLanguageDeterminedObserver( reply_message_(reply_message), tab_contents_(tab_contents), translate_bar_(translate_bar) { - registrar_.Add(this, NotificationType::TAB_LANGUAGE_DETERMINED, + registrar_.Add(this, chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, Source<TabContents>(tab_contents)); } TabLanguageDeterminedObserver::~TabLanguageDeterminedObserver() {} void TabLanguageDeterminedObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TAB_LANGUAGE_DETERMINED); + DCHECK(type == chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED); if (!automation_) { delete this; @@ -1376,18 +1378,20 @@ InfoBarCountObserver::InfoBarCountObserver(AutomationProvider* automation, tab_contents_(tab_contents), target_count_(target_count) { Source<TabContentsWrapper> source(tab_contents); - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_ADDED, source); - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, source); + registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, + source); + registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, + source); CheckCount(); } InfoBarCountObserver::~InfoBarCountObserver() {} -void InfoBarCountObserver::Observe(NotificationType type, +void InfoBarCountObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TAB_CONTENTS_INFOBAR_ADDED || - type == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED); + DCHECK(type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED || + type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED); CheckCount(); } @@ -1720,17 +1724,17 @@ void PasswordStoreLoginsChangedObserver::Init() { void PasswordStoreLoginsChangedObserver::RegisterObserversTask() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); - registrar_.Add(this, NotificationType::LOGINS_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_LOGINS_CHANGED, NotificationService::AllSources()); done_event_.Signal(); } void PasswordStoreLoginsChangedObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); - DCHECK(type.value == NotificationType::LOGINS_CHANGED); + DCHECK(type == chrome::NOTIFICATION_LOGINS_CHANGED); PasswordStoreChangeList* change_details = Details<PasswordStoreChangeList>(details).ptr(); if (change_details->size() != 1 || @@ -1803,20 +1807,20 @@ OmniboxAcceptNotificationObserver::OmniboxAcceptNotificationObserver( reply_message_(reply_message), controller_(controller) { Source<NavigationController> source(controller_); - registrar_.Add(this, NotificationType::LOAD_STOP, source); + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); // Pages requiring auth don't send LOAD_STOP. - registrar_.Add(this, NotificationType::AUTH_NEEDED, source); + registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source); } OmniboxAcceptNotificationObserver::~OmniboxAcceptNotificationObserver() { } void OmniboxAcceptNotificationObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::LOAD_STOP || - type == NotificationType::AUTH_NEEDED) { + if (type == content::NOTIFICATION_LOAD_STOP || + type == chrome::NOTIFICATION_AUTH_NEEDED) { if (automation_) { AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); @@ -1834,17 +1838,17 @@ SavePackageNotificationObserver::SavePackageNotificationObserver( : automation_(automation->AsWeakPtr()), reply_message_(reply_message) { Source<SavePackage> source(save_package); - registrar_.Add(this, NotificationType::SAVE_PACKAGE_SUCCESSFULLY_FINISHED, + registrar_.Add(this, chrome::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, source); } SavePackageNotificationObserver::~SavePackageNotificationObserver() {} void SavePackageNotificationObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::SAVE_PACKAGE_SUCCESSFULLY_FINISHED) { + if (type == chrome::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED) { if (automation_) { AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); @@ -2048,24 +2052,24 @@ NTPInfoObserver::NTPInfoObserver( } ntp_info_->Set("default_sites", default_sites_list); - registrar_.Add(this, NotificationType::TOP_SITES_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_UPDATED, Source<history::TopSites>(top_sites_)); if (top_sites_->loaded()) { OnTopSitesLoaded(); } else { - registrar_.Add(this, NotificationType::TOP_SITES_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_LOADED, Source<Profile>(automation_->profile())); } } NTPInfoObserver::~NTPInfoObserver() {} -void NTPInfoObserver::Observe(NotificationType type, +void NTPInfoObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::TOP_SITES_LOADED) { + if (type == chrome::NOTIFICATION_TOP_SITES_LOADED) { OnTopSitesLoaded(); - } else if (type == NotificationType::TOP_SITES_UPDATED) { + } else if (type == chrome::NOTIFICATION_TOP_SITES_UPDATED) { Details<CancelableRequestProvider::Handle> request_details(details); if (request_ == *request_details.ptr()) { top_sites_->GetMostVisitedURLs( @@ -2116,22 +2120,22 @@ AppLaunchObserver::AppLaunchObserver( if (launch_container_ == extension_misc::LAUNCH_TAB) { // Need to wait for the currently-active tab to reload. Source<NavigationController> source(controller_); - registrar_.Add(this, NotificationType::LOAD_STOP, source); + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); } else { // Need to wait for a new tab in a new window to load. - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::BROWSER_WINDOW_READY, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY, NotificationService::AllSources()); } } AppLaunchObserver::~AppLaunchObserver() {} -void AppLaunchObserver::Observe(NotificationType type, +void AppLaunchObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::LOAD_STOP) { + if (type == content::NOTIFICATION_LOAD_STOP) { if (launch_container_ == extension_misc::LAUNCH_TAB) { // The app has been launched in the new tab. if (automation_) { @@ -2157,7 +2161,7 @@ void AppLaunchObserver::Observe(NotificationType type, return; } } - } else if (type.value == NotificationType::BROWSER_WINDOW_READY) { + } else if (type == chrome::NOTIFICATION_BROWSER_WINDOW_READY) { new_window_id_ = ExtensionTabUtil::GetWindowId( Source<Browser>(source).ptr()); } else { @@ -2166,7 +2170,7 @@ void AppLaunchObserver::Observe(NotificationType type, } AutofillDisplayedObserver::AutofillDisplayedObserver( - NotificationType notification, + int notification, RenderViewHost* render_view_host, AutomationProvider* automation, IPC::Message* reply_message) @@ -2181,10 +2185,10 @@ AutofillDisplayedObserver::AutofillDisplayedObserver( AutofillDisplayedObserver::~AutofillDisplayedObserver() {} void AutofillDisplayedObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(type.value, notification_.value); + DCHECK_EQ(type, notification_); DCHECK_EQ(Source<RenderViewHost>(source).ptr(), render_view_host_); if (automation_) { AutomationJSONReply(automation_, @@ -2222,22 +2226,22 @@ void AutofillChangedObserver::Init() { void AutofillChangedObserver::RegisterObserversTask() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); - registrar_.Add(this, NotificationType::AUTOFILL_CREDIT_CARD_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::AUTOFILL_PROFILE_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, NotificationService::AllSources()); done_event_.Signal(); } void AutofillChangedObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); - if (type.value == NotificationType::AUTOFILL_CREDIT_CARD_CHANGED) { + if (type == chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED) { num_credit_cards_--; - } else if (type.value == NotificationType::AUTOFILL_PROFILE_CHANGED) { + } else if (type == chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED) { num_profiles_--; } else { NOTREACHED(); @@ -2289,7 +2293,7 @@ GetActiveNotificationsObserver::GetActiveNotificationsObserver( if (AreActiveNotificationProcessesReady()) { SendMessage(); } else { - registrar_.Add(this, NotificationType::NOTIFY_BALLOON_CONNECTED, + registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, NotificationService::AllSources()); } } @@ -2297,7 +2301,7 @@ GetActiveNotificationsObserver::GetActiveNotificationsObserver( GetActiveNotificationsObserver::~GetActiveNotificationsObserver() {} void GetActiveNotificationsObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { if (!automation_) { @@ -2342,7 +2346,7 @@ OnNotificationBalloonCountObserver::OnNotificationBalloonCountObserver( collection_( g_browser_process->notification_ui_manager()->balloon_collection()), count_(count) { - registrar_.Add(this, NotificationType::NOTIFY_BALLOON_CONNECTED, + registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, NotificationService::AllSources()); collection_->set_on_collection_changed_callback(NewCallback( this, &OnNotificationBalloonCountObserver::CheckBalloonCount)); @@ -2353,7 +2357,7 @@ OnNotificationBalloonCountObserver::~OnNotificationBalloonCountObserver() { } void OnNotificationBalloonCountObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { CheckBalloonCount(); @@ -2379,14 +2383,14 @@ RendererProcessClosedObserver::RendererProcessClosedObserver( IPC::Message* reply_message) : automation_(automation->AsWeakPtr()), reply_message_(reply_message) { - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, NotificationService::AllSources()); } RendererProcessClosedObserver::~RendererProcessClosedObserver() {} void RendererProcessClosedObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { if (automation_) { @@ -2407,14 +2411,14 @@ InputEventAckNotificationObserver::InputEventAckNotificationObserver( count_(count) { DCHECK(1 <= count); registrar_.Add( - this, NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, + this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, NotificationService::AllSources()); } InputEventAckNotificationObserver::~InputEventAckNotificationObserver() {} void InputEventAckNotificationObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { Details<int> request_details(details); @@ -2496,14 +2500,14 @@ NewTabObserver::NewTabObserver(AutomationProvider* automation, reply_message_(reply_message) { // Use TAB_PARENTED to detect the new tab. registrar_.Add(this, - NotificationType::TAB_PARENTED, + content::NOTIFICATION_TAB_PARENTED, NotificationService::AllSources()); } -void NewTabObserver::Observe(NotificationType type, +void NewTabObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(NotificationType::TAB_PARENTED, type.value); + DCHECK_EQ(content::NOTIFICATION_TAB_PARENTED, type); NavigationController* controller = &(Source<TabContentsWrapper>(source).ptr()->controller()); if (automation_) { @@ -2577,7 +2581,7 @@ DragTargetDropAckNotificationObserver::DragTargetDropAckNotificationObserver( reply_message_(reply_message) { registrar_.Add( this, - NotificationType::RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, + content::NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, NotificationService::AllSources()); } @@ -2585,7 +2589,7 @@ DragTargetDropAckNotificationObserver:: ~DragTargetDropAckNotificationObserver() {} void DragTargetDropAckNotificationObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { if (automation_) { diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index bcecc29..9dc6d22 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -37,9 +37,9 @@ #include "chrome/common/automation_constants.h" #include "chrome/common/extensions/extension_constants.h" #include "content/browser/cancelable_request.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" #include "ui/gfx/size.h" class AutocompleteEditModel; @@ -73,7 +73,7 @@ class InitialLoadObserver : public NotificationObserver { InitialLoadObserver(size_t tab_count, AutomationProvider* automation); virtual ~InitialLoadObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -128,7 +128,7 @@ class NewTabUILoadObserver : public NotificationObserver { explicit NewTabUILoadObserver(AutomationProvider* automation); virtual ~NewTabUILoadObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -146,7 +146,7 @@ class NavigationControllerRestoredObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~NavigationControllerRestoredObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -172,7 +172,7 @@ class NavigationNotificationObserver : public NotificationObserver { bool use_json_interface); virtual ~NavigationNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -192,11 +192,11 @@ class NavigationNotificationObserver : public NotificationObserver { class TabStripNotificationObserver : public NotificationObserver { public: - TabStripNotificationObserver(NotificationType notification, + TabStripNotificationObserver(int notification, AutomationProvider* automation); virtual ~TabStripNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -205,7 +205,7 @@ class TabStripNotificationObserver : public NotificationObserver { protected: NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; - NotificationType notification_; + int notification_; }; class TabAppendedNotificationObserver : public TabStripNotificationObserver { @@ -285,7 +285,7 @@ class ExtensionInstallNotificationObserver : public NotificationObserver { virtual ~ExtensionInstallNotificationObserver(); // Implementation of NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -310,7 +310,7 @@ class ExtensionUninstallObserver : public NotificationObserver { virtual ~ExtensionUninstallObserver(); // Implementation of NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -334,7 +334,7 @@ class ExtensionReadyNotificationObserver : public NotificationObserver { virtual ~ExtensionReadyNotificationObserver(); // Implementation of NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -355,7 +355,7 @@ class ExtensionUnloadNotificationObserver : public NotificationObserver { virtual ~ExtensionUnloadNotificationObserver(); // Implementation of NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -382,7 +382,7 @@ class ExtensionsUpdatedObserver : public NotificationObserver { virtual ~ExtensionsUpdatedObserver(); // Implementation of NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -404,7 +404,7 @@ class ExtensionTestResultNotificationObserver : public NotificationObserver { virtual ~ExtensionTestResultNotificationObserver(); // Implementation of NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -436,7 +436,7 @@ class BrowserOpenedNotificationObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~BrowserOpenedNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -459,7 +459,7 @@ class BrowserClosedNotificationObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~BrowserClosedNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -481,7 +481,7 @@ class BrowserCountChangeNotificationObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~BrowserCountChangeNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -500,7 +500,7 @@ class AppModalDialogShownObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~AppModalDialogShownObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -521,7 +521,7 @@ class ExecuteBrowserCommandObserver : public NotificationObserver { int command, IPC::Message* reply_message); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -531,11 +531,11 @@ class ExecuteBrowserCommandObserver : public NotificationObserver { bool Register(int command); - bool GetNotificationType(int command, NotificationType::Type* type); + bool Getint(int command, int* type); NotificationRegistrar registrar_; base::WeakPtr<AutomationProvider> automation_; - NotificationType::Type notification_type_; + int notification_type_; scoped_ptr<IPC::Message> reply_message_; DISALLOW_COPY_AND_ASSIGN(ExecuteBrowserCommandObserver); @@ -549,7 +549,7 @@ class FindInPageNotificationObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~FindInPageNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -580,7 +580,7 @@ class DomOperationObserver : public NotificationObserver { DomOperationObserver(); virtual ~DomOperationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -617,7 +617,7 @@ class DocumentPrintedNotificationObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~DocumentPrintedNotificationObserver(); - virtual void Observe(NotificationType type, const NotificationSource& source, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: @@ -639,7 +639,7 @@ class MetricEventDurationObserver : public NotificationObserver { int GetEventDurationMs(const std::string& event_name); // NotificationObserver interface. - virtual void Observe(NotificationType type, const NotificationSource& source, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: @@ -659,7 +659,7 @@ class PageTranslatedObserver : public NotificationObserver { virtual ~PageTranslatedObserver(); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -680,7 +680,7 @@ class TabLanguageDeterminedObserver : public NotificationObserver { virtual ~TabLanguageDeterminedObserver(); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -703,7 +703,7 @@ class InfoBarCountObserver : public NotificationObserver { virtual ~InfoBarCountObserver(); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -740,7 +740,7 @@ class LoginObserver : public chromeos::LoginStatusConsumer, const GaiaAuthConsumer::ClientLoginResult& credentials, bool pending_requests); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -765,7 +765,7 @@ class ScreenLockUnlockObserver : public NotificationObserver { virtual ~ScreenLockUnlockObserver(); // NotificationObserver interface. - virtual void Observe(NotificationType type, const NotificationSource& source, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); protected: @@ -1105,7 +1105,7 @@ class PasswordStoreLoginsChangedObserver virtual void Init(); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -1161,7 +1161,7 @@ class OmniboxAcceptNotificationObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~OmniboxAcceptNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -1182,7 +1182,7 @@ class SavePackageNotificationObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~SavePackageNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -1238,7 +1238,7 @@ class NTPInfoObserver : public NotificationObserver { CancelableRequestConsumer* consumer); virtual ~NTPInfoObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -1267,7 +1267,7 @@ class AppLaunchObserver : public NotificationObserver { extension_misc::LaunchContainer launch_container); virtual ~AppLaunchObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -1289,19 +1289,19 @@ class AppLaunchObserver : public NotificationObserver { // notification to wait for. class AutofillDisplayedObserver : public NotificationObserver { public: - AutofillDisplayedObserver(NotificationType notification, + AutofillDisplayedObserver(int notification, RenderViewHost* render_view_host, AutomationProvider* automation, IPC::Message* reply_message); virtual ~AutofillDisplayedObserver(); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: - NotificationType notification_; + int notification_; RenderViewHost* render_view_host_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; @@ -1329,7 +1329,7 @@ class AutofillChangedObserver virtual void Init(); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -1365,7 +1365,7 @@ class GetActiveNotificationsObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~GetActiveNotificationsObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -1395,7 +1395,7 @@ class OnNotificationBalloonCountObserver : public NotificationObserver { // message is sent or if |automation_| is invalid. void CheckBalloonCount(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -1418,7 +1418,7 @@ class RendererProcessClosedObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~RendererProcessClosedObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -1439,7 +1439,7 @@ class InputEventAckNotificationObserver : public NotificationObserver { int event_type, int count); virtual ~InputEventAckNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -1487,7 +1487,7 @@ class NewTabObserver : public NotificationObserver { public: NewTabObserver(AutomationProvider* automation, IPC::Message* reply_message); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; @@ -1544,7 +1544,7 @@ class DragTargetDropAckNotificationObserver : public NotificationObserver { IPC::Message* reply_message); virtual ~DragTargetDropAckNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/automation/automation_provider_observers_chromeos.cc b/chrome/browser/automation/automation_provider_observers_chromeos.cc index 0d166da..4eb23c1 100644 --- a/chrome/browser/automation/automation_provider_observers_chromeos.cc +++ b/chrome/browser/automation/automation_provider_observers_chromeos.cc @@ -49,7 +49,7 @@ LoginObserver::LoginObserver(chromeos::ExistingUserController* controller, automation_(automation->AsWeakPtr()), reply_message_(reply_message) { controller_->set_login_status_consumer(this); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, chrome::LOAD_STOP, NotificationService::AllSources()); } @@ -73,7 +73,7 @@ void LoginObserver::OnLoginSuccess( controller_->set_login_status_consumer(NULL); } -void LoginObserver::Observe(NotificationType type, +void LoginObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { AutomationJSONReply(automation_, reply_message_.release()).SendSuccess(NULL); @@ -87,16 +87,16 @@ ScreenLockUnlockObserver::ScreenLockUnlockObserver( : automation_(automation->AsWeakPtr()), reply_message_(reply_message), lock_screen_(lock_screen) { - registrar_.Add(this, NotificationType::SCREEN_LOCK_STATE_CHANGED, + registrar_.Add(this, chrome::SCREEN_LOCK_STATE_CHANGED, NotificationService::AllSources()); } ScreenLockUnlockObserver::~ScreenLockUnlockObserver() {} -void ScreenLockUnlockObserver::Observe(NotificationType type, +void ScreenLockUnlockObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::SCREEN_LOCK_STATE_CHANGED); + DCHECK(type == chrome::SCREEN_LOCK_STATE_CHANGED); if (automation_) { AutomationJSONReply reply(automation_, reply_message_.release()); bool is_screen_locked = *Details<bool>(details).ptr(); diff --git a/chrome/browser/automation/automation_resource_tracker.h b/chrome/browser/automation/automation_resource_tracker.h index eeb85e8..f528b46 100644 --- a/chrome/browser/automation/automation_resource_tracker.h +++ b/chrome/browser/automation/automation_resource_tracker.h @@ -9,10 +9,10 @@ #include <map> #include "base/basictypes.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "ipc/ipc_message.h" // Template trick so that AutomationResourceTracker can be used with non-pointer @@ -120,7 +120,7 @@ class AutomationResourceTracker : public AutomationResourceTrackerImpl, // NotificationObserver implementation--the only thing that this tracker // does in response to notifications is to tell the AutomationProxy // that the associated handle is now invalid. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { T resource = diff --git a/chrome/browser/automation/automation_tab_helper_browsertest.cc b/chrome/browser/automation/automation_tab_helper_browsertest.cc index 9e87089..8a29aa8 100644 --- a/chrome/browser/automation/automation_tab_helper_browsertest.cc +++ b/chrome/browser/automation/automation_tab_helper_browsertest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/automation/mock_tab_event_observer.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/common/chrome_paths.h" #include "chrome/common/url_constants.h" #include "chrome/test/in_process_browser_test.h" @@ -23,7 +24,6 @@ #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "net/base/net_util.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -35,11 +35,11 @@ class MockNotificationObserver : public NotificationObserver { MockNotificationObserver() { } virtual ~MockNotificationObserver() { } - MOCK_METHOD3(Observe, void(NotificationType type, + MOCK_METHOD3(Observe, void(int type, const NotificationSource& source, const NotificationDetails& details)); - void Register(NotificationType type, const NotificationSource& source) { + void Register(int type, const NotificationSource& source) { registrar_.Add(this, type, source); } @@ -68,13 +68,13 @@ class AutomationTabHelperBrowserTest : public InProcessBrowserTest { MockTabEventObserver* mock_tab_observer, MockNotificationObserver* mock_notification_observer) { mock_notification_observer->Register( - NotificationType::DOM_OPERATION_RESPONSE, + chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, NotificationService::AllSources()); testing::InSequence expect_in_sequence; EXPECT_CALL(*mock_tab_observer, OnFirstPendingLoad(_)); EXPECT_CALL(*mock_notification_observer, Observe( - testing::Eq(NotificationType::DOM_OPERATION_RESPONSE), _, _)); + testing::Eq(chrome::NOTIFICATION_DOM_OPERATION_RESPONSE), _, _)); EXPECT_CALL(*mock_tab_observer, OnNoMorePendingLoads(_)) .WillOnce(testing::InvokeWithoutArgs( MessageLoopForUI::current(), &MessageLoop::Quit)); @@ -181,15 +181,16 @@ IN_PROC_BROWSER_TEST_F(AutomationTabHelperBrowserTest, IN_PROC_BROWSER_TEST_F(AutomationTabHelperBrowserTest, LoadStopComesAfterOnLoad) { MockNotificationObserver mock_notification_observer; - mock_notification_observer.Register(NotificationType::DOM_OPERATION_RESPONSE, - NotificationService::AllSources()); + mock_notification_observer.Register( + chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, + NotificationService::AllSources()); MockTabEventObserver mock_tab_observer(tab_helper()); EXPECT_CALL(mock_tab_observer, OnFirstPendingLoad(_)); { testing::InSequence expect_in_sequence; EXPECT_CALL(mock_notification_observer, Observe( - testing::Eq(NotificationType::DOM_OPERATION_RESPONSE), _, _)); + testing::Eq(chrome::NOTIFICATION_DOM_OPERATION_RESPONSE), _, _)); EXPECT_CALL(mock_tab_observer, OnNoMorePendingLoads(_)); } diff --git a/chrome/browser/automation/automation_tab_tracker.cc b/chrome/browser/automation/automation_tab_tracker.cc index 81ed183..d8ed59a 100644 --- a/chrome/browser/automation/automation_tab_tracker.cc +++ b/chrome/browser/automation/automation_tab_tracker.cc @@ -5,8 +5,8 @@ #include "chrome/browser/automation/automation_tab_tracker.h" #include "content/browser/tab_contents/navigation_controller.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" AutomationTabTracker::AutomationTabTracker(IPC::Message::Sender* automation) : AutomationResourceTracker<NavigationController*>(automation) { @@ -18,35 +18,35 @@ AutomationTabTracker::~AutomationTabTracker() { void AutomationTabTracker::AddObserver(NavigationController* resource) { // This tab could either be a regular tab or an external tab // Register for both notifications. - registrar_.Add(this, NotificationType::TAB_CLOSING, + registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, Source<NavigationController>(resource)); - registrar_.Add(this, NotificationType::EXTERNAL_TAB_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_EXTERNAL_TAB_CLOSED, Source<NavigationController>(resource)); // We also want to know about navigations so we can keep track of the last // navigation time. - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(resource)); } void AutomationTabTracker::RemoveObserver(NavigationController* resource) { - registrar_.Remove(this, NotificationType::TAB_CLOSING, + registrar_.Remove(this, content::NOTIFICATION_TAB_CLOSING, Source<NavigationController>(resource)); - registrar_.Remove(this, NotificationType::EXTERNAL_TAB_CLOSED, + registrar_.Remove(this, chrome::NOTIFICATION_EXTERNAL_TAB_CLOSED, Source<NavigationController>(resource)); - registrar_.Remove(this, NotificationType::LOAD_STOP, + registrar_.Remove(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(resource)); } -void AutomationTabTracker::Observe(NotificationType type, +void AutomationTabTracker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::LOAD_STOP: + switch (type) { + case content::NOTIFICATION_LOAD_STOP: last_navigation_times_[Source<NavigationController>(source).ptr()] = base::Time::Now(); return; - case NotificationType::EXTERNAL_TAB_CLOSED: - case NotificationType::TAB_CLOSING: + case chrome::NOTIFICATION_EXTERNAL_TAB_CLOSED: + case content::NOTIFICATION_TAB_CLOSING: { std::map<NavigationController*, base::Time>::iterator iter = last_navigation_times_.find( diff --git a/chrome/browser/automation/automation_tab_tracker.h b/chrome/browser/automation/automation_tab_tracker.h index e894f0d..bce1d6c 100644 --- a/chrome/browser/automation/automation_tab_tracker.h +++ b/chrome/browser/automation/automation_tab_tracker.h @@ -12,7 +12,6 @@ #include "chrome/browser/automation/automation_resource_tracker.h" class NavigationController; -class NotificationType; class AutomationTabTracker : public AutomationResourceTracker<NavigationController*> { @@ -23,7 +22,7 @@ class AutomationTabTracker virtual void AddObserver(NavigationController* resource); virtual void RemoveObserver(NavigationController* resource); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/automation/automation_window_tracker.cc b/chrome/browser/automation/automation_window_tracker.cc index e0f8b32..b2b2097 100644 --- a/chrome/browser/automation/automation_window_tracker.cc +++ b/chrome/browser/automation/automation_window_tracker.cc @@ -4,6 +4,7 @@ #include "chrome/browser/automation/automation_window_tracker.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/native_window_notification_source.h" AutomationWindowTracker::AutomationWindowTracker( @@ -15,11 +16,11 @@ AutomationWindowTracker::~AutomationWindowTracker() { } void AutomationWindowTracker::AddObserver(gfx::NativeWindow resource) { - registrar_.Add(this, NotificationType::WINDOW_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_WINDOW_CLOSED, Source<gfx::NativeWindow>(resource)); } void AutomationWindowTracker::RemoveObserver(gfx::NativeWindow resource) { - registrar_.Remove(this, NotificationType::WINDOW_CLOSED, + registrar_.Remove(this, chrome::NOTIFICATION_WINDOW_CLOSED, Source<gfx::NativeWindow>(resource)); } diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index bd4c696..0893b50 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -87,6 +87,7 @@ #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" #include "chrome/common/automation_messages.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" @@ -161,7 +162,7 @@ TestingAutomationProvider::TestingAutomationProvider(Profile* profile) #endif redirect_query_(0) { BrowserList::AddObserver(this); - registrar_.Add(this, NotificationType::SESSION_END, + registrar_.Add(this, chrome::NOTIFICATION_SESSION_END, NotificationService::AllSources()); } @@ -190,7 +191,7 @@ void TestingAutomationProvider::OnBrowserRemoved(const Browser* browser) { // last browser goes away. if (BrowserList::empty() && !CommandLine::ForCurrentProcess()->HasSwitch( switches::kKeepAliveForTest)) { - // If you change this, update Observer for NotificationType::SESSION_END + // If you change this, update Observer for chrome::SESSION_END // below. MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); @@ -231,10 +232,10 @@ void TestingAutomationProvider::OnSourceProfilesLoaded() { import_settings_data_.first_run); } -void TestingAutomationProvider::Observe(NotificationType type, +void TestingAutomationProvider::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::SESSION_END); + DCHECK(type == chrome::NOTIFICATION_SESSION_END); // OnBrowserRemoved does a ReleaseLater. When session end is received we exit // before the task runs resulting in this object not being deleted. This // Release balance out the Release scheduled by OnBrowserRemoved. @@ -3869,7 +3870,7 @@ void TestingAutomationProvider::GetTranslateInfo( tab_contents)->translate_tab_helper(); std::string language = helper->language_state().original_language(); if (!language.empty()) { - observer->Observe(NotificationType::TAB_LANGUAGE_DETERMINED, + observer->Observe(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, Source<TabContents>(tab_contents), Details<std::string>(&language)); } @@ -4381,7 +4382,7 @@ void TestingAutomationProvider::AutofillTriggerSuggestions( } new AutofillDisplayedObserver( - NotificationType::AUTOFILL_DID_SHOW_SUGGESTIONS, + chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, tab_contents->render_view_host(), this, reply_message); SendWebKeyPressEventAsync(ui::VKEY_DOWN, tab_contents); } @@ -4414,7 +4415,7 @@ void TestingAutomationProvider::AutofillHighlightSuggestion( int key_code = (direction == "up") ? ui::VKEY_UP : ui::VKEY_DOWN; new AutofillDisplayedObserver( - NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, tab_contents->render_view_host(), this, reply_message); SendWebKeyPressEventAsync(key_code, tab_contents); } @@ -4438,7 +4439,7 @@ void TestingAutomationProvider::AutofillAcceptSelection( } new AutofillDisplayedObserver( - NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, tab_contents->render_view_host(), this, reply_message); SendWebKeyPressEventAsync(ui::VKEY_RETURN, tab_contents); } diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index 60f0e3c..d8b1497 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -60,7 +60,7 @@ class TestingAutomationProvider : public AutomationProvider, virtual void OnSourceProfilesLoaded() OVERRIDE; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/background/background_application_list_model.cc b/chrome/browser/background/background_application_list_model.cc index d8512bc..ac6d012 100644 --- a/chrome/browser/background/background_application_list_model.cc +++ b/chrome/browser/background/background_application_list_model.cc @@ -16,6 +16,7 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/image_loading_tracker.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_resource.h" #include "content/common/notification_details.h" @@ -153,13 +154,13 @@ BackgroundApplicationListModel::BackgroundApplicationListModel(Profile* profile) : profile_(profile) { DCHECK(profile_); registrar_.Add(this, - NotificationType::EXTENSION_LOADED, + chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(profile)); registrar_.Add(this, - NotificationType::EXTENSION_UNLOADED, + chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile)); registrar_.Add(this, - NotificationType::EXTENSIONS_READY, + chrome::NOTIFICATION_EXTENSIONS_READY, Source<Profile>(profile)); ExtensionService* service = profile->GetExtensionService(); if (service && service->is_ready()) @@ -249,10 +250,10 @@ bool BackgroundApplicationListModel::IsBackgroundApp( } void BackgroundApplicationListModel::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::EXTENSIONS_READY) { + if (type == chrome::NOTIFICATION_EXTENSIONS_READY) { Update(); return; } @@ -260,11 +261,11 @@ void BackgroundApplicationListModel::Observe( if (!service || !service->is_ready()) return; - switch (type.value) { - case NotificationType::EXTENSION_LOADED: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_LOADED: OnExtensionLoaded(Details<Extension>(details).ptr()); break; - case NotificationType::EXTENSION_UNLOADED: + case chrome::NOTIFICATION_EXTENSION_UNLOADED: OnExtensionUnloaded(Details<UnloadedExtensionInfo>(details)->extension); break; default: diff --git a/chrome/browser/background/background_application_list_model.h b/chrome/browser/background/background_application_list_model.h index 5a0dde2..4dfdb15 100644 --- a/chrome/browser/background/background_application_list_model.h +++ b/chrome/browser/background/background_application_list_model.h @@ -105,7 +105,7 @@ class BackgroundApplicationListModel : public NotificationObserver { Application* FindApplication(const Extension* extension); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/background/background_application_list_model_unittest.cc b/chrome/browser/background/background_application_list_model_unittest.cc index 594e4a73..1a6856e 100644 --- a/chrome/browser/background/background_application_list_model_unittest.cc +++ b/chrome/browser/background/background_application_list_model_unittest.cc @@ -20,9 +20,9 @@ #include "chrome/common/extensions/extension.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "testing/gtest/include/gtest/gtest.h" // This value is used to seed the PRNG at the beginning of a sequence of diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc index a75712c..065b892 100644 --- a/chrome/browser/background/background_contents_service.cc +++ b/chrome/browser/background/background_contents_service.cc @@ -21,6 +21,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" @@ -28,7 +29,6 @@ #include "content/browser/site_instance.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 "ui/base/l10n/l10n_util.h" @@ -159,67 +159,67 @@ BackgroundContentsService::GetBackgroundContents() const void BackgroundContentsService::StartObserving(Profile* profile) { // On startup, load our background pages after extension-apps have loaded. - registrar_.Add(this, NotificationType::EXTENSIONS_READY, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, Source<Profile>(profile)); // Track the lifecycle of all BackgroundContents in the system to allow us // to store an up-to-date list of the urls. Start tracking contents when they // have been opened via CreateBackgroundContents(), and stop tracking them // when they are closed by script. - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, Source<Profile>(profile)); // Stop tracking BackgroundContents when they have been deleted (happens // during shutdown or if the render process dies). - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_DELETED, + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, Source<Profile>(profile)); // Track when the BackgroundContents navigates to a new URL so we can update // our persisted information as appropriate. - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_NAVIGATED, + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, Source<Profile>(profile)); // Listen for new extension installs so that we can load any associated // background page. - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(profile)); // Track when the extensions crash so that the user can be notified // about it, and the crashed contents can be restarted. - registrar_.Add(this, NotificationType::EXTENSION_PROCESS_TERMINATED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, Source<Profile>(profile)); - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_TERMINATED, + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED, Source<Profile>(profile)); // Listen for extensions to be unloaded so we can shutdown associated // BackgroundContents. - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile)); // Make sure the extension-crash balloons are removed when the extension is // uninstalled/reloaded. We cannot do this from UNLOADED since a crashed // extension is unloaded immediately after the crash, not when user reloads or // uninstalls the extension. - registrar_.Add(this, NotificationType::EXTENSION_UNINSTALLED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, Source<Profile>(profile)); } -void BackgroundContentsService::Observe(NotificationType type, +void BackgroundContentsService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSIONS_READY: + switch (type) { + case chrome::NOTIFICATION_EXTENSIONS_READY: LoadBackgroundContentsFromManifests(Source<Profile>(source).ptr()); LoadBackgroundContentsFromPrefs(Source<Profile>(source).ptr()); break; - case NotificationType::BACKGROUND_CONTENTS_DELETED: + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED: BackgroundContentsShutdown(Details<BackgroundContents>(details).ptr()); break; - case NotificationType::BACKGROUND_CONTENTS_CLOSED: + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED: DCHECK(IsTracked(Details<BackgroundContents>(details).ptr())); UnregisterBackgroundContents(Details<BackgroundContents>(details).ptr()); break; - case NotificationType::BACKGROUND_CONTENTS_NAVIGATED: { + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED: { DCHECK(IsTracked(Details<BackgroundContents>(details).ptr())); // Do not register in the pref if the extension has a manifest-specified @@ -239,7 +239,7 @@ void BackgroundContentsService::Observe(NotificationType type, RegisterBackgroundContents(bgcontents); break; } - case NotificationType::EXTENSION_LOADED: { + case chrome::NOTIFICATION_EXTENSION_LOADED: { const Extension* extension = Details<const Extension>(details).ptr(); Profile* profile = Source<Profile>(source).ptr(); if (extension->is_hosted_app() && @@ -262,11 +262,11 @@ void BackgroundContentsService::Observe(NotificationType type, ScheduleCloseBalloon(extension->id()); break; } - case NotificationType::EXTENSION_PROCESS_TERMINATED: - case NotificationType::BACKGROUND_CONTENTS_TERMINATED: { + case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED: { Profile* profile = Source<Profile>(source).ptr(); const Extension* extension = NULL; - if (type.value == NotificationType::BACKGROUND_CONTENTS_TERMINATED) { + if (type == chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED) { BackgroundContents* bg = Details<BackgroundContents>(details).ptr(); std::string extension_id = UTF16ToASCII( @@ -290,7 +290,7 @@ void BackgroundContentsService::Observe(NotificationType type, NewRunnableFunction(&ShowBalloon, extension, profile)); break; } - case NotificationType::EXTENSION_UNLOADED: + case chrome::NOTIFICATION_EXTENSION_UNLOADED: switch (Details<UnloadedExtensionInfo>(details)->reason) { case UnloadedExtensionInfo::DISABLE: // Intentionally fall through. case UnloadedExtensionInfo::UNINSTALL: @@ -318,7 +318,7 @@ void BackgroundContentsService::Observe(NotificationType type, } break; - case NotificationType::EXTENSION_UNINSTALLED: { + case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { // Remove any "This extension has crashed" balloons. const UninstalledExtensionInfo* uninstalled_extension = Details<const UninstalledExtensionInfo>(details).ptr(); @@ -467,7 +467,7 @@ BackgroundContents* BackgroundContentsService::CreateBackgroundContents( application_id}; BackgroundContentsOpened(&details); NotificationService::current()->Notify( - NotificationType::BACKGROUND_CONTENTS_OPENED, + chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED, Source<Profile>(profile), Details<BackgroundContentsOpenedDetails>(&details)); return contents; diff --git a/chrome/browser/background/background_contents_service.h b/chrome/browser/background/background_contents_service.h index 6d526cc..32e677a 100644 --- a/chrome/browser/background/background_contents_service.h +++ b/chrome/browser/background/background_contents_service.h @@ -105,7 +105,7 @@ class BackgroundContentsService : private NotificationObserver, void StartObserving(Profile* profile); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/background/background_contents_service_unittest.cc b/chrome/browser/background/background_contents_service_unittest.cc index e3cf5b5..71967ca 100644 --- a/chrome/browser/background/background_contents_service_unittest.cc +++ b/chrome/browser/background/background_contents_service_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/tab_contents/background_contents.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_browser_process.h" #include "chrome/test/testing_browser_process_test.h" @@ -73,7 +74,7 @@ class MockBackgroundContents : public BackgroundContents { virtual void Navigate(GURL url) { url_ = url; NotificationService::current()->Notify( - NotificationType::BACKGROUND_CONTENTS_NAVIGATED, + chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, Source<Profile>(profile_), Details<BackgroundContents>(this)); } @@ -81,7 +82,7 @@ class MockBackgroundContents : public BackgroundContents { void MockClose(Profile* profile) { NotificationService::current()->Notify( - NotificationType::BACKGROUND_CONTENTS_CLOSED, + chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, Source<Profile>(profile), Details<BackgroundContents>(this)); delete this; @@ -89,7 +90,7 @@ class MockBackgroundContents : public BackgroundContents { ~MockBackgroundContents() { NotificationService::current()->Notify( - NotificationType::BACKGROUND_CONTENTS_DELETED, + chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, Source<Profile>(profile_), Details<BackgroundContents>(this)); } diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index 8629e8c..c44362c 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -18,12 +18,13 @@ #include "chrome/browser/status_icons/status_tray.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" #include "content/browser/user_metrics.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -162,7 +163,7 @@ BackgroundModeManager::BackgroundModeManager(CommandLine* command_line) // Listen for the application shutting down so we can decrement our KeepAlive // count. - registrar_.Add(this, NotificationType::APP_TERMINATING, + registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, NotificationService::AllSources()); } @@ -198,15 +199,15 @@ void BackgroundModeManager::RegisterProfile(Profile* profile) { // Listen for when extensions are loaded/unloaded so we can track the // number of background apps and modify our keep-alive and launch-on-startup // state appropriately. - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(profile)); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile)); // Check for the presence of background apps after all extensions have been // loaded, to handle the case where an extension has been manually removed // while Chrome was not running. - registrar_.Add(this, NotificationType::EXTENSIONS_READY, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, Source<Profile>(profile)); bmd->applications_->AddObserver(this); @@ -219,11 +220,11 @@ void BackgroundModeManager::RegisterProfile(Profile* profile) { /////////////////////////////////////////////////////////////////////////////// // BackgroundModeManager, NotificationObserver overrides -void BackgroundModeManager::Observe(NotificationType type, +void BackgroundModeManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PREF_CHANGED: + switch (type) { + case chrome::NOTIFICATION_PREF_CHANGED: DCHECK(*Details<std::string>(details).ptr() == prefs::kBackgroundModeEnabled); if (IsBackgroundModePrefEnabled()) @@ -231,7 +232,7 @@ void BackgroundModeManager::Observe(NotificationType type, else DisableBackgroundMode(); break; - case NotificationType::EXTENSIONS_READY: + case chrome::NOTIFICATION_EXTENSIONS_READY: // Extensions are loaded, so we don't need to manually keep the browser // process alive any more when running in no-startup-window mode. EndKeepAliveForStartup(); @@ -246,7 +247,7 @@ void BackgroundModeManager::Observe(NotificationType type, EnableLaunchOnStartup(background_app_count_ > 0); #endif break; - case NotificationType::EXTENSION_LOADED: { + case chrome::NOTIFICATION_EXTENSION_LOADED: { Extension* extension = Details<Extension>(details).ptr(); if (BackgroundApplicationListModel::IsBackgroundApp(*extension)) { // Extensions loaded after the ExtensionsService is ready should be @@ -258,7 +259,7 @@ void BackgroundModeManager::Observe(NotificationType type, } } break; - case NotificationType::EXTENSION_UNLOADED: + case chrome::NOTIFICATION_EXTENSION_UNLOADED: if (BackgroundApplicationListModel::IsBackgroundApp( *Details<UnloadedExtensionInfo>(details)->extension)) { Details<UnloadedExtensionInfo> info = @@ -273,7 +274,7 @@ void BackgroundModeManager::Observe(NotificationType type, OnBackgroundAppUninstalled(); } break; - case NotificationType::APP_TERMINATING: + case content::NOTIFICATION_APP_TERMINATING: // Make sure we aren't still keeping the app alive (only happens if we // don't receive an EXTENSIONS_READY notification for some reason). EndKeepAliveForStartup(); diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h index e2fe568..86028b1 100644 --- a/chrome/browser/background/background_mode_manager.h +++ b/chrome/browser/background/background_mode_manager.h @@ -128,7 +128,7 @@ class BackgroundModeManager typedef linked_ptr<BackgroundModeData> BackgroundModeInfo; // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc index 85c48ed..c135845 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -17,6 +17,7 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_source.h" #include "grit/generated_resources.h" @@ -381,7 +382,7 @@ BookmarkFaviconFetcher::BookmarkFaviconFetcher( observer_(observer) { favicons_map_.reset(new URLFaviconMap()); registrar_.Add(this, - NotificationType::PROFILE_DESTROYED, + chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); } @@ -399,10 +400,10 @@ void BookmarkFaviconFetcher::ExportBookmarks() { } } -void BookmarkFaviconFetcher::Observe(NotificationType type, +void BookmarkFaviconFetcher::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (NotificationType::PROFILE_DESTROYED == type && fetcher != NULL) { + if (chrome::NOTIFICATION_PROFILE_DESTROYED == type && fetcher != NULL) { MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher); fetcher = NULL; } diff --git a/chrome/browser/bookmarks/bookmark_html_writer.h b/chrome/browser/bookmarks/bookmark_html_writer.h index 945559e..0621b3c 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.h +++ b/chrome/browser/bookmarks/bookmark_html_writer.h @@ -47,7 +47,7 @@ class BookmarkFaviconFetcher: public NotificationObserver { void ExportBookmarks(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index a6043d3..3e1d247 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -18,6 +18,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/history/history_notifications.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -144,7 +145,7 @@ void BookmarkModel::Load() { // Listen for changes to favicons so that we can update the favicon of the // node appropriately. - registrar_.Add(this, NotificationType::FAVICON_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_FAVICON_CHANGED, Source<Profile>(profile_)); // Load the bookmarks. BookmarkStorage notifies us when done. @@ -600,7 +601,7 @@ void BookmarkModel::DoneLoading( // And generic notification. NotificationService::current()->Notify( - NotificationType::BOOKMARK_MODEL_LOADED, + chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, Source<Profile>(profile_), NotificationService::NoDetails()); } @@ -652,7 +653,7 @@ void BookmarkModel::RemoveAndDeleteNode(BookmarkNode* delete_me) { } NotificationService::current()->Notify( - NotificationType::URLS_STARRED, + chrome::NOTIFICATION_URLS_STARRED, Source<Profile>(profile_), Details<history::URLsStarredDetails>(&details)); } @@ -675,7 +676,7 @@ BookmarkNode* BookmarkModel::AddNode(BookmarkNode* parent, history::URLsStarredDetails details(true); details.changed_urls.insert(node->GetURL()); NotificationService::current()->Notify( - NotificationType::URLS_STARRED, + chrome::NOTIFICATION_URLS_STARRED, Source<Profile>(profile_), Details<history::URLsStarredDetails>(&details)); } @@ -768,11 +769,11 @@ void BookmarkModel::CancelPendingFaviconLoadRequests(BookmarkNode* node) { } } -void BookmarkModel::Observe(NotificationType type, +void BookmarkModel::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::FAVICON_CHANGED: { + switch (type) { + case chrome::NOTIFICATION_FAVICON_CHANGED: { // Prevent the observers from getting confused for multiple favicon loads. Details<history::FaviconChangeDetails> favicon_details(details); for (std::set<GURL>::const_iterator i = favicon_details->urls.begin(); diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h index d682025..4e1bb9f 100644 --- a/chrome/browser/bookmarks/bookmark_model.h +++ b/chrome/browser/bookmarks/bookmark_model.h @@ -397,7 +397,7 @@ class BookmarkModel : public NotificationObserver, public BookmarkService { void CancelPendingFaviconLoadRequests(BookmarkNode* node); // NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc index 0bac00d7..22b6728 100644 --- a/chrome/browser/bookmarks/bookmark_model_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc @@ -21,6 +21,7 @@ #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/history/history_notifications.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/model_test_utils.h" @@ -548,13 +549,14 @@ namespace { class StarredListener : public NotificationObserver { public: StarredListener() : notification_count_(0), details_(false) { - registrar_.Add(this, NotificationType::URLS_STARRED, Source<Profile>(NULL)); + registrar_.Add(this, chrome::NOTIFICATION_URLS_STARRED, + Source<Profile>(NULL)); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::URLS_STARRED) { + if (type == chrome::NOTIFICATION_URLS_STARRED) { notification_count_++; details_ = *(Details<history::URLsStarredDetails>(details).ptr()); } diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc index 050ee115..76b151d 100644 --- a/chrome/browser/bookmarks/bookmark_storage.cc +++ b/chrome/browser/bookmarks/bookmark_storage.cc @@ -13,10 +13,10 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/json_value_serializer.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" using base::TimeTicks; @@ -174,7 +174,7 @@ void BookmarkStorage::MigrateFromHistory() { } if (!history->BackendLoaded()) { // The backend isn't finished loading. Wait for it. - notification_registrar_.Add(this, NotificationType::HISTORY_LOADED, + notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_LOADED, Source<Profile>(profile_)); } else { DoLoadBookmarks(tmp_history_path_); @@ -182,7 +182,7 @@ void BookmarkStorage::MigrateFromHistory() { } void BookmarkStorage::OnHistoryFinishedWriting() { - notification_registrar_.Remove(this, NotificationType::HISTORY_LOADED, + notification_registrar_.Remove(this, chrome::NOTIFICATION_HISTORY_LOADED, Source<Profile>(profile_)); // This is used when migrating bookmarks data from database to file. @@ -241,11 +241,11 @@ void BookmarkStorage::OnLoadFinished(bool file_exists, const FilePath& path) { } } -void BookmarkStorage::Observe(NotificationType type, +void BookmarkStorage::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::HISTORY_LOADED: + switch (type) { + case chrome::NOTIFICATION_HISTORY_LOADED: OnHistoryFinishedWriting(); break; diff --git a/chrome/browser/bookmarks/bookmark_storage.h b/chrome/browser/bookmarks/bookmark_storage.h index 19ec586..839c3dc 100644 --- a/chrome/browser/bookmarks/bookmark_storage.h +++ b/chrome/browser/bookmarks/bookmark_storage.h @@ -135,7 +135,7 @@ class BookmarkStorage : public NotificationObserver, void FinishHistoryMigration(); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 5bce075..a404270 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -22,6 +22,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/page_navigator.h" #include "content/browser/tab_contents/tab_contents.h" @@ -625,7 +626,7 @@ void ToggleWhenVisible(Profile* profile) { // And notify the notification service. Source<Profile> source(profile); NotificationService::current()->Notify( - NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, + chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, source, NotificationService::NoDetails()); } diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc index 7bc1bce..e82bd51 100644 --- a/chrome/browser/browser_browsertest.cc +++ b/chrome/browser/browser_browsertest.cc @@ -26,6 +26,7 @@ #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" @@ -35,7 +36,6 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "content/common/page_transition_types.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -299,7 +299,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) { // Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for // the pending RVH to be destroyed. ui_test_utils::WaitForNotification( - NotificationType::RENDER_WIDGET_HOST_DESTROYED); + content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED); EXPECT_EQ(url.spec(), WideToUTF8(browser()->toolbar_model()->GetText())); // Clear the beforeunload handler so the test can easily exit. @@ -612,7 +612,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_PageLanguageDetection) { Source<TabContents> source(current_tab); ui_test_utils::WindowedNotificationObserverWithDetails<std::string> - en_language_detected_signal(NotificationType::TAB_LANGUAGE_DETERMINED, + en_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, source); EXPECT_EQ("", helper->language_state().original_language()); en_language_detected_signal.Wait(); @@ -623,7 +623,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_PageLanguageDetection) { // Now navigate to a page in French. ui_test_utils::WindowedNotificationObserverWithDetails<std::string> - fr_language_detected_signal(NotificationType::TAB_LANGUAGE_DETERMINED, + fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, source); ui_test_utils::NavigateToURL( browser(), GURL(test_server()->GetURL("files/french_page.html"))); diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index 401eac9..5e6fc06 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -15,6 +15,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/view_ids.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" @@ -181,7 +182,7 @@ class TestInterstitialPage : public InterstitialPage { void OnFocusedNodeChanged(bool is_editable_node) { NotificationService::current()->Notify( - NotificationType::FOCUS_CHANGED_IN_PAGE, + content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, Source<TabContents>(tab()), Details<const bool>(&is_editable_node)); } @@ -504,7 +505,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( browser(), ui::VKEY_TAB, false, false, false, false, - NotificationType::FOCUS_CHANGED_IN_PAGE, + content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, NotificationSource(Source<TabContents>( browser()->GetSelectedTabContents())), details)); @@ -512,7 +513,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { // On the last tab key press, the focus returns to the browser. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_TAB, false, false, false, false, - NotificationType::FOCUS_RETURNED_TO_BROWSER, + chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, NotificationSource(Source<Browser>(browser())))); } } @@ -547,7 +548,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( browser(), ui::VKEY_TAB, false, true, false, false, - NotificationType::FOCUS_CHANGED_IN_PAGE, + content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, NotificationSource(Source<TabContents>( browser()->GetSelectedTabContents())), details)); @@ -555,7 +556,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { // On the last tab key press, the focus returns to the browser. ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( browser(), ui::VKEY_TAB, false, true, false, false, - NotificationType::FOCUS_RETURNED_TO_BROWSER, + chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, NotificationSource(Source<Browser>(browser())))); } @@ -627,16 +628,16 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { &actual)); ASSERT_STREQ(kExpElementIDs[j], actual.c_str()); - NotificationType::Type notification_type; + int notification_type; NotificationSource notification_source = NotificationService::AllSources(); if (j < arraysize(kExpElementIDs) - 1) { - notification_type = NotificationType::FOCUS_CHANGED_IN_PAGE; + notification_type = content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE; notification_source = Source<TabContents>( interstitial_page->tab()); } else { // On the last tab key press, the focus returns to the browser. - notification_type = NotificationType::FOCUS_RETURNED_TO_BROWSER; + notification_type = chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER; notification_source = Source<Browser>(browser()); } @@ -662,16 +663,16 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { // Now let's press shift-tab to move the focus in reverse. for (size_t j = 0; j < 7; ++j) { - NotificationType::Type notification_type; + int notification_type; NotificationSource notification_source = NotificationService::AllSources(); if (j < arraysize(kExpElementIDs) - 1) { - notification_type = NotificationType::FOCUS_CHANGED_IN_PAGE; + notification_type = content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE; notification_source = Source<TabContents>( interstitial_page->tab()); } else { // On the last tab key press, the focus returns to the browser. - notification_type = NotificationType::FOCUS_RETURNED_TO_BROWSER; + notification_type = chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER; notification_source = Source<Browser>(browser()); } diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc index 9d03c40..eb1ad53 100644 --- a/chrome/browser/browser_keyevents_browsertest.cc +++ b/chrome/browser/browser_keyevents_browsertest.cc @@ -12,6 +12,7 @@ #include "base/values.h" #include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" @@ -85,7 +86,7 @@ class TestFinishObserver : public NotificationObserver { public: explicit TestFinishObserver(RenderViewHost* render_view_host) : finished_(false), waiting_(false) { - registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, + registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, Source<RenderViewHost>(render_view_host)); } @@ -98,10 +99,10 @@ class TestFinishObserver : public NotificationObserver { return finished_; } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::DOM_OPERATION_RESPONSE); + DCHECK(type == chrome::NOTIFICATION_DOM_OPERATION_RESPONSE); Details<DomOperationNotificationDetails> dom_op_details(details); // We might receive responses for other script execution, but we only // care about the test finished message. @@ -674,7 +675,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_ReservedAccelerators) { }; ui_test_utils::WindowedNotificationObserver wait_for_new_tab( - NotificationType::TAB_PARENTED, + content::NOTIFICATION_TAB_PARENTED, NotificationService::AllSources()); // Press Ctrl/Cmd+T, which will open a new tab. It cannot be suppressed. @@ -704,7 +705,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_ReservedAccelerators) { ASSERT_NO_FATAL_FAILURE(SuppressAllEvents(1, true)); ui_test_utils::WindowedNotificationObserver wait_for_tab_closed( - NotificationType::TAB_CLOSED, Source<NavigationController>( + content::NOTIFICATION_TAB_CLOSED, Source<NavigationController>( &browser()->GetTabContentsAt(1)->controller())); // Press Ctrl/Cmd+W, which will close the tab. diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index f99f38b..1b35f11 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -54,6 +54,7 @@ #include "chrome/browser/tab_closeable_state_watcher.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/default_plugin.h" @@ -611,10 +612,10 @@ bool BrowserProcessImpl::plugin_finder_disabled() const { return *plugin_finder_disabled_pref_; } -void BrowserProcessImpl::Observe(NotificationType type, +void BrowserProcessImpl::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { std::string* pref = Details<std::string>(details).ptr(); if (*pref == prefs::kDefaultBrowserSettingEnabled) { if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index db003fd..f9d0ff9 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -104,7 +104,7 @@ class BrowserProcessImpl : public BrowserProcess, virtual bool plugin_finder_disabled() const; // NotificationObserver methods - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/browser_signin.cc b/chrome/browser/browser_signin.cc index 6c99f65..ec1a0fb 100644 --- a/chrome/browser/browser_signin.cc +++ b/chrome/browser/browser_signin.cc @@ -21,6 +21,7 @@ #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/browser/ui/webui/constrained_html_ui.h" #include "chrome/browser/ui/webui/html_dialog_ui.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -29,7 +30,6 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/browser_resources.h" #include "ui/base/resource/resource_bundle.h" @@ -255,11 +255,11 @@ std::string BrowserSignin::GetSignedInUsername() const { return username; } -void BrowserSignin::Observe(NotificationType type, +void BrowserSignin::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::GOOGLE_SIGNIN_SUCCESSFUL: { + switch (type) { + case chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL: { VLOG(1) << "GOOGLE_SIGNIN_SUCCESSFUL"; if (delegate_) delegate_->OnLoginSuccess(); @@ -267,7 +267,7 @@ void BrowserSignin::Observe(NotificationType type, OnLoginFinished(); break; } - case NotificationType::GOOGLE_SIGNIN_FAILED: { + case chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED: { VLOG(1) << "GOOGLE_SIGNIN_FAILED"; // The signin failed, refresh the UI with error information. html_dialog_ui_delegate_->ReloadUI(); @@ -310,19 +310,19 @@ BrowserSigninHtml* BrowserSignin::CreateHtmlDialogUI() { void BrowserSignin::RegisterAuthNotifications() { registrar_.Add(this, - NotificationType::GOOGLE_SIGNIN_SUCCESSFUL, + chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, Source<Profile>(profile_)); registrar_.Add(this, - NotificationType::GOOGLE_SIGNIN_FAILED, + chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, Source<Profile>(profile_)); } void BrowserSignin::UnregisterAuthNotifications() { registrar_.Remove(this, - NotificationType::GOOGLE_SIGNIN_SUCCESSFUL, + chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, Source<Profile>(profile_)); registrar_.Remove(this, - NotificationType::GOOGLE_SIGNIN_FAILED, + chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, Source<Profile>(profile_)); } diff --git a/chrome/browser/browser_signin.h b/chrome/browser/browser_signin.h index 63096ea..a250d3b 100644 --- a/chrome/browser/browser_signin.h +++ b/chrome/browser/browser_signin.h @@ -66,7 +66,7 @@ class BrowserSignin : public NotificationObserver { virtual std::string GetSignedInUsername() const; // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc index 0b34523..70083fe 100644 --- a/chrome/browser/browsing_data_remover.cc +++ b/chrome/browser/browsing_data_remover.cc @@ -31,6 +31,7 @@ #include "chrome/browser/sessions/tab_restore_service.h" #include "chrome/browser/sessions/tab_restore_service_factory.h" #include "chrome/browser/webdata/web_data_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_thread.h" #include "content/browser/in_process_webkit/webkit_context.h" @@ -153,7 +154,7 @@ void BrowsingDataRemover::Remove(int remove_mask) { TemplateURLService* keywords_model = TemplateURLServiceFactory::GetForProfile(profile_); if (keywords_model && !keywords_model->loaded()) { - registrar_.Add(this, NotificationType::TEMPLATE_URL_SERVICE_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, Source<TemplateURLService>(keywords_model)); keywords_model->Load(); } else if (keywords_model) { @@ -361,13 +362,13 @@ base::Time BrowsingDataRemover::CalculateBeginDeleteTime( return delete_begin_time - diff; } -void BrowsingDataRemover::Observe(NotificationType type, +void BrowsingDataRemover::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // TODO(brettw) bug 1139736: This should also observe session // clearing (what about other things such as passwords, etc.?) and wait for // them to complete before continuing. - DCHECK(type == NotificationType::TEMPLATE_URL_SERVICE_LOADED); + DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); TemplateURLService* model = Source<TemplateURLService>(source).ptr(); if (model->profile() == profile_->GetOriginalProfile()) { registrar_.RemoveAll(); diff --git a/chrome/browser/browsing_data_remover.h b/chrome/browser/browsing_data_remover.h index d74858c..9f94024 100644 --- a/chrome/browser/browsing_data_remover.h +++ b/chrome/browser/browsing_data_remover.h @@ -114,7 +114,7 @@ class BrowsingDataRemover : public NotificationObserver, // NotificationObserver method. Callback when TemplateURLService has finished // loading. Deletes the entries from the model, and if we're not waiting on // anything else notifies observers and deletes this BrowsingDataRemover. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index 81f9e61..54e04ab 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -23,6 +23,7 @@ #include "chrome/browser/chromeos/login/authentication_notification_details.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/network_state_notifier.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" @@ -342,9 +343,9 @@ void BootTimesLoader::RecordLoginAttempted() { AddLoginTimeMarker("LoginStarted", false); if (!have_registered_) { have_registered_ = true; - registrar_.Add(this, NotificationType::LOAD_START, + registrar_.Add(this, content::NOTIFICATION_LOAD_START, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::LOGIN_AUTHENTICATION, + registrar_.Add(this, chrome::NOTIFICATION_LOGIN_AUTHENTICATION, NotificationService::AllSources()); } } @@ -360,18 +361,18 @@ void BootTimesLoader::AddLogoutTimeMarker( } void BootTimesLoader::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::LOGIN_AUTHENTICATION) { + if (type == chrome::NOTIFICATION_LOGIN_AUTHENTICATION) { Details<AuthenticationNotificationDetails> auth_details(details); if (auth_details->success()) { AddLoginTimeMarker("Authenticate", true); RecordCurrentStats(kLoginSuccess); - registrar_.Remove(this, NotificationType::LOGIN_AUTHENTICATION, + registrar_.Remove(this, chrome::NOTIFICATION_LOGIN_AUTHENTICATION, NotificationService::AllSources()); } - } else if (type == NotificationType::LOAD_START) { + } else if (type == content::NOTIFICATION_LOAD_START) { // Make sure it's not some page load initiated by OOBE/login screen. if (!UserManager::Get()->user_is_logged_in()) return; @@ -383,7 +384,7 @@ void BootTimesLoader::Observe( AddLoginTimeMarker("LoginDone", true); RecordCurrentStats(kChromeFirstRender); // Post chrome first render stat. - registrar_.Remove(this, NotificationType::LOAD_START, + registrar_.Remove(this, content::NOTIFICATION_LOAD_START, NotificationService::AllSources()); // Don't swamp the FILE thread right away. BrowserThread::PostDelayedTask( diff --git a/chrome/browser/chromeos/boot_times_loader.h b/chrome/browser/chromeos/boot_times_loader.h index ac338d8..f0dd7f4 100644 --- a/chrome/browser/chromeos/boot_times_loader.h +++ b/chrome/browser/chromeos/boot_times_loader.h @@ -101,7 +101,7 @@ class BootTimesLoader void RecordLoginAttempted(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/cros/login_library.cc b/chrome/browser/chromeos/cros/login_library.cc index d9f3734..af42d4a 100644 --- a/chrome/browser/chromeos/cros/login_library.cc +++ b/chrome/browser/chromeos/cros/login_library.cc @@ -13,9 +13,9 @@ #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h" #include "chrome/browser/policy/proto/device_management_backend.pb.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace em = enterprise_management; namespace chromeos { @@ -171,10 +171,10 @@ class LoginLibraryImpl : public LoginLibrary { void CompleteSetOwnerKey(bool value) { VLOG(1) << "Owner key generation: " << (value ? "success" : "fail"); - NotificationType result = - NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED; + int result = + chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED; if (!value) - result = NotificationType::OWNER_KEY_FETCH_ATTEMPT_FAILED; + result = chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED; // Whether we exported the public key or not, send a notification indicating // that we're done with this attempt. diff --git a/chrome/browser/chromeos/cros_settings.cc b/chrome/browser/chromeos/cros_settings.cc index 0348a1e..8d71802 100644 --- a/chrome/browser/chromeos/cros_settings.cc +++ b/chrome/browser/chromeos/cros_settings.cc @@ -9,9 +9,10 @@ #include "base/values.h" #include "chrome/browser/chromeos/cros_settings_provider.h" #include "chrome/browser/chromeos/user_cros_settings_provider.h" +#include "chrome/common/chrome_notification_types.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" namespace chromeos { @@ -38,7 +39,7 @@ void CrosSettings::FireObservers(const char* path) { NotificationObserverList::Iterator it(*(observer_iterator->second)); NotificationObserver* observer; while ((observer = it.GetNext()) != NULL) { - observer->Observe(NotificationType::SYSTEM_SETTING_CHANGED, + observer->Observe(chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED, Source<CrosSettings>(this), Details<std::string>(&path_str)); } diff --git a/chrome/browser/chromeos/enterprise_extension_observer.cc b/chrome/browser/chromeos/enterprise_extension_observer.cc index 5c7e4f4..5a4054a 100644 --- a/chrome/browser/chromeos/enterprise_extension_observer.cc +++ b/chrome/browser/chromeos/enterprise_extension_observer.cc @@ -8,6 +8,7 @@ #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/login_library.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" namespace chromeos { @@ -16,15 +17,15 @@ EnterpriseExtensionObserver::EnterpriseExtensionObserver(Profile* profile) : profile_(profile) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); registrar_.Add(this, - NotificationType::EXTENSION_INSTALLED, + chrome::NOTIFICATION_EXTENSION_INSTALLED, Source<Profile>(profile_)); } -void EnterpriseExtensionObserver::Observe(NotificationType type, +void EnterpriseExtensionObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(type == NotificationType::EXTENSION_INSTALLED); + DCHECK(type == chrome::NOTIFICATION_EXTENSION_INSTALLED); if (Source<Profile>(source).ptr() != profile_) { return; } diff --git a/chrome/browser/chromeos/enterprise_extension_observer.h b/chrome/browser/chromeos/enterprise_extension_observer.h index 014cf22..0f2a5bb 100644 --- a/chrome/browser/chromeos/enterprise_extension_observer.h +++ b/chrome/browser/chromeos/enterprise_extension_observer.h @@ -7,11 +7,11 @@ #pragma once #include "chrome/common/extensions/extension.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" class FilePath; class Profile; @@ -26,7 +26,7 @@ class EnterpriseExtensionObserver explicit EnterpriseExtensionObserver(Profile* profile); virtual ~EnterpriseExtensionObserver() {} - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/frame/layout_mode_button.cc b/chrome/browser/chromeos/frame/layout_mode_button.cc index ffc2f41..be24ffa 100644 --- a/chrome/browser/chromeos/frame/layout_mode_button.cc +++ b/chrome/browser/chromeos/frame/layout_mode_button.cc @@ -7,6 +7,7 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/wm_ipc.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" #include "grit/generated_resources.h" @@ -42,17 +43,17 @@ bool LayoutModeButton::HitTest(const gfx::Point& l) const { return ImageButton::HitTest(point); } -void LayoutModeButton::Observe(NotificationType type, +void LayoutModeButton::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::LAYOUT_MODE_CHANGED); + DCHECK(type == chrome::NOTIFICATION_LAYOUT_MODE_CHANGED); UpdateForCurrentLayoutMode(); } void LayoutModeButton::Init() { WmIpc* wm_ipc = WmIpc::instance(); registrar_.Add(this, - NotificationType::LAYOUT_MODE_CHANGED, + chrome::NOTIFICATION_LAYOUT_MODE_CHANGED, Source<WmIpc>(wm_ipc)); UpdateForCurrentLayoutMode(); } diff --git a/chrome/browser/chromeos/frame/layout_mode_button.h b/chrome/browser/chromeos/frame/layout_mode_button.h index 3e7e98d..82248a9 100644 --- a/chrome/browser/chromeos/frame/layout_mode_button.h +++ b/chrome/browser/chromeos/frame/layout_mode_button.h @@ -30,7 +30,7 @@ class LayoutModeButton : public views::ImageButton, virtual bool HitTest(const gfx::Point& l) const OVERRIDE; // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/chromeos/frame/panel_controller.cc b/chrome/browser/chromeos/frame/panel_controller.cc index 0150a09..66b3ffb 100644 --- a/chrome/browser/chromeos/frame/panel_controller.cc +++ b/chrome/browser/chromeos/frame/panel_controller.cc @@ -20,6 +20,7 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/wm_ipc.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -389,7 +390,7 @@ bool PanelController::PanelClientEvent(GdkEventClient* event) { expanded_ = new_state; State state = new_state ? EXPANDED : MINIMIZED; NotificationService::current()->Notify( - NotificationType::PANEL_STATE_CHANGED, + chrome::NOTIFICATION_PANEL_STATE_CHANGED, Source<PanelController>(this), Details<State>(&state)); } diff --git a/chrome/browser/chromeos/input_method/input_method_manager.cc b/chrome/browser/chromeos/input_method/input_method_manager.cc index 5d0c565..da81d24 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager.cc +++ b/chrome/browser/chromeos/input_method/input_method_manager.cc @@ -82,7 +82,7 @@ class InputMethodManagerImpl : public InputMethodManager, // Chrome in case of a sudden crash, we have a way to do it from an // upstart script. See crosbug.com/6515 and crosbug.com/6995 for // details. - notification_registrar_.Add(this, NotificationType::APP_TERMINATING, + notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, NotificationService::AllSources()); ibus_controller_ = input_method::IBusController::Create(); @@ -860,11 +860,11 @@ class InputMethodManagerImpl : public InputMethodManager, } // NotificationObserver implementation: - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Stop the input method daemon on browser shutdown. - if (type.value == NotificationType::APP_TERMINATING) { + if (type == content::NOTIFICATION_APP_TERMINATING) { notification_registrar_.RemoveAll(); StopInputMethodDaemon(); #if !defined(TOUCH_UI) diff --git a/chrome/browser/chromeos/locale_change_guard.cc b/chrome/browser/chromeos/locale_change_guard.cc index 25697ed..501f0ff 100644 --- a/chrome/browser/chromeos/locale_change_guard.cc +++ b/chrome/browser/chromeos/locale_change_guard.cc @@ -12,6 +12,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/user_metrics.h" @@ -43,14 +44,14 @@ LocaleChangeGuard::LocaleChangeGuard(Profile* profile) note_(NULL), reverted_(false) { DCHECK(profile_); - registrar_.Add(this, NotificationType::OWNERSHIP_CHECKED, + registrar_.Add(this, chrome::NOTIFICATION_OWNERSHIP_CHECKED, NotificationService::AllSources()); } LocaleChangeGuard::~LocaleChangeGuard() {} void LocaleChangeGuard::OnLogin() { - registrar_.Add(this, NotificationType::LOAD_COMPLETED_MAIN_FRAME, + registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, NotificationService::AllSources()); } @@ -74,22 +75,22 @@ void LocaleChangeGuard::RevertLocaleChange(const ListValue* list) { browser->ExecuteCommand(IDC_EXIT); } -void LocaleChangeGuard::Observe(NotificationType type, +void LocaleChangeGuard::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (profile_ == NULL) { NOTREACHED(); return; } - switch (type.value) { - case NotificationType::LOAD_COMPLETED_MAIN_FRAME: { + switch (type) { + case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: { // We need to perform locale change check only once, so unsubscribe. - registrar_.Remove(this, NotificationType::LOAD_COMPLETED_MAIN_FRAME, + registrar_.Remove(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, NotificationService::AllSources()); Check(); break; } - case NotificationType::OWNERSHIP_CHECKED: { + case chrome::NOTIFICATION_OWNERSHIP_CHECKED: { if (UserManager::Get()->current_user_is_owner()) { PrefService* local_state = g_browser_process->local_state(); if (local_state) { diff --git a/chrome/browser/chromeos/locale_change_guard.h b/chrome/browser/chromeos/locale_change_guard.h index f2b369a..bcab9af 100644 --- a/chrome/browser/chromeos/locale_change_guard.h +++ b/chrome/browser/chromeos/locale_change_guard.h @@ -11,9 +11,9 @@ #include "base/lazy_instance.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/chromeos/notifications/system_notification.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" class ListValue; class NotificationDetails; @@ -45,7 +45,7 @@ class LocaleChangeGuard : public NotificationObserver { void Check(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/login/base_login_display_host.cc b/chrome/browser/chromeos/login/base_login_display_host.cc index 2b763b8..a4f00b6 100644 --- a/chrome/browser/chromeos/login/base_login_display_host.cc +++ b/chrome/browser/chromeos/login/base_login_display_host.cc @@ -28,8 +28,8 @@ #include "chrome/browser/policy/browser_policy_connector.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/pref_names.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "third_party/cros/chromeos_wm_ipc_enums.h" #include "ui/base/resource/resource_bundle.h" @@ -97,7 +97,7 @@ BaseLoginDisplayHost::BaseLoginDisplayHost(const gfx::Rect& background_bounds) // will block the shutdown. registrar_.Add( this, - NotificationType::APP_EXITING, + content::NOTIFICATION_APP_EXITING, NotificationService::AllSources()); DCHECK(default_host_ == NULL); default_host_ = this; @@ -194,10 +194,10 @@ void BaseLoginDisplayHost::StartSignInScreen() { // BaseLoginDisplayHost -------------------------------------------------------- -void BaseLoginDisplayHost::Observe(NotificationType type, +void BaseLoginDisplayHost::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - CHECK(type == NotificationType::APP_EXITING); + CHECK(type == content::NOTIFICATION_APP_EXITING); registrar_.RemoveAll(); MessageLoop::current()->DeleteSoon(FROM_HERE, this); diff --git a/chrome/browser/chromeos/login/base_login_display_host.h b/chrome/browser/chromeos/login/base_login_display_host.h index 91da484..f4287d6 100644 --- a/chrome/browser/chromeos/login/base_login_display_host.h +++ b/chrome/browser/chromeos/login/base_login_display_host.h @@ -52,7 +52,7 @@ class BaseLoginDisplayHost : public LoginDisplayHost, private: // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index 3b7917a..15f8985 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -28,11 +28,12 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/views/window.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/net/gaia/google_service_auth_error.h" #include "chrome/common/pref_names.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "views/widget/widget.h" @@ -80,7 +81,7 @@ ExistingUserController::ExistingUserController(LoginDisplayHost* host) login_display_ = host_->CreateLoginDisplay(this); registrar_.Add(this, - NotificationType::LOGIN_USER_IMAGE_CHANGED, + chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, NotificationService::AllSources()); } @@ -114,10 +115,10 @@ void ExistingUserController::Init(const UserVector& users) { // ExistingUserController, NotificationObserver implementation: // -void ExistingUserController::Observe(NotificationType type, +void ExistingUserController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::LOGIN_USER_IMAGE_CHANGED) + if (type != chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED) return; UserManager::User* user = Details<UserManager::User>(details).ptr(); diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h index ef7179a..e12457a 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.h +++ b/chrome/browser/chromeos/login/existing_user_controller.h @@ -69,7 +69,7 @@ class ExistingUserController : public LoginDisplay::Delegate, virtual void OnStartEnterpriseEnrollment() OVERRIDE; // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/login/google_authenticator.cc b/chrome/browser/chromeos/login/google_authenticator.cc index 3ecece9..80cb271 100644 --- a/chrome/browser/chromeos/login/google_authenticator.cc +++ b/chrome/browser/chromeos/login/google_authenticator.cc @@ -24,6 +24,7 @@ #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/net/gaia/gaia_auth_fetcher.h" #include "chrome/common/net/gaia/gaia_constants.h" @@ -165,7 +166,7 @@ void GoogleAuthenticator::LoginOffTheRecord() { if (CrosLibrary::Get()->GetCryptohomeLibrary()->MountForBwsi(&mount_error)) { AuthenticationNotificationDetails details(true); NotificationService::current()->Notify( - NotificationType::LOGIN_AUTHENTICATION, + chrome::NOTIFICATION_LOGIN_AUTHENTICATION, NotificationService::AllSources(), Details<AuthenticationNotificationDetails>(&details)); consumer_->OnOffTheRecordLoginSuccess(); @@ -275,7 +276,7 @@ void GoogleAuthenticator::OnLoginSuccess( // Send notification of success AuthenticationNotificationDetails details(true); NotificationService::current()->Notify( - NotificationType::LOGIN_AUTHENTICATION, + chrome::NOTIFICATION_LOGIN_AUTHENTICATION, NotificationService::AllSources(), Details<AuthenticationNotificationDetails>(&details)); @@ -350,7 +351,7 @@ void GoogleAuthenticator::OnLoginFailure(const LoginFailure& error) { // Send notification of failure AuthenticationNotificationDetails details(false); NotificationService::current()->Notify( - NotificationType::LOGIN_AUTHENTICATION, + chrome::NOTIFICATION_LOGIN_AUTHENTICATION, NotificationService::AllSources(), Details<AuthenticationNotificationDetails>(&details)); LOG(WARNING) << "Login failed: " << error.GetErrorString(); diff --git a/chrome/browser/chromeos/login/login_html_dialog.cc b/chrome/browser/chromeos/login/login_html_dialog.cc index bfc84fe..a72d52b 100644 --- a/chrome/browser/chromeos/login/login_html_dialog.cc +++ b/chrome/browser/chromeos/login/login_html_dialog.cc @@ -64,9 +64,9 @@ void LoginHtmlDialog::Show() { } if (bubble_frame_view_) { bubble_frame_view_->StartThrobber(); - notification_registrar_.Add(this, - NotificationType::LOAD_COMPLETED_MAIN_FRAME, - NotificationService::AllSources()); + notification_registrar_.Add( + this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, + NotificationService::AllSources()); } html_view->InitDialog(); html_view->GetWidget()->Show(); @@ -128,10 +128,10 @@ bool LoginHtmlDialog::HandleContextMenu(const ContextMenuParams& params) { return true; } -void LoginHtmlDialog::Observe(NotificationType type, +void LoginHtmlDialog::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type.value == NotificationType::LOAD_COMPLETED_MAIN_FRAME); + DCHECK(type == content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME); if (bubble_frame_view_) bubble_frame_view_->StopThrobber(); } diff --git a/chrome/browser/chromeos/login/login_html_dialog.h b/chrome/browser/chromeos/login/login_html_dialog.h index 4fd0953..9a8cc9e 100644 --- a/chrome/browser/chromeos/login/login_html_dialog.h +++ b/chrome/browser/chromeos/login/login_html_dialog.h @@ -69,7 +69,7 @@ class LoginHtmlDialog : public HtmlDialogUIDelegate, virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/login/login_performer.cc b/chrome/browser/chromeos/login/login_performer.cc index e340751..3e0882c 100644 --- a/chrome/browser/chromeos/login/login_performer.cc +++ b/chrome/browser/chromeos/login/login_performer.cc @@ -21,11 +21,12 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" #include "content/browser/user_metrics.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -213,10 +214,10 @@ void LoginPerformer::OnCheckWhitelistCompleted(SignedSettings::ReturnCode code, // LoginPerformer, NotificationObserver implementation: // -void LoginPerformer::Observe(NotificationType type, +void LoginPerformer::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::SCREEN_LOCK_STATE_CHANGED) + if (type != chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED) return; bool is_screen_locked = *Details<bool>(details).ptr(); @@ -314,7 +315,7 @@ void LoginPerformer::RequestScreenLock() { DVLOG(1) << "Screen lock requested"; // Will receive notifications on screen unlock and delete itself. registrar_.Add(this, - NotificationType::SCREEN_LOCK_STATE_CHANGED, + chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, NotificationService::AllSources()); if (ScreenLocker::default_screen_locker()) { DVLOG(1) << "Screen already locked"; diff --git a/chrome/browser/chromeos/login/login_performer.h b/chrome/browser/chromeos/login/login_performer.h index 641865d..95fb0f7 100644 --- a/chrome/browser/chromeos/login/login_performer.h +++ b/chrome/browser/chromeos/login/login_performer.h @@ -89,7 +89,7 @@ class LoginPerformer : public LoginStatusConsumer, const std::string& email); // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/login/owner_manager.cc b/chrome/browser/chromeos/login/owner_manager.cc index dd7ba1d..066a0a5 100644 --- a/chrome/browser/chromeos/login/owner_manager.cc +++ b/chrome/browser/chromeos/login/owner_manager.cc @@ -13,8 +13,8 @@ #include "chrome/browser/chromeos/boot_times_loader.h" #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h" #include "content/browser/browser_thread.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace chromeos { @@ -42,13 +42,13 @@ void OwnerManager::LoadOwnerKey() { BootTimesLoader::Get()->AddLoginTimeMarker("LoadOwnerKeyStart", false); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); VLOG(1) << "Loading owner key"; - NotificationType result = NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED; + int result = chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED; // If |public_key_| isn't empty, we already have the key, so don't // try to import again. if (public_key_.empty() && !utils_->ImportPublicKey(utils_->GetOwnerKeyFilePath(), &public_key_)) { - result = NotificationType::OWNER_KEY_FETCH_ATTEMPT_FAILED; + result = chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED; } // Whether we loaded the public key or not, send a notification indicating @@ -140,7 +140,7 @@ void OwnerManager::Verify(const BrowserThread::ID thread_id, BootTimesLoader::Get()->AddLoginTimeMarker("VerifyEnd", false); } -void OwnerManager::SendNotification(NotificationType type, +void OwnerManager::SendNotification(int type, const NotificationDetails& details) { NotificationService::current()->Notify( type, diff --git a/chrome/browser/chromeos/login/owner_manager.h b/chrome/browser/chromeos/login/owner_manager.h index c44cf2d..1ec50cb 100644 --- a/chrome/browser/chromeos/login/owner_manager.h +++ b/chrome/browser/chromeos/login/owner_manager.h @@ -16,7 +16,7 @@ class FilePath; class NotificationDetails; -class NotificationType; +class int; namespace chromeos { @@ -90,7 +90,7 @@ class OwnerManager : public base::RefCountedThreadSafe<OwnerManager> { private: // A helper method to send a notification on another thread. - void SendNotification(NotificationType type, + void SendNotification(int type, const NotificationDetails& details); // Calls back a key update delegate on a given thread. diff --git a/chrome/browser/chromeos/login/owner_manager_unittest.cc b/chrome/browser/chromeos/login/owner_manager_unittest.cc index 6c8a386..d539fde 100644 --- a/chrome/browser/chromeos/login/owner_manager_unittest.cc +++ b/chrome/browser/chromeos/login/owner_manager_unittest.cc @@ -12,6 +12,7 @@ #include "base/logging.h" #include "base/scoped_temp_dir.h" #include "chrome/browser/chromeos/login/mock_owner_key_utils.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "crypto/nss_util.h" #include "crypto/rsa_private_key.h" @@ -36,11 +37,11 @@ MockKeyLoadObserver::MockKeyLoadObserver(base::WaitableEvent* e) observed_(false) { registrar_.Add( this, - NotificationType::OWNER_KEY_FETCH_ATTEMPT_FAILED, + chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED, NotificationService::AllSources()); registrar_.Add( this, - NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, + chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, NotificationService::AllSources()); } @@ -48,16 +49,16 @@ MockKeyLoadObserver::~MockKeyLoadObserver() { DCHECK(observed_); } -void MockKeyLoadObserver::Observe(NotificationType type, +void MockKeyLoadObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { LOG(INFO) << "Observed key fetch event"; - if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { + if (type == chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { DCHECK(success_expected_); observed_ = true; if (event_) event_->Signal(); - } else if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_FAILED) { + } else if (type == chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED) { DCHECK(!success_expected_); observed_ = true; if (event_) diff --git a/chrome/browser/chromeos/login/owner_manager_unittest.h b/chrome/browser/chromeos/login/owner_manager_unittest.h index 65118c9..18b769a 100644 --- a/chrome/browser/chromeos/login/owner_manager_unittest.h +++ b/chrome/browser/chromeos/login/owner_manager_unittest.h @@ -14,10 +14,10 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/synchronization/waitable_event.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -29,7 +29,7 @@ class MockKeyLoadObserver : public NotificationObserver { virtual ~MockKeyLoadObserver(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/login/ownership_service.cc b/chrome/browser/chromeos/login/ownership_service.cc index 0927982..c0d08ee 100644 --- a/chrome/browser/chromeos/login/ownership_service.cc +++ b/chrome/browser/chromeos/login/ownership_service.cc @@ -32,7 +32,7 @@ OwnershipService::OwnershipService() ownership_status_(OWNERSHIP_UNKNOWN) { notification_registrar_.Add( this, - NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, + chrome::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, NotificationService::AllSources()); } @@ -149,10 +149,10 @@ void OwnershipService::StartVerifyAttempt(const std::string& data, return; } -void OwnershipService::Observe(NotificationType type, +void OwnershipService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { + if (type == chrome::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { SetStatus(OWNERSHIP_TAKEN); notification_registrar_.RemoveAll(); } else { diff --git a/chrome/browser/chromeos/login/ownership_service.h b/chrome/browser/chromeos/login/ownership_service.h index e31e501..d96102e 100644 --- a/chrome/browser/chromeos/login/ownership_service.h +++ b/chrome/browser/chromeos/login/ownership_service.h @@ -103,7 +103,7 @@ class OwnershipService : public NotificationObserver { OwnershipService(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/login/parallel_authenticator.cc b/chrome/browser/chromeos/login/parallel_authenticator.cc index e5444d5..33a02c2 100644 --- a/chrome/browser/chromeos/login/parallel_authenticator.cc +++ b/chrome/browser/chromeos/login/parallel_authenticator.cc @@ -23,6 +23,7 @@ #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/net/gaia/gaia_auth_fetcher.h" #include "chrome/common/net/gaia/gaia_constants.h" @@ -130,7 +131,7 @@ void ParallelAuthenticator::OnLoginSuccess( // Send notification of success AuthenticationNotificationDetails details(true); NotificationService::current()->Notify( - NotificationType::LOGIN_AUTHENTICATION, + chrome::NOTIFICATION_LOGIN_AUTHENTICATION, NotificationService::AllSources(), Details<AuthenticationNotificationDetails>(&details)); { @@ -148,7 +149,7 @@ void ParallelAuthenticator::OnOffTheRecordLoginSuccess() { // Send notification of success AuthenticationNotificationDetails details(true); NotificationService::current()->Notify( - NotificationType::LOGIN_AUTHENTICATION, + chrome::NOTIFICATION_LOGIN_AUTHENTICATION, NotificationService::AllSources(), Details<AuthenticationNotificationDetails>(&details)); consumer_->OnOffTheRecordLoginSuccess(); @@ -202,7 +203,7 @@ void ParallelAuthenticator::OnLoginFailure(const LoginFailure& error) { // Send notification of failure AuthenticationNotificationDetails details(false); NotificationService::current()->Notify( - NotificationType::LOGIN_AUTHENTICATION, + chrome::NOTIFICATION_LOGIN_AUTHENTICATION, NotificationService::AllSources(), Details<AuthenticationNotificationDetails>(&details)); LOG(WARNING) << "Login failed: " << error.GetErrorString(); diff --git a/chrome/browser/chromeos/login/screen_lock_view.cc b/chrome/browser/chromeos/login/screen_lock_view.cc index 8ffd17e..57f0f89 100644 --- a/chrome/browser/chromeos/login/screen_lock_view.cc +++ b/chrome/browser/chromeos/login/screen_lock_view.cc @@ -14,6 +14,7 @@ #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" #include "chrome/browser/chromeos/views/copy_background.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -116,7 +117,7 @@ void ScreenLockView::Layout() { void ScreenLockView::Init() { registrar_.Add(this, - NotificationType::LOGIN_USER_IMAGE_CHANGED, + chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, NotificationService::AllSources()); user_view_ = new UserView(this, @@ -250,10 +251,10 @@ bool ScreenLockView::HandleKeyEvent( } void ScreenLockView::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::LOGIN_USER_IMAGE_CHANGED || !user_view_) + if (type != chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED || !user_view_) return; UserManager::User* user = Details<UserManager::User>(details).ptr(); diff --git a/chrome/browser/chromeos/login/screen_lock_view.h b/chrome/browser/chromeos/login/screen_lock_view.h index 561d793..e845585 100644 --- a/chrome/browser/chromeos/login/screen_lock_view.h +++ b/chrome/browser/chromeos/login/screen_lock_view.h @@ -53,7 +53,7 @@ class ScreenLockView : public ThrobberHostView, virtual gfx::Size GetPreferredSize(); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc index 0ac3a1a..f13cede 100644 --- a/chrome/browser/chromeos/login/screen_locker.cc +++ b/chrome/browser/chromeos/login/screen_locker.cc @@ -41,6 +41,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "content/browser/browser_thread.h" #include "content/browser/user_metrics.h" @@ -74,15 +75,15 @@ class ScreenLockObserver : public chromeos::ScreenLockLibrary::Observer, public NotificationObserver { public: ScreenLockObserver() { - registrar_.Add(this, NotificationType::LOGIN_USER_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_CHANGED, NotificationService::AllSources()); } // NotificationObserver overrides: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE { - if (type == NotificationType::LOGIN_USER_CHANGED) { + if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { // Register Screen Lock after login screen to make sure // we don't show the screen lock on top of the login screen by accident. if (chromeos::CrosLibrary::Get()->EnsureLoaded()) @@ -1112,7 +1113,7 @@ ScreenLocker::~ScreenLocker() { screen_locker_ = NULL; bool state = false; NotificationService::current()->Notify( - NotificationType::SCREEN_LOCK_STATE_CHANGED, + chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, Source<ScreenLocker>(this), Details<bool>(&state)); if (CrosLibrary::Get()->EnsureLoaded()) @@ -1143,7 +1144,7 @@ void ScreenLocker::ScreenLockReady() { bool state = true; NotificationService::current()->Notify( - NotificationType::SCREEN_LOCK_STATE_CHANGED, + chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, Source<ScreenLocker>(this), Details<bool>(&state)); if (CrosLibrary::Get()->EnsureLoaded()) diff --git a/chrome/browser/chromeos/login/screen_locker_browsertest.cc b/chrome/browser/chromeos/login/screen_locker_browsertest.cc index c2d22cc..4d77a83 100644 --- a/chrome/browser/chromeos/login/screen_locker_browsertest.cc +++ b/chrome/browser/chromeos/login/screen_locker_browsertest.cc @@ -16,10 +16,10 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/views/browser_dialogs.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/ui_test_utils.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "views/controls/textfield/textfield.h" @@ -33,7 +33,7 @@ class Waiter : public NotificationObserver { : browser_(browser), running_(false) { registrar_.Add(this, - NotificationType::SCREEN_LOCK_STATE_CHANGED, + chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, NotificationService::AllSources()); handler_id_ = g_signal_connect( G_OBJECT(browser_->window()->GetNativeHandle()), @@ -48,10 +48,10 @@ class Waiter : public NotificationObserver { handler_id_); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::SCREEN_LOCK_STATE_CHANGED); + DCHECK(type == chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED); if (running_) MessageLoop::current()->Quit(); } @@ -117,7 +117,7 @@ class ScreenLockerTest : public CrosInProcessBrowserTest { tester->EmulateWindowManagerReady(); if (!chromeos::ScreenLocker::GetTester()->IsLocked()) ui_test_utils::WaitForNotification( - NotificationType::SCREEN_LOCK_STATE_CHANGED); + chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED); EXPECT_TRUE(tester->IsLocked()); tester->InjectMockAuthenticator("", ""); @@ -139,7 +139,7 @@ class ScreenLockerTest : public CrosInProcessBrowserTest { tester->EmulateWindowManagerReady(); if (!tester->IsLocked()) { ui_test_utils::WaitForNotification( - NotificationType::SCREEN_LOCK_STATE_CHANGED); + chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED); } EXPECT_TRUE(tester->IsLocked()); } @@ -184,7 +184,7 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, DISABLED_TestBasic) { tester->EmulateWindowManagerReady(); if (!chromeos::ScreenLocker::GetTester()->IsLocked()) ui_test_utils::WaitForNotification( - NotificationType::SCREEN_LOCK_STATE_CHANGED); + chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED); // Test to make sure that the widget is actually appearing and is of // reasonable size, preventing a regression of diff --git a/chrome/browser/chromeos/login/touch_login_view.cc b/chrome/browser/chromeos/login/touch_login_view.cc index 74d0968..82e8d9e 100644 --- a/chrome/browser/chromeos/login/touch_login_view.cc +++ b/chrome/browser/chromeos/login/touch_login_view.cc @@ -8,6 +8,7 @@ #include "chrome/browser/ui/touch/frame/keyboard_container_view.h" #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" #include "chrome/browser/ui/views/dom_view.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" #include "ui/base/animation/slide_animation.h" @@ -53,16 +54,16 @@ void TouchLoginView::Init() { InitVirtualKeyboard(); registrar_.Add(this, - NotificationType::FOCUS_CHANGED_IN_PAGE, + content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::HIDE_KEYBOARD_INVOKED, + chrome::NOTIFICATION_HIDE_KEYBOARD_INVOKED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::SET_KEYBOARD_HEIGHT_INVOKED, + chrome::NOTIFICATION_SET_KEYBOARD_HEIGHT_INVOKED, NotificationService::AllSources()); } @@ -150,10 +151,10 @@ TouchLoginView::VirtualKeyboardType return NONE; } -void TouchLoginView::Observe(NotificationType type, +void TouchLoginView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::FOCUS_CHANGED_IN_PAGE) { + if (type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE) { // Only modify the keyboard state if the currently active tab sent the // notification. const TabContents* current_tab = webui_login_->tab_contents(); @@ -167,12 +168,12 @@ void TouchLoginView::Observe(NotificationType type, // can be determined after tab switching. GetFocusedStateAccessor()->SetProperty( source_tab->property_bag(), editable); - } else if (type == NotificationType::TAB_CONTENTS_DESTROYED) { + } else if (type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED) { GetFocusedStateAccessor()->DeleteProperty( Source<TabContents>(source).ptr()->property_bag()); - } else if (type == NotificationType::HIDE_KEYBOARD_INVOKED) { + } else if (type == chrome::NOTIFICATION_HIDE_KEYBOARD_INVOKED) { UpdateKeyboardAndLayout(false); - } else if (type == NotificationType::SET_KEYBOARD_HEIGHT_INVOKED) { + } else if (type == chrome::NOTIFICATION_SET_KEYBOARD_HEIGHT_INVOKED) { // TODO(penghuang) Allow extension conrtol the virtual keyboard directly // instead of using Notification. int height = *(Details<int>(details).ptr()); diff --git a/chrome/browser/chromeos/login/touch_login_view.h b/chrome/browser/chromeos/login/touch_login_view.h index a034bcf..134da21 100644 --- a/chrome/browser/chromeos/login/touch_login_view.h +++ b/chrome/browser/chromeos/login/touch_login_view.h @@ -59,7 +59,7 @@ class TouchLoginView : public WebUILoginView, VirtualKeyboardType DecideKeyboardStateForView(views::View* view); // Overridden from NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/chromeos/login/user_image_screen.cc b/chrome/browser/chromeos/login/user_image_screen.cc index 113845f..0086099 100644 --- a/chrome/browser/chromeos/login/user_image_screen.cc +++ b/chrome/browser/chromeos/login/user_image_screen.cc @@ -10,8 +10,8 @@ #include "chrome/browser/chromeos/login/screen_observer.h" #include "chrome/browser/chromeos/login/user_image_view.h" #include "chrome/browser/chromeos/login/user_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/theme_resources.h" #include "ui/base/resource/resource_bundle.h" @@ -32,7 +32,7 @@ UserImageScreen::UserImageScreen(ViewScreenDelegate* delegate) camera_controller_.set_frame_height(kFrameHeight); registrar_.Add( this, - NotificationType::SCREEN_LOCK_STATE_CHANGED, + chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, NotificationService::AllSources()); } @@ -113,10 +113,10 @@ void UserImageScreen::OnDefaultImageSelected(int index) { delegate()->GetObserver()->OnExit(ScreenObserver::USER_IMAGE_SELECTED); } -void UserImageScreen::Observe(NotificationType type, +void UserImageScreen::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::SCREEN_LOCK_STATE_CHANGED) + if (type != chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED) return; bool is_screen_locked = *Details<bool>(details).ptr(); diff --git a/chrome/browser/chromeos/login/user_image_screen.h b/chrome/browser/chromeos/login/user_image_screen.h index 7452fe6..d90f79a 100644 --- a/chrome/browser/chromeos/login/user_image_screen.h +++ b/chrome/browser/chromeos/login/user_image_screen.h @@ -39,7 +39,7 @@ class UserImageScreen: public ViewScreen<UserImageView>, virtual void OnDefaultImageSelected(int index); // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc index 56ad2c4..af71e8b 100644 --- a/chrome/browser/chromeos/login/user_manager.cc +++ b/chrome/browser/chromeos/login/user_manager.cc @@ -29,11 +29,11 @@ #include "chrome/browser/defaults.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/codec/png_codec.h" @@ -103,9 +103,10 @@ void UpdateOwnership(bool is_owner) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); g_user_manager.Get().set_current_user_is_owner(is_owner); - NotificationService::current()->Notify(NotificationType::OWNERSHIP_CHECKED, - NotificationService::AllSources(), - NotificationService::NoDetails()); + NotificationService::current()->Notify( + chrome::NOTIFICATION_OWNERSHIP_CHECKED, + NotificationService::AllSources(), + NotificationService::NoDetails()); if (is_owner) { // Also update cached value. UserCrosSettingsProvider::UpdateCachedOwner( @@ -537,7 +538,7 @@ void UserManager::OnImageLoaded(const std::string& username, if (should_save_image) SaveUserImage(username, image); NotificationService::current()->Notify( - NotificationType::LOGIN_USER_IMAGE_CHANGED, + chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, Source<UserManager>(this), Details<const User>(&user)); } @@ -552,7 +553,7 @@ UserManager::UserManager() current_user_is_owner_(false), current_user_is_new_(false), user_is_logged_in_(false) { - registrar_.Add(this, NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, + registrar_.Add(this, chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, NotificationService::AllSources()); } @@ -602,7 +603,7 @@ void RealTPMTokenInfoDelegate::GetTokenInfo(std::string* token_name, void UserManager::NotifyOnLogin() { NotificationService::current()->Notify( - NotificationType::LOGIN_USER_CHANGED, + chrome::NOTIFICATION_LOGIN_USER_CHANGED, Source<UserManager>(this), Details<const User>(&logged_in_user_)); @@ -629,10 +630,10 @@ void UserManager::NotifyOnLogin() { NewRunnableFunction(&CheckOwnership)); } -void UserManager::Observe(NotificationType type, +void UserManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { + if (type == chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, NewRunnableFunction(&CheckOwnership)); } diff --git a/chrome/browser/chromeos/login/user_manager.h b/chrome/browser/chromeos/login/user_manager.h index d7f09bb..625d173 100644 --- a/chrome/browser/chromeos/login/user_manager.h +++ b/chrome/browser/chromeos/login/user_manager.h @@ -126,7 +126,7 @@ class UserManager : public UserImageLoader::Delegate, bool save_image); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/login/views_oobe_display.cc b/chrome/browser/chromeos/login/views_oobe_display.cc index 847ad6f..3863d3f 100644 --- a/chrome/browser/chromeos/login/views_oobe_display.cc +++ b/chrome/browser/chromeos/login/views_oobe_display.cc @@ -12,8 +12,8 @@ #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/wm_ipc.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "views/view.h" #include "views/widget/widget.h" @@ -62,7 +62,7 @@ class ContentView : public views::View { ~ContentView() { NotificationService::current()->Notify( - NotificationType::WIZARD_CONTENT_VIEW_DESTROYED, + chrome::NOTIFICATION_WIZARD_CONTENT_VIEW_DESTROYED, NotificationService::AllSources(), NotificationService::NoDetails()); } diff --git a/chrome/browser/chromeos/login/wizard_accessibility_handler.cc b/chrome/browser/chromeos/login/wizard_accessibility_handler.cc index 962edd4..a23453b 100644 --- a/chrome/browser/chromeos/login/wizard_accessibility_handler.cc +++ b/chrome/browser/chromeos/login/wizard_accessibility_handler.cc @@ -16,6 +16,7 @@ #include "chrome/browser/extensions/extension_accessibility_api.h" #include "chrome/browser/extensions/extension_accessibility_api_constants.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" #include "grit/generated_resources.h" @@ -100,7 +101,7 @@ void AppendIndexOfCount(int index, int count, std::string* str) { namespace chromeos { void WizardAccessibilityHandler::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { const AccessibilityControlInfo *control_info = @@ -130,27 +131,27 @@ void WizardAccessibilityHandler::Speak(const char* speak_str, } void WizardAccessibilityHandler::DescribeAccessibilityEvent( - NotificationType event_type, + int event_type, const AccessibilityControlInfo* control_info, std::string* out_spoken_description, EarconType* out_earcon) { *out_spoken_description = std::string(); *out_earcon = NO_EARCON; - switch (event_type.value) { - case NotificationType::ACCESSIBILITY_CONTROL_FOCUSED: + switch (event_type) { + case chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED: DescribeControl(control_info, false, out_spoken_description, out_earcon); break; - case NotificationType::ACCESSIBILITY_CONTROL_ACTION: + case chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_ACTION: DescribeControl(control_info, true, out_spoken_description, out_earcon); break; - case NotificationType::ACCESSIBILITY_TEXT_CHANGED: + case chrome::NOTIFICATION_ACCESSIBILITY_TEXT_CHANGED: DescribeTextChanged(control_info, out_spoken_description, out_earcon); break; - case NotificationType::ACCESSIBILITY_MENU_OPENED: + case chrome::NOTIFICATION_ACCESSIBILITY_MENU_OPENED: *out_earcon = EARCON_OBJECT_OPENED; break; - case NotificationType::ACCESSIBILITY_MENU_CLOSED: + case chrome::NOTIFICATION_ACCESSIBILITY_MENU_CLOSED: *out_earcon = EARCON_OBJECT_CLOSED; break; default: diff --git a/chrome/browser/chromeos/login/wizard_accessibility_handler.h b/chrome/browser/chromeos/login/wizard_accessibility_handler.h index b8542fc..7e4ea85 100644 --- a/chrome/browser/chromeos/login/wizard_accessibility_handler.h +++ b/chrome/browser/chromeos/login/wizard_accessibility_handler.h @@ -9,9 +9,9 @@ #include <string> #include "base/gtest_prod_util.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" class AccessibilityControlInfo; class AccessibilityTextBoxInfo; @@ -44,13 +44,13 @@ class WizardAccessibilityHandler : public NotificationObserver { private: // Override from NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); // Get text to speak and an earcon identifier (which may be NONE) for any // accessibility event. - void DescribeAccessibilityEvent(NotificationType event_type, + void DescribeAccessibilityEvent(int event_type, const AccessibilityControlInfo* control_info, std::string* out_spoken_description, EarconType* out_earcon); diff --git a/chrome/browser/chromeos/login/wizard_accessibility_handler_unittest.cc b/chrome/browser/chromeos/login/wizard_accessibility_handler_unittest.cc index b1afe99..9d2f878 100644 --- a/chrome/browser/chromeos/login/wizard_accessibility_handler_unittest.cc +++ b/chrome/browser/chromeos/login/wizard_accessibility_handler_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/accessibility_events.h" #include "chrome/browser/chromeos/login/wizard_accessibility_handler.h" +#include "chrome/common/chrome_notification_types.h" #include "testing/gtest/include/gtest/gtest.h" using chromeos::EarconType; @@ -22,7 +23,7 @@ class WizardAccessibilityHandlerTest : public testing::Test { textbox_info->SetValue(value, selection_start, selection_end); EarconType earcon = chromeos::NO_EARCON; handler->DescribeAccessibilityEvent( - NotificationType::ACCESSIBILITY_TEXT_CHANGED, + chrome::NOTIFICATION_ACCESSIBILITY_TEXT_CHANGED, textbox_info, description, &earcon); @@ -45,7 +46,7 @@ TEST_F(WizardAccessibilityHandlerTest, TestFocusEvents) { std::string button_name = "Save"; AccessibilityButtonInfo button_info(NULL, button_name); handler.DescribeAccessibilityEvent( - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, &button_info, &description, &earcon); @@ -56,7 +57,7 @@ TEST_F(WizardAccessibilityHandlerTest, TestFocusEvents) { std::string checkbox_name = "Accessibility"; AccessibilityCheckboxInfo checkbox_info(NULL, checkbox_name, false); handler.DescribeAccessibilityEvent( - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, &checkbox_info, &description, &earcon); @@ -64,7 +65,7 @@ TEST_F(WizardAccessibilityHandlerTest, TestFocusEvents) { EXPECT_EQ("Accessibility Unchecked check box", description); checkbox_info.SetChecked(true); handler.DescribeAccessibilityEvent( - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, &checkbox_info, &description, &earcon); @@ -77,7 +78,7 @@ TEST_F(WizardAccessibilityHandlerTest, TestFocusEvents) { AccessibilityComboBoxInfo combobox_info( NULL, combobox_name, combobox_value, 12, 35); handler.DescribeAccessibilityEvent( - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, &combobox_info, &description, &earcon); @@ -93,7 +94,7 @@ TEST_F(WizardAccessibilityHandlerTest, TestTextEvents) { AccessibilityTextBoxInfo textbox_info(NULL, "", false); handler.DescribeAccessibilityEvent( - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, &textbox_info, &description, &earcon); diff --git a/chrome/browser/chromeos/login/wizard_accessibility_helper.cc b/chrome/browser/chromeos/login/wizard_accessibility_helper.cc index 6d152fa..61937ee 100644 --- a/chrome/browser/chromeos/login/wizard_accessibility_helper.cc +++ b/chrome/browser/chromeos/login/wizard_accessibility_helper.cc @@ -11,6 +11,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" @@ -57,19 +58,19 @@ void WizardAccessibilityHelper::Init() { void WizardAccessibilityHelper::RegisterNotifications() { registrar_.Add(accessibility_handler_.get(), - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, NotificationService::AllSources()); registrar_.Add(accessibility_handler_.get(), - NotificationType::ACCESSIBILITY_CONTROL_ACTION, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_ACTION, NotificationService::AllSources()); registrar_.Add(accessibility_handler_.get(), - NotificationType::ACCESSIBILITY_TEXT_CHANGED, + chrome::NOTIFICATION_ACCESSIBILITY_TEXT_CHANGED, NotificationService::AllSources()); registrar_.Add(accessibility_handler_.get(), - NotificationType::ACCESSIBILITY_MENU_OPENED, + chrome::NOTIFICATION_ACCESSIBILITY_MENU_OPENED, NotificationService::AllSources()); registrar_.Add(accessibility_handler_.get(), - NotificationType::ACCESSIBILITY_MENU_CLOSED, + chrome::NOTIFICATION_ACCESSIBILITY_MENU_CLOSED, NotificationService::AllSources()); registered_notifications_ = true; } diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index af00b1d..2333556 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc @@ -38,8 +38,8 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/pref_names.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "ui/base/l10n/l10n_util.h" #include "views/accelerator.h" diff --git a/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc b/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc index bd573dd..ea26d39 100644 --- a/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc +++ b/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc @@ -9,6 +9,7 @@ #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/browser_dialogs.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/ui_test_utils.h" namespace chromeos { @@ -41,7 +42,7 @@ void WizardInProcessBrowserTest::CleanUpOnMainThread() { // which delays deleting itself). Run the message loop until we know the // wizard has been deleted. ui_test_utils::WaitForNotification( - NotificationType::WIZARD_CONTENT_VIEW_DESTROYED); + chrome::NOTIFICATION_WIZARD_CONTENT_VIEW_DESTROYED); } } // namespace chromeos diff --git a/chrome/browser/chromeos/media/media_player.cc b/chrome/browser/chromeos/media/media_player.cc index f06b84a..4ecf52c 100644 --- a/chrome/browser/chromeos/media/media_player.cc +++ b/chrome/browser/chromeos/media/media_player.cc @@ -27,6 +27,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/webui/favicon_source.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/jstemplate_builder.h" @@ -162,12 +163,12 @@ void MediaPlayer::SetPlaybackError(GURL const& url) { NotifyPlaylistChanged(); } -void MediaPlayer::Observe(NotificationType type, +void MediaPlayer::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_CLOSING); + DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSING); registrar_.Remove(this, - NotificationType::BROWSER_CLOSING, + chrome::NOTIFICATION_BROWSER_CLOSING, source); if (Source<Browser>(source).ptr() == mediaplayer_browser_) { mediaplayer_browser_ = NULL; @@ -203,7 +204,7 @@ void MediaPlayer::PopupPlaylist(Browser* creator) { gfx::Rect(), profile); registrar_.Add(this, - NotificationType::BROWSER_CLOSING, + chrome::NOTIFICATION_BROWSER_CLOSING, Source<Browser>(playlist_browser_)); playlist_browser_->AddSelectedTabWithURL(GetMediaplayerPlaylistUrl(), PageTransition::LINK); @@ -228,7 +229,7 @@ void MediaPlayer::PopupMediaPlayer(Browser* creator) { gfx::Rect(), profile); registrar_.Add(this, - NotificationType::BROWSER_CLOSING, + chrome::NOTIFICATION_BROWSER_CLOSING, Source<Browser>(mediaplayer_browser_)); #if defined(OS_CHROMEOS) diff --git a/chrome/browser/chromeos/media/media_player.h b/chrome/browser/chromeos/media/media_player.h index e916ea2..8ef81c4 100644 --- a/chrome/browser/chromeos/media/media_player.h +++ b/chrome/browser/chromeos/media/media_player.h @@ -10,10 +10,10 @@ #include <vector> #include "base/memory/singleton.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "net/url_request/url_request.h" @@ -97,7 +97,7 @@ class MediaPlayer : public NotificationObserver, virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request); // Used to detect when the mediaplayer is closed. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/network_state_notifier.cc b/chrome/browser/chromeos/network_state_notifier.cc index 5cb45c5..74f7eee 100644 --- a/chrome/browser/chromeos/network_state_notifier.cc +++ b/chrome/browser/chromeos/network_state_notifier.cc @@ -7,9 +7,10 @@ #include "base/message_loop.h" #include "base/time.h" #include "chrome/browser/chromeos/cros/cros_library.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace chromeos { @@ -69,7 +70,7 @@ void NetworkStateNotifier::UpdateNetworkState( state_ = new_state; NetworkStateDetails details(state_); NotificationService::current()->Notify( - NotificationType::NETWORK_STATE_CHANGED, + chrome::NOTIFICATION_NETWORK_STATE_CHANGED, NotificationService::AllSources(), Details<NetworkStateDetails>(&details)); }; diff --git a/chrome/browser/chromeos/network_state_notifier_browsertest.cc b/chrome/browser/chromeos/network_state_notifier_browsertest.cc index f65db49..8c1c2d9 100644 --- a/chrome/browser/chromeos/network_state_notifier_browsertest.cc +++ b/chrome/browser/chromeos/network_state_notifier_browsertest.cc @@ -6,6 +6,7 @@ #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" #include "chrome/browser/chromeos/cros/mock_network_library.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/ui_test_utils.h" #include "content/browser/browser_thread.h" #include "content/common/notification_registrar.h" @@ -40,11 +41,11 @@ class NetworkStateNotifierTest : public CrosInProcessBrowserTest, } // NotificationObserver overrides. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); - EXPECT_TRUE(NotificationType::NETWORK_STATE_CHANGED == type); + EXPECT_TRUE(chrome::NOTIFICATION_NETWORK_STATE_CHANGED == type); chromeos::NetworkStateDetails* state_details = Details<chromeos::NetworkStateDetails>(details).ptr(); state_ = state_details->state(); @@ -52,7 +53,7 @@ class NetworkStateNotifierTest : public CrosInProcessBrowserTest, void WaitForNotification() { ui_test_utils::WaitForNotification( - NotificationType::NETWORK_STATE_CHANGED); + chrome::NOTIFICATION_NETWORK_STATE_CHANGED); } protected: @@ -63,7 +64,7 @@ class NetworkStateNotifierTest : public CrosInProcessBrowserTest, IN_PROC_BROWSER_TEST_F(NetworkStateNotifierTest, TestConnected) { // NETWORK_STATE_CHAGNED has to be registered in UI thread. NotificationRegistrar registrar; - registrar.Add(this, NotificationType::NETWORK_STATE_CHANGED, + registrar.Add(this, chrome::NOTIFICATION_NETWORK_STATE_CHANGED, NotificationService::AllSources()); EXPECT_CALL(*mock_network_library_, Connected()) .Times(1) @@ -77,7 +78,7 @@ IN_PROC_BROWSER_TEST_F(NetworkStateNotifierTest, TestConnected) { IN_PROC_BROWSER_TEST_F(NetworkStateNotifierTest, TestConnecting) { NotificationRegistrar registrar; - registrar.Add(this, NotificationType::NETWORK_STATE_CHANGED, + registrar.Add(this, chrome::NOTIFICATION_NETWORK_STATE_CHANGED, NotificationService::AllSources()); EXPECT_CALL(*mock_network_library_, Connected()) .Times(1) @@ -95,7 +96,7 @@ IN_PROC_BROWSER_TEST_F(NetworkStateNotifierTest, TestConnecting) { IN_PROC_BROWSER_TEST_F(NetworkStateNotifierTest, TestDisconnected) { NotificationRegistrar registrar; - registrar.Add(this, NotificationType::NETWORK_STATE_CHANGED, + registrar.Add(this, chrome::NOTIFICATION_NETWORK_STATE_CHANGED, NotificationService::AllSources()); EXPECT_CALL(*mock_network_library_, Connected()) .Times(1) diff --git a/chrome/browser/chromeos/notifications/balloon_collection_impl.cc b/chrome/browser/chromeos/notifications/balloon_collection_impl.cc index c8415c1..dba581c 100644 --- a/chrome/browser/chromeos/notifications/balloon_collection_impl.cc +++ b/chrome/browser/chromeos/notifications/balloon_collection_impl.cc @@ -13,6 +13,7 @@ #include "chrome/browser/notifications/notification.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/window_sizer.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" @@ -29,7 +30,7 @@ namespace chromeos { BalloonCollectionImpl::BalloonCollectionImpl() : notification_ui_(new NotificationPanel()) { - registrar_.Add(this, NotificationType::BROWSER_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, NotificationService::AllSources()); } @@ -146,10 +147,10 @@ const BalloonCollectionImpl::Balloons& return base_.balloons(); } -void BalloonCollectionImpl::Observe(NotificationType type, +void BalloonCollectionImpl::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_CLOSED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSED); bool app_closing = *Details<bool>(details).ptr(); // When exiting, we need to shutdown all renderers in // BalloonViewImpl before IO thread gets deleted in the diff --git a/chrome/browser/chromeos/notifications/balloon_collection_impl.h b/chrome/browser/chromeos/notifications/balloon_collection_impl.h index 1f0fbbe..e4a6d81 100644 --- a/chrome/browser/chromeos/notifications/balloon_collection_impl.h +++ b/chrome/browser/chromeos/notifications/balloon_collection_impl.h @@ -72,7 +72,7 @@ class BalloonCollectionImpl : public BalloonCollection, virtual const Balloons& GetActiveBalloons(); // NotificationObserver overrides: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/notifications/balloon_view.cc b/chrome/browser/chromeos/notifications/balloon_view.cc index 82ecd30..078b55d 100644 --- a/chrome/browser/chromeos/notifications/balloon_view.cc +++ b/chrome/browser/chromeos/notifications/balloon_view.cc @@ -18,9 +18,9 @@ #include "chrome/browser/ui/views/notifications/balloon_view_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -227,7 +227,7 @@ void BalloonViewImpl::Show(Balloon* balloon) { html_contents_->EnableWebUI(); AddChildView(html_contents_->view()); notification_registrar_.Add(this, - NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon)); + chrome::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon)); } void BalloonViewImpl::Update() { @@ -298,10 +298,10 @@ gfx::Size BalloonViewImpl::GetPreferredSize() { //////////////////////////////////////////////////////////////////////////////// // NotificationObserver overrides. -void BalloonViewImpl::Observe(NotificationType type, +void BalloonViewImpl::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::NOTIFY_BALLOON_DISCONNECTED) { + if (type != chrome::NOTIFY_BALLOON_DISCONNECTED) { NOTREACHED(); return; } @@ -309,7 +309,7 @@ void BalloonViewImpl::Observe(NotificationType type, // If the renderer process attached to this balloon is disconnected // (e.g., because of a crash), we want to close the balloon. notification_registrar_.Remove(this, - NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); + chrome::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); Close(false); } diff --git a/chrome/browser/chromeos/notifications/balloon_view.h b/chrome/browser/chromeos/notifications/balloon_view.h index 5aa01a8..2f38f22 100644 --- a/chrome/browser/chromeos/notifications/balloon_view.h +++ b/chrome/browser/chromeos/notifications/balloon_view.h @@ -84,7 +84,7 @@ class BalloonViewImpl : public BalloonView, virtual gfx::Size GetPreferredSize(); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/notifications/notification_browsertest.cc b/chrome/browser/chromeos/notifications/notification_browsertest.cc index 6eb7ba3..6044df8 100644 --- a/chrome/browser/chromeos/notifications/notification_browsertest.cc +++ b/chrome/browser/chromeos/notifications/notification_browsertest.cc @@ -17,6 +17,7 @@ #include "chrome/browser/notifications/notification_test_util.h" #include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "content/common/notification_service.h" @@ -110,10 +111,10 @@ class NotificationTest : public InProcessBrowserTest, } // NotificationObserver overrides. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - ASSERT_TRUE(NotificationType::PANEL_STATE_CHANGED == type); + ASSERT_TRUE(chrome::NOTIFICATION_PANEL_STATE_CHANGED == type); PanelController::State* state = reinterpret_cast<PanelController::State*>(details.map_key()); state_ = *state; @@ -301,7 +302,7 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestStateTransition2) { // Register observer here as the registration does not work in SetUp(). NotificationRegistrar registrar; registrar.Add(this, - NotificationType::PANEL_STATE_CHANGED, + chrome::NOTIFICATION_PANEL_STATE_CHANGED, NotificationService::AllSources()); BalloonCollectionImpl* collection = GetBalloonCollectionImpl(); @@ -368,7 +369,7 @@ IN_PROC_BROWSER_TEST_F(NotificationTest, TestStateTransition2) { IN_PROC_BROWSER_TEST_F(NotificationTest, TestCleanupOnExit) { NotificationRegistrar registrar; registrar.Add(this, - NotificationType::PANEL_STATE_CHANGED, + chrome::NOTIFICATION_PANEL_STATE_CHANGED, NotificationService::AllSources()); BalloonCollectionImpl* collection = GetBalloonCollectionImpl(); diff --git a/chrome/browser/chromeos/notifications/notification_panel.cc b/chrome/browser/chromeos/notifications/notification_panel.cc index 169ac03..7bb6114 100644 --- a/chrome/browser/chromeos/notifications/notification_panel.cc +++ b/chrome/browser/chromeos/notifications/notification_panel.cc @@ -10,6 +10,7 @@ #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" #include "chrome/browser/chromeos/notifications/balloon_view.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" #include "grit/generated_resources.h" @@ -466,7 +467,7 @@ void NotificationPanel::Show() { panel_controller_->Init(false /* don't focus when opened */, gfx::Rect(0, 0, kBalloonMinWidth, 1), 0, WM_IPC_PANEL_USER_RESIZE_VERTICALLY); - registrar_.Add(this, NotificationType::PANEL_STATE_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_PANEL_STATE_CHANGED, Source<PanelController>(panel_controller_.get())); } panel_widget_->Show(); @@ -616,10 +617,10 @@ void NotificationPanel::ActivatePanel() { //////////////////////////////////////////////////////////////////////////////// // NotificationObserver overrides. -void NotificationPanel::Observe(NotificationType type, +void NotificationPanel::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::PANEL_STATE_CHANGED); + DCHECK(type == chrome::NOTIFICATION_PANEL_STATE_CHANGED); PanelController::State* state = reinterpret_cast<PanelController::State*>(details.map_key()); switch (*state) { @@ -687,7 +688,7 @@ void NotificationPanel::Init() { void NotificationPanel::UnregisterNotification() { if (panel_controller_.get()) - registrar_.Remove(this, NotificationType::PANEL_STATE_CHANGED, + registrar_.Remove(this, chrome::NOTIFICATION_PANEL_STATE_CHANGED, Source<PanelController>(panel_controller_.get())); } diff --git a/chrome/browser/chromeos/notifications/notification_panel.h b/chrome/browser/chromeos/notifications/notification_panel.h index 29aa93a..92385bc 100644 --- a/chrome/browser/chromeos/notifications/notification_panel.h +++ b/chrome/browser/chromeos/notifications/notification_panel.h @@ -105,7 +105,7 @@ class NotificationPanel : public PanelController::Delegate, virtual void ActivatePanel(); // NotificationObserver overrides: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/offline/offline_load_page.cc b/chrome/browser/chromeos/offline/offline_load_page.cc index ca37d49..389c689 100644 --- a/chrome/browser/chromeos/offline/offline_load_page.cc +++ b/chrome/browser/chromeos/offline/offline_load_page.cc @@ -17,6 +17,7 @@ #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/url_constants.h" @@ -24,8 +25,8 @@ #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -71,7 +72,7 @@ OfflineLoadPage::OfflineLoadPage(TabContents* tab_contents, proceeded_(false), ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), in_test_(false) { - registrar_.Add(this, NotificationType::NETWORK_STATE_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_NETWORK_STATE_CHANGED, NotificationService::AllSources()); } @@ -198,17 +199,17 @@ void OfflineLoadPage::DontProceed() { InterstitialPage::DontProceed(); } -void OfflineLoadPage::Observe(NotificationType type, +void OfflineLoadPage::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::NETWORK_STATE_CHANGED) { + if (type == chrome::NOTIFICATION_NETWORK_STATE_CHANGED) { chromeos::NetworkStateDetails* state_details = Details<chromeos::NetworkStateDetails>(details).ptr(); DVLOG(1) << "NetworkStateChanaged notification received: state=" << state_details->state(); if (state_details->state() == chromeos::NetworkStateDetails::CONNECTED) { - registrar_.Remove(this, NotificationType::NETWORK_STATE_CHANGED, + registrar_.Remove(this, chrome::NOTIFICATION_NETWORK_STATE_CHANGED, NotificationService::AllSources()); Proceed(); } diff --git a/chrome/browser/chromeos/offline/offline_load_page.h b/chrome/browser/chromeos/offline/offline_load_page.h index dbd0412..08a8ba5 100644 --- a/chrome/browser/chromeos/offline/offline_load_page.h +++ b/chrome/browser/chromeos/offline/offline_load_page.h @@ -61,7 +61,7 @@ class OfflineLoadPage : public ChromeInterstitialPage { virtual void DontProceed(); // Overrides ChromeInterstitialPage's Observe. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/options/take_photo_dialog.cc b/chrome/browser/chromeos/options/take_photo_dialog.cc index 6f1eb4e..3be00bc 100644 --- a/chrome/browser/chromeos/options/take_photo_dialog.cc +++ b/chrome/browser/chromeos/options/take_photo_dialog.cc @@ -8,8 +8,8 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/login/helper.h" #include "chrome/browser/chromeos/login/user_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -34,7 +34,7 @@ TakePhotoDialog::TakePhotoDialog() camera_controller_.set_frame_height(kFrameHeight); registrar_.Add( this, - NotificationType::SCREEN_LOCK_STATE_CHANGED, + chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, NotificationService::AllSources()); } @@ -109,10 +109,10 @@ void TakePhotoDialog::OnCaptureFailure() { take_photo_view_->ShowCameraError(); } -void TakePhotoDialog::Observe(NotificationType type, +void TakePhotoDialog::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::SCREEN_LOCK_STATE_CHANGED) + if (type != chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED) return; bool is_screen_locked = *Details<bool>(details).ptr(); diff --git a/chrome/browser/chromeos/options/take_photo_dialog.h b/chrome/browser/chromeos/options/take_photo_dialog.h index 9eeb992..9cecd71 100644 --- a/chrome/browser/chromeos/options/take_photo_dialog.h +++ b/chrome/browser/chromeos/options/take_photo_dialog.h @@ -49,7 +49,7 @@ class TakePhotoDialog : public views::DialogDelegateView, virtual void OnCaptureFailure(); // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/panels/panel_browsertest.cc b/chrome/browser/chromeos/panels/panel_browsertest.cc index 35c8d7c..d30332a 100644 --- a/chrome/browser/chromeos/panels/panel_browsertest.cc +++ b/chrome/browser/chromeos/panels/panel_browsertest.cc @@ -45,7 +45,7 @@ IN_PROC_BROWSER_TEST_F(PanelTest, PanelOpenSmall) { browser()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::TYPED); // Wait for notification that window.open has been processed. - ui_test_utils::WaitForNotification(NotificationType::TAB_ADDED); + ui_test_utils::WaitForNotification(content::NOTIFICATION_TAB_ADDED); // Find the new browser. Browser* new_browser = NULL; @@ -84,7 +84,7 @@ IN_PROC_BROWSER_TEST_F(PanelTest, PanelOpenLarge) { browser()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::TYPED); // Wait for notification that window.open has been processed. - ui_test_utils::WaitForNotification(NotificationType::TAB_ADDED); + ui_test_utils::WaitForNotification(content::NOTIFICATION_TAB_ADDED); // Shouldn't find a new browser. Browser* new_browser = NULL; diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index b2c9e70..9a277cf 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -18,10 +18,10 @@ #include "chrome/browser/chromeos/login/login_utils.h" #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "unicode/timezone.h" namespace chromeos { @@ -264,10 +264,10 @@ void Preferences::Init(PrefService* prefs) { } } -void Preferences::Observe(NotificationType type, +void Preferences::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) + if (type == chrome::NOTIFICATION_PREF_CHANGED) NotifyPrefChanged(Details<std::string>(details).ptr()); } diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h index bf97ac9..11a554a 100644 --- a/chrome/browser/chromeos/preferences.h +++ b/chrome/browser/chromeos/preferences.h @@ -33,7 +33,7 @@ class Preferences : public NotificationObserver { void Init(PrefService* prefs); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/status/clock_menu_button.cc b/chrome/browser/chromeos/status/clock_menu_button.cc index 5880b0b..3828bb6 100644 --- a/chrome/browser/chromeos/status/clock_menu_button.cc +++ b/chrome/browser/chromeos/status/clock_menu_button.cc @@ -12,6 +12,7 @@ #include "chrome/browser/chromeos/status/status_area_host.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -98,10 +99,10 @@ void ClockMenuButton::UpdateText() { // ClockMenuButton, NotificationObserver implementation: -void ClockMenuButton::Observe(NotificationType type, +void ClockMenuButton::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kUse24HourClock) { UpdateText(); diff --git a/chrome/browser/chromeos/status/clock_menu_button.h b/chrome/browser/chromeos/status/clock_menu_button.h index d6fd4ee..7864b97 100644 --- a/chrome/browser/chromeos/status/clock_menu_button.h +++ b/chrome/browser/chromeos/status/clock_menu_button.h @@ -12,8 +12,8 @@ #include "chrome/browser/chromeos/status/status_area_button.h" #include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/browser/prefs/pref_member.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" -#include "content/common/notification_type.h" #include "chrome/browser/chromeos/system/timezone_settings.h" #include "unicode/calendar.h" #include "views/controls/button/menu_button.h" @@ -60,7 +60,7 @@ class ClockMenuButton : public StatusAreaButton, void UpdateText(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/status/input_method_menu.cc b/chrome/browser/chromeos/status/input_method_menu.cc index 20bd54e..2e7f7bb 100644 --- a/chrome/browser/chromeos/status/input_method_menu.cc +++ b/chrome/browser/chromeos/status/input_method_menu.cc @@ -15,6 +15,7 @@ #include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/language_preferences.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/user_metrics.h" #include "content/common/notification_service.h" @@ -162,7 +163,7 @@ InputMethodMenu::InputMethodMenu(PrefService* pref_service, if (screen_mode_ == StatusAreaHost::kLoginMode) { // This button is for the login screen. registrar_.Add(this, - NotificationType::LOGIN_USER_CHANGED, + chrome::NOTIFICATION_LOGIN_USER_CHANGED, NotificationService::AllSources()); } } @@ -677,10 +678,10 @@ void InputMethodMenu::RegisterPrefs(PrefService* local_state) { PrefService::UNSYNCABLE_PREF); } -void InputMethodMenu::Observe(NotificationType type, +void InputMethodMenu::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::LOGIN_USER_CHANGED) { + if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) { // When a user logs in, we should remove |this| object from the observer // list so that PreferenceUpdateNeeded() does not update the local state // anymore. diff --git a/chrome/browser/chromeos/status/input_method_menu.h b/chrome/browser/chromeos/status/input_method_menu.h index 22dbb15..be736d9 100644 --- a/chrome/browser/chromeos/status/input_method_menu.h +++ b/chrome/browser/chromeos/status/input_method_menu.h @@ -11,9 +11,9 @@ #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/chromeos/status/status_area_host.h" #include "chrome/browser/prefs/pref_member.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" #include "ui/base/models/menu_model.h" #include "views/controls/menu/menu_item_view.h" #include "views/controls/menu/view_menu_delegate.h" @@ -89,7 +89,7 @@ class InputMethodMenu : public views::ViewMenuDelegate, virtual void FirstObserverIsAdded(input_method::InputMethodManager* manager); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/chromeos/tab_closeable_state_watcher.cc b/chrome/browser/chromeos/tab_closeable_state_watcher.cc index 408c766..a45a0d6c 100644 --- a/chrome/browser/chromeos/tab_closeable_state_watcher.cc +++ b/chrome/browser/chromeos/tab_closeable_state_watcher.cc @@ -9,6 +9,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" #include "content/browser/tab_contents/tab_contents.h" @@ -70,7 +71,7 @@ TabCloseableStateWatcher::TabCloseableStateWatcher() switches::kGuestSession)), waiting_for_browser_(false) { BrowserList::AddObserver(this); - notification_registrar_.Add(this, NotificationType::APP_EXITING, + notification_registrar_.Add(this, content::NOTIFICATION_APP_EXITING, NotificationService::AllSources()); } @@ -187,9 +188,9 @@ void TabCloseableStateWatcher::OnBrowserRemoved(const Browser* browser) { //////////////////////////////////////////////////////////////////////////////// // TabCloseableStateWatcher, NotificationObserver implementation: -void TabCloseableStateWatcher::Observe(NotificationType type, +void TabCloseableStateWatcher::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value != NotificationType::APP_EXITING) + if (type != content::NOTIFICATION_APP_EXITING) NOTREACHED(); if (!signing_off_) { signing_off_ = true; @@ -260,7 +261,7 @@ void TabCloseableStateWatcher::SetCloseableState(bool closeable) { // Notify of change in tab closeable state. NotificationService::current()->Notify( - NotificationType::TAB_CLOSEABLE_STATE_CHANGED, + chrome::NOTIFICATION_TAB_CLOSEABLE_STATE_CHANGED, NotificationService::AllSources(), Details<bool>(&can_close_tab_)); } diff --git a/chrome/browser/chromeos/tab_closeable_state_watcher.h b/chrome/browser/chromeos/tab_closeable_state_watcher.h index b1d448f..7a1f0c2 100644 --- a/chrome/browser/chromeos/tab_closeable_state_watcher.h +++ b/chrome/browser/chromeos/tab_closeable_state_watcher.h @@ -65,7 +65,7 @@ class TabCloseableStateWatcher : public ::TabCloseableStateWatcher, virtual void OnBrowserRemoved(const Browser* browser); // NotificationObserver implementation: - virtual void Observe(NotificationType type, const NotificationSource& source, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); // Called by private class TabStripWatcher for TabStripModelObserver diff --git a/chrome/browser/chromeos/web_socket_proxy.cc b/chrome/browser/chromeos/web_socket_proxy.cc index eabb827..b088b60 100644 --- a/chrome/browser/chromeos/web_socket_proxy.cc +++ b/chrome/browser/chromeos/web_socket_proxy.cc @@ -31,9 +31,10 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "chrome/browser/internal_auth.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "content/common/url_constants.h" #include "googleurl/src/gurl.h" #include "third_party/libevent/evdns.h" @@ -153,7 +154,7 @@ inline size_t strlen(const uint8* s) { void SendNotification() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); NotificationService::current()->Notify( - NotificationType::WEB_SOCKET_PROXY_STARTED, + chrome::NOTIFICATION_WEB_SOCKET_PROXY_STARTED, NotificationService::AllSources(), NotificationService::NoDetails()); } diff --git a/chrome/browser/chromeos/wm_ipc.cc b/chrome/browser/chromeos/wm_ipc.cc index e107640..668327a 100644 --- a/chrome/browser/chromeos/wm_ipc.cc +++ b/chrome/browser/chromeos/wm_ipc.cc @@ -13,6 +13,7 @@ extern "C" { #include "base/lazy_instance.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "ui/base/x/x11_util.h" #include "ui/gfx/rect.h" @@ -303,7 +304,7 @@ void WmIpc::FetchLayoutModeProperty() { &value)) { layout_mode_ = static_cast<WmIpcLayoutMode>(value); NotificationService::current()->Notify( - NotificationType::LAYOUT_MODE_CHANGED, + chrome::NOTIFICATION_LAYOUT_MODE_CHANGED, Source<WmIpc>(this), Details<WmIpcLayoutMode>(&layout_mode_)); } else { diff --git a/chrome/browser/content_settings/content_settings_extension_provider.cc b/chrome/browser/content_settings/content_settings_extension_provider.cc index 703edd8..9dcf9ae 100644 --- a/chrome/browser/content_settings/content_settings_extension_provider.cc +++ b/chrome/browser/content_settings/content_settings_extension_provider.cc @@ -7,6 +7,7 @@ #include "chrome/browser/content_settings/content_settings_details.h" #include "chrome/browser/extensions/extension_content_settings_store.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" @@ -60,7 +61,7 @@ void ExtensionProvider::NotifyObservers( const ContentSettingsDetails& details) { DCHECK(map_); NotificationService::current()->Notify( - NotificationType::CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, Source<HostContentSettingsMap>(map_), Details<const ContentSettingsDetails>(&details)); } diff --git a/chrome/browser/content_settings/content_settings_notification_provider.cc b/chrome/browser/content_settings/content_settings_notification_provider.cc index cff1716..1c71b4a 100644 --- a/chrome/browser/content_settings/content_settings_notification_provider.cc +++ b/chrome/browser/content_settings/content_settings_notification_provider.cc @@ -13,11 +13,11 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/content_settings_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" namespace { @@ -156,13 +156,13 @@ void NotificationProvider::ClearAllContentSettingsRules( ResetAllOrigins(); } -void NotificationProvider::Observe(NotificationType type, +void NotificationProvider::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (NotificationType::PREF_CHANGED == type) { + if (chrome::NOTIFICATION_PREF_CHANGED == type) { const std::string& name = *Details<std::string>(details).ptr(); OnPrefsChanged(name); - } else if (NotificationType::PROFILE_DESTROYED == type) { + } else if (chrome::NOTIFICATION_PROFILE_DESTROYED == type) { StopObserving(); } } @@ -178,11 +178,11 @@ void NotificationProvider::StartObserving() { prefs_registrar_.Add(prefs::kDesktopNotificationAllowedOrigins, this); prefs_registrar_.Add(prefs::kDesktopNotificationDeniedOrigins, this); - notification_registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + notification_registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); } - notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); } @@ -207,7 +207,7 @@ void NotificationProvider::NotifySettingsChange() { // notification, and use the HostContentSettingsMap as source once this // content settings provider in integrated in the HostContentSetttingsMap. NotificationService::current()->Notify( - NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, + chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED, Source<DesktopNotificationService>( DesktopNotificationServiceFactory::GetForProfile(profile_)), NotificationService::NoDetails()); diff --git a/chrome/browser/content_settings/content_settings_notification_provider.h b/chrome/browser/content_settings/content_settings_notification_provider.h index 5c8ec10..69055f8 100644 --- a/chrome/browser/content_settings/content_settings_notification_provider.h +++ b/chrome/browser/content_settings/content_settings_notification_provider.h @@ -56,7 +56,7 @@ class NotificationProvider : public ProviderInterface, ContentSettingsType content_type); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: diff --git a/chrome/browser/content_settings/content_settings_policy_provider.cc b/chrome/browser/content_settings/content_settings_policy_provider.cc index 430c123..ace204a 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider.cc +++ b/chrome/browser/content_settings/content_settings_policy_provider.cc @@ -14,6 +14,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" @@ -122,7 +123,7 @@ PolicyDefaultProvider::PolicyDefaultProvider(Profile* profile) pref_change_registrar_.Add(prefs::kManagedDefaultJavaScriptSetting, this); pref_change_registrar_.Add(prefs::kManagedDefaultPluginsSetting, this); pref_change_registrar_.Add(prefs::kManagedDefaultPopupsSetting, this); - notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); } @@ -152,12 +153,12 @@ bool PolicyDefaultProvider::DefaultSettingIsManaged( } } -void PolicyDefaultProvider::Observe(NotificationType type, +void PolicyDefaultProvider::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { DCHECK_EQ(profile_->GetPrefs(), Source<PrefService>(source).ptr()); std::string* name = Details<std::string>(details).ptr(); if (*name == prefs::kManagedDefaultCookiesSetting) { @@ -182,7 +183,7 @@ void PolicyDefaultProvider::Observe(NotificationType type, std::string()); NotifyObservers(details); } - } else if (type == NotificationType::PROFILE_DESTROYED) { + } else if (type == chrome::NOTIFICATION_PROFILE_DESTROYED) { DCHECK_EQ(profile_, Source<Profile>(source).ptr()); UnregisterObservers(); } else { @@ -195,7 +196,7 @@ void PolicyDefaultProvider::UnregisterObservers() { if (!profile_) return; pref_change_registrar_.RemoveAll(); - notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Remove(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); profile_ = NULL; } @@ -207,7 +208,7 @@ void PolicyDefaultProvider::NotifyObservers( if (profile_ == NULL) return; NotificationService::current()->Notify( - NotificationType::CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, Source<HostContentSettingsMap>(profile_->GetHostContentSettingsMap()), Details<const ContentSettingsDetails>(&details)); } @@ -316,7 +317,7 @@ void PolicyProvider::Init() { pref_change_registrar_.Add(prefs::kManagedPopupsBlockedForUrls, this); pref_change_registrar_.Add(prefs::kManagedPopupsAllowedForUrls, this); - notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); } @@ -447,7 +448,7 @@ void PolicyProvider::UnregisterObservers() { if (!profile_) return; pref_change_registrar_.RemoveAll(); - notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Remove(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); profile_ = NULL; } @@ -458,17 +459,17 @@ void PolicyProvider::NotifyObservers( if (profile_ == NULL) return; NotificationService::current()->Notify( - NotificationType::CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, Source<HostContentSettingsMap>(profile_->GetHostContentSettingsMap()), Details<const ContentSettingsDetails>(&details)); } -void PolicyProvider::Observe(NotificationType type, +void PolicyProvider::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { DCHECK_EQ(profile_->GetPrefs(), Source<PrefService>(source).ptr()); std::string* name = Details<std::string>(details).ptr(); if (*name == prefs::kManagedCookiesAllowedForUrls || @@ -489,7 +490,7 @@ void PolicyProvider::Observe(NotificationType type, std::string()); NotifyObservers(details); } - } else if (type == NotificationType::PROFILE_DESTROYED) { + } else if (type == chrome::NOTIFICATION_PROFILE_DESTROYED) { DCHECK_EQ(profile_, Source<Profile>(source).ptr()); UnregisterObservers(); } else { diff --git a/chrome/browser/content_settings/content_settings_policy_provider.h b/chrome/browser/content_settings/content_settings_policy_provider.h index 4ee045a..a992c51 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider.h +++ b/chrome/browser/content_settings/content_settings_policy_provider.h @@ -42,7 +42,7 @@ class PolicyDefaultProvider : public DefaultProviderInterface, static void RegisterUserPrefs(PrefService* prefs); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -113,7 +113,7 @@ class PolicyProvider : public ProviderInterface, ContentSettingsType content_type); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc index a1b21e6..56ac49b 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider.cc @@ -17,6 +17,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings.h" #include "chrome/common/pref_names.h" @@ -172,7 +173,7 @@ PrefDefaultProvider::PrefDefaultProvider(Profile* profile) pref_change_registrar_.Init(prefs); pref_change_registrar_.Add(prefs::kDefaultContentSettings, this); - notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); initializing_ = false; } @@ -233,12 +234,12 @@ bool PrefDefaultProvider::DefaultSettingIsManaged( return false; } -void PrefDefaultProvider::Observe(NotificationType type, +void PrefDefaultProvider::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { DCHECK_EQ(profile_->GetPrefs(), Source<PrefService>(source).ptr()); if (updating_preferences_) return; @@ -258,7 +259,7 @@ void PrefDefaultProvider::Observe(NotificationType type, std::string()); NotifyObservers(details); } - } else if (type == NotificationType::PROFILE_DESTROYED) { + } else if (type == chrome::NOTIFICATION_PROFILE_DESTROYED) { DCHECK_EQ(profile_, Source<Profile>(source).ptr()); UnregisterObservers(); } else { @@ -271,7 +272,7 @@ void PrefDefaultProvider::UnregisterObservers() { if (!profile_) return; pref_change_registrar_.RemoveAll(); - notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Remove(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); profile_ = NULL; } @@ -337,7 +338,7 @@ void PrefDefaultProvider::NotifyObservers( if (initializing_ || profile_ == NULL) return; NotificationService::current()->Notify( - NotificationType::CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, Source<HostContentSettingsMap>(profile_->GetHostContentSettingsMap()), Details<const ContentSettingsDetails>(&details)); } @@ -433,7 +434,7 @@ void PrefProvider::Init() { pref_change_registrar_.Add(prefs::kContentSettingsPatterns, this); pref_change_registrar_.Add(prefs::kContentSettingsPatternPairs, this); - notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); initializing_ = false; } @@ -575,12 +576,12 @@ void PrefProvider::ClearAllContentSettingsRules( } void PrefProvider::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { DCHECK_EQ(profile_->GetPrefs(), Source<PrefService>(source).ptr()); if (updating_preferences_) return; @@ -606,7 +607,7 @@ void PrefProvider::Observe( std::string()); NotifyObservers(details); } - } else if (type == NotificationType::PROFILE_DESTROYED) { + } else if (type == chrome::NOTIFICATION_PROFILE_DESTROYED) { DCHECK_EQ(profile_, Source<Profile>(source).ptr()); UnregisterObservers(); } else { @@ -923,7 +924,7 @@ void PrefProvider::NotifyObservers( if (initializing_ || profile_ == NULL) return; NotificationService::current()->Notify( - NotificationType::CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, Source<HostContentSettingsMap>( profile_->GetHostContentSettingsMap()), Details<const ContentSettingsDetails>(&details)); @@ -934,7 +935,7 @@ void PrefProvider::UnregisterObservers() { if (!profile_) return; pref_change_registrar_.RemoveAll(); - notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Remove(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); profile_ = NULL; } diff --git a/chrome/browser/content_settings/content_settings_pref_provider.h b/chrome/browser/content_settings/content_settings_pref_provider.h index c847923..89d1e93 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.h +++ b/chrome/browser/content_settings/content_settings_pref_provider.h @@ -46,7 +46,7 @@ class PrefDefaultProvider : public DefaultProviderInterface, static void RegisterUserPrefs(PrefService* prefs); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -130,7 +130,7 @@ class PrefProvider : public ProviderInterface, ContentSettingsType content_type); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc index 7ccaa6f..f8c3484 100644 --- a/chrome/browser/content_settings/host_content_settings_map.cc +++ b/chrome/browser/content_settings/host_content_settings_map.cc @@ -18,6 +18,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -25,7 +26,6 @@ #include "content/browser/user_metrics.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" #include "net/base/net_util.h" @@ -123,7 +123,7 @@ HostContentSettingsMap::HostContentSettingsMap(Profile* profile) pref_change_registrar_.Init(prefs); pref_change_registrar_.Add(prefs::kBlockThirdPartyCookies, this); - notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); } @@ -446,12 +446,12 @@ void HostContentSettingsMap::SetBlockThirdPartyCookies(bool block) { profile_->GetPrefs()->SetBoolean(prefs::kBlockThirdPartyCookies, block); } -void HostContentSettingsMap::Observe(NotificationType type, +void HostContentSettingsMap::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { DCHECK_EQ(profile_->GetPrefs(), Source<PrefService>(source).ptr()); if (updating_preferences_) return; @@ -468,7 +468,7 @@ void HostContentSettingsMap::Observe(NotificationType type, NOTREACHED() << "Unexpected preference observed"; return; } - } else if (type == NotificationType::PROFILE_DESTROYED) { + } else if (type == chrome::NOTIFICATION_PROFILE_DESTROYED) { DCHECK_EQ(profile_, Source<Profile>(source).ptr()); UnregisterObservers(); } else { @@ -504,7 +504,7 @@ void HostContentSettingsMap::UnregisterObservers() { if (!profile_) return; pref_change_registrar_.RemoveAll(); - notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Remove(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); profile_ = NULL; } diff --git a/chrome/browser/content_settings/host_content_settings_map.h b/chrome/browser/content_settings/host_content_settings_map.h index 63f59b0..f3046ad 100644 --- a/chrome/browser/content_settings/host_content_settings_map.h +++ b/chrome/browser/content_settings/host_content_settings_map.h @@ -189,7 +189,7 @@ class HostContentSettingsMap void ShutdownOnUIThread(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/content_settings/mock_settings_observer.cc b/chrome/browser/content_settings/mock_settings_observer.cc index b968f3f..0098b18 100644 --- a/chrome/browser/content_settings/mock_settings_observer.cc +++ b/chrome/browser/content_settings/mock_settings_observer.cc @@ -6,18 +6,19 @@ #include "chrome/browser/content_settings/content_settings_details.h" #include "chrome/browser/content_settings/host_content_settings_map.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" #include "googleurl/src/gurl.h" MockSettingsObserver::MockSettingsObserver() { - registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, NotificationService::AllSources()); } MockSettingsObserver::~MockSettingsObserver() {} -void MockSettingsObserver::Observe(NotificationType type, +void MockSettingsObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { HostContentSettingsMap* map = diff --git a/chrome/browser/content_settings/mock_settings_observer.h b/chrome/browser/content_settings/mock_settings_observer.h index d96c6f7..c0a2231 100644 --- a/chrome/browser/content_settings/mock_settings_observer.h +++ b/chrome/browser/content_settings/mock_settings_observer.h @@ -19,7 +19,7 @@ class MockSettingsObserver : public NotificationObserver { MockSettingsObserver(); virtual ~MockSettingsObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc index 246d85f..4f6d303 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings.cc @@ -17,6 +17,7 @@ #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/cookies_tree_model.h" #include "chrome/browser/profiles/profile.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" @@ -54,7 +55,7 @@ TabSpecificContentSettings::TabSpecificContentSettings(TabContents* tab) ClearCookieSpecificContentSettings(); g_tab_specific.Get().push_back(this); - registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, Source<HostContentSettingsMap>( tab->profile()->GetHostContentSettingsMap())); } @@ -213,7 +214,7 @@ void TabSpecificContentSettings::OnContentBlocked( content_blocked_[type] = true; // TODO: it would be nice to have a way of mocking this in tests. NotificationService::current()->Notify( - NotificationType::TAB_CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED, Source<TabContents>(tab_contents()), NotificationService::NoDetails()); } @@ -225,7 +226,7 @@ void TabSpecificContentSettings::OnContentAccessed(ContentSettingsType type) { if (!content_accessed_[type]) { content_accessed_[type] = true; NotificationService::current()->Notify( - NotificationType::TAB_CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED, Source<TabContents>(tab_contents()), NotificationService::NoDetails()); } @@ -351,7 +352,7 @@ void TabSpecificContentSettings::OnGeolocationPermissionSet( geolocation_settings_state_.OnGeolocationPermissionSet(requesting_origin, allowed); NotificationService::current()->Notify( - NotificationType::TAB_CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED, Source<TabContents>(tab_contents()), NotificationService::NoDetails()); } @@ -367,7 +368,7 @@ void TabSpecificContentSettings::ClearBlockedContentSettingsExceptForCookies() { } load_plugins_link_enabled_ = true; NotificationService::current()->Notify( - NotificationType::TAB_CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED, Source<TabContents>(tab_contents()), NotificationService::NoDetails()); } @@ -379,7 +380,7 @@ void TabSpecificContentSettings::ClearCookieSpecificContentSettings() { content_accessed_[CONTENT_SETTINGS_TYPE_COOKIES] = false; content_blockage_indicated_to_user_[CONTENT_SETTINGS_TYPE_COOKIES] = false; NotificationService::current()->Notify( - NotificationType::TAB_CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED, Source<TabContents>(tab_contents()), NotificationService::NoDetails()); } @@ -388,7 +389,7 @@ void TabSpecificContentSettings::SetPopupsBlocked(bool blocked) { content_blocked_[CONTENT_SETTINGS_TYPE_POPUPS] = blocked; content_blockage_indicated_to_user_[CONTENT_SETTINGS_TYPE_POPUPS] = false; NotificationService::current()->Notify( - NotificationType::TAB_CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED, Source<TabContents>(tab_contents()), NotificationService::NoDetails()); } @@ -456,10 +457,10 @@ void TabSpecificContentSettings::DidStartProvisionalLoadForFrame( ClearGeolocationContentSettings(); } -void TabSpecificContentSettings::Observe(NotificationType type, +void TabSpecificContentSettings::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type.value == NotificationType::CONTENT_SETTINGS_CHANGED); + DCHECK(type == chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED); Details<const ContentSettingsDetails> settings_details(details); const NavigationController& controller = tab_contents()->controller(); diff --git a/chrome/browser/content_settings/tab_specific_content_settings.h b/chrome/browser/content_settings/tab_specific_content_settings.h index b862dc5..1750211 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.h +++ b/chrome/browser/content_settings/tab_specific_content_settings.h @@ -247,7 +247,7 @@ class TabSpecificContentSettings : public TabContentsObserver, void OnContentAccessed(ContentSettingsType type); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc index 26afa29..cc6bb5c 100644 --- a/chrome/browser/cookies_tree_model_unittest.cc +++ b/chrome/browser/cookies_tree_model_unittest.cc @@ -14,8 +14,8 @@ #include "chrome/browser/mock_browsing_data_indexed_db_helper.h" #include "chrome/browser/mock_browsing_data_local_storage_helper.h" #include "chrome/test/testing_profile.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" -#include "content/common/notification_type.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc index 58e4f31..f942aed 100644 --- a/chrome/browser/crash_recovery_browsertest.cc +++ b/chrome/browser/crash_recovery_browsertest.cc @@ -8,7 +8,7 @@ #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "content/browser/tab_contents/navigation_entry.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #include "content/common/page_transition_types.h" #include "testing/gtest/include/gtest/gtest.h" @@ -19,7 +19,7 @@ void SimulateRendererCrash(Browser* browser) { PageTransition::TYPED); LOG(ERROR) << "SimulateRendererCrash, before WaitForNotification"; ui_test_utils::WaitForNotification( - NotificationType::TAB_CONTENTS_DISCONNECTED); + content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED); LOG(ERROR) << "SimulateRendererCrash, after WaitForNotification"; } diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc index 7c7504b..bc20774 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc @@ -15,6 +15,7 @@ #include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile_io_data.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" @@ -476,7 +477,7 @@ int ProtocolHandlerRegistry::GetHandlerIndex(const std::string& scheme) const { void ProtocolHandlerRegistry::NotifyChanged() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); NotificationService::current()->Notify( - NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED, + chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, Source<Profile>(profile_), NotificationService::NoDetails()); } diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index c628262..93a7ba8 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc @@ -12,6 +12,7 @@ #include "base/task.h" #include "base/utf_string_conversions.h" #include "chrome/browser/custom_handlers/protocol_handler.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/testing_browser_process.h" #include "chrome/test/testing_browser_process_test.h" #include "chrome/test/testing_pref_service.h" @@ -67,20 +68,20 @@ class NotificationCounter : public NotificationObserver { : events_(0), notification_registrar_() { notification_registrar_.Add(this, - NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED, + chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, NotificationService::AllSources()); } ~NotificationCounter() { notification_registrar_.Remove(this, - NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED, + chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, NotificationService::AllSources()); } int events() { return events_; } bool notified() { return events_ > 0; } void Clear() { events_ = 0; } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { ++events_; @@ -97,11 +98,11 @@ class QueryProtocolHandlerOnChange : public NotificationObserver { called_(false), notification_registrar_() { notification_registrar_.Add(this, - NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED, + chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, NotificationService::AllSources()); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { std::vector<std::string> output; diff --git a/chrome/browser/default_plugin_uitest.cc b/chrome/browser/default_plugin_uitest.cc index 594b718..5c61531 100644 --- a/chrome/browser/default_plugin_uitest.cc +++ b/chrome/browser/default_plugin_uitest.cc @@ -17,7 +17,7 @@ class DefaultPluginUITest : public UITest { }; #if defined(OS_WIN) -#define MAYBE_DefaultPluginLoadTest DISABLED_DefaultPluginLoadTest +#define MAYBE_DefaultPluginLoadTest DefaultPluginLoadTest #else #define MAYBE_DefaultPluginLoadTest DefaultPluginLoadTest #endif 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(); } diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc index cf6f697..6d1c290 100644 --- a/chrome/browser/enumerate_modules_model_win.cc +++ b/chrome/browser/enumerate_modules_model_win.cc @@ -24,6 +24,7 @@ #include "crypto/sha2.h" #include "chrome/browser/net/service_providers_win.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -770,7 +771,7 @@ void EnumerateModulesModel::AcknowledgeConflictNotification() { if (!conflict_notification_acknowledged_) { conflict_notification_acknowledged_ = true; NotificationService::current()->Notify( - NotificationType::MODULE_INCOMPATIBILITY_BADGE_CHANGE, + chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, Source<EnumerateModulesModel>(this), NotificationService::NoDetails()); } @@ -925,7 +926,7 @@ void EnumerateModulesModel::DoneScanning() { return; NotificationService::current()->Notify( - NotificationType::MODULE_LIST_ENUMERATED, + chrome::NOTIFICATION_MODULE_LIST_ENUMERATED, Source<EnumerateModulesModel>(this), NotificationService::NoDetails()); @@ -937,7 +938,7 @@ void EnumerateModulesModel::DoneScanning() { return; NotificationService::current()->Notify( - NotificationType::MODULE_INCOMPATIBILITY_BADGE_CHANGE, + chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, Source<EnumerateModulesModel>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/extensions/browser_action_apitest.cc b/chrome/browser/extensions/browser_action_apitest.cc index e9a970b..fee47f7 100644 --- a/chrome/browser/extensions/browser_action_apitest.cc +++ b/chrome/browser/extensions/browser_action_apitest.cc @@ -16,6 +16,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/url_constants.h" #include "chrome/test/ui_test_utils.h" @@ -37,7 +38,7 @@ class BrowserActionApiTest : public ExtensionApiTest { ResultCatcher catcher; GetBrowserActionsBar().Press(index); ui_test_utils::WaitForNotification( - NotificationType::EXTENSION_POPUP_VIEW_READY); + chrome::NOTIFICATION_EXTENSION_POPUP_VIEW_READY); EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); return GetBrowserActionsBar().HasPopup(); } diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc index 6221bbe..36a0269 100644 --- a/chrome/browser/extensions/content_script_apitest.cc +++ b/chrome/browser/extensions/content_script_apitest.cc @@ -6,6 +6,7 @@ #include "chrome/browser/extensions/extension_service.h" #include "content/browser/tab_contents/tab_contents.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/ui_test_utils.h" #include "googleurl/src/gurl.h" @@ -69,7 +70,7 @@ IN_PROC_BROWSER_TEST_F( ASSERT_TRUE(StartTestServer()); ui_test_utils::WindowedNotificationObserver signal( - NotificationType::USER_SCRIPTS_UPDATED, + chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, Source<Profile>(browser()->profile())); // Start with a renderer already open at a URL. diff --git a/chrome/browser/extensions/convert_web_app_browsertest.cc b/chrome/browser/extensions/convert_web_app_browsertest.cc index e923e90..a8405b1 100644 --- a/chrome/browser/extensions/convert_web_app_browsertest.cc +++ b/chrome/browser/extensions/convert_web_app_browsertest.cc @@ -10,11 +10,11 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/in_process_browser_test.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/ui_test_utils.h" #include "content/common/notification_details.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" class ExtensionFromWebAppTest : public InProcessBrowserTest, public NotificationObserver { @@ -32,10 +32,10 @@ class ExtensionFromWebAppTest } // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::EXTENSION_INSTALLED) { + if (type == chrome::NOTIFICATION_EXTENSION_INSTALLED) { const Extension* extension = Details<const Extension>(details).ptr(); if (extension->id() == expected_extension_id_) { installed_extension_ = extension; @@ -51,7 +51,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionFromWebAppTest, Basic) { false); NotificationRegistrar registrar; - registrar.Add(this, NotificationType::EXTENSION_INSTALLED, + registrar.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, NotificationService::AllSources()); expected_extension_id_ = "fnpgoaochgbdfjndakichfafiocjjpmm"; diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 16490c7..3581571 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -26,12 +26,12 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/web_applications/web_app.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_file_util.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -438,7 +438,7 @@ void CrxInstaller::InstallUIAbort(bool user_initiated) { // Kill the theme loading bubble. NotificationService* service = NotificationService::current(); - service->Notify(NotificationType::NO_THEME_DETECTED, + service->Notify(chrome::NOTIFICATION_NO_THEME_DETECTED, Source<CrxInstaller>(this), NotificationService::NoDetails()); Release(); // balanced in ConfirmInstall(). @@ -511,7 +511,7 @@ void CrxInstaller::ReportFailureFromUIThread(const std::string& error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); NotificationService* service = NotificationService::current(); - service->Notify(NotificationType::EXTENSION_INSTALL_ERROR, + service->Notify(chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, Source<CrxInstaller>(this), Details<const std::string>(&error)); @@ -572,7 +572,7 @@ void CrxInstaller::NotifyCrxInstallComplete() { // extension before it is unpacked, so they can not filter based // on the extension. NotificationService::current()->Notify( - NotificationType::CRX_INSTALLER_DONE, + chrome::NOTIFICATION_CRX_INSTALLER_DONE, Source<CrxInstaller>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/extensions/extension_accessibility_api.cc b/chrome/browser/extensions/extension_accessibility_api.cc index cc694d1..6b00cc8 100644 --- a/chrome/browser/extensions/extension_accessibility_api.cc +++ b/chrome/browser/extensions/extension_accessibility_api.cc @@ -16,6 +16,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/common/notification_service.h" @@ -52,53 +53,53 @@ void ExtensionAccessibilityEventRouter::ObserveProfile(Profile* profile) { if (registrar_.IsEmpty()) { registrar_.Add(this, - NotificationType::ACCESSIBILITY_WINDOW_OPENED, + chrome::NOTIFICATION_ACCESSIBILITY_WINDOW_OPENED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::ACCESSIBILITY_WINDOW_CLOSED, + chrome::NOTIFICATION_ACCESSIBILITY_WINDOW_CLOSED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::ACCESSIBILITY_CONTROL_ACTION, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_ACTION, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::ACCESSIBILITY_TEXT_CHANGED, + chrome::NOTIFICATION_ACCESSIBILITY_TEXT_CHANGED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::ACCESSIBILITY_MENU_OPENED, + chrome::NOTIFICATION_ACCESSIBILITY_MENU_OPENED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::ACCESSIBILITY_MENU_CLOSED, + chrome::NOTIFICATION_ACCESSIBILITY_MENU_CLOSED, NotificationService::AllSources()); } } void ExtensionAccessibilityEventRouter::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::ACCESSIBILITY_WINDOW_OPENED: + switch (type) { + case chrome::NOTIFICATION_ACCESSIBILITY_WINDOW_OPENED: OnWindowOpened(Details<const AccessibilityWindowInfo>(details).ptr()); break; - case NotificationType::ACCESSIBILITY_WINDOW_CLOSED: + case chrome::NOTIFICATION_ACCESSIBILITY_WINDOW_CLOSED: OnWindowClosed(Details<const AccessibilityWindowInfo>(details).ptr()); break; - case NotificationType::ACCESSIBILITY_CONTROL_FOCUSED: + case chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED: OnControlFocused(Details<const AccessibilityControlInfo>(details).ptr()); break; - case NotificationType::ACCESSIBILITY_CONTROL_ACTION: + case chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_ACTION: OnControlAction(Details<const AccessibilityControlInfo>(details).ptr()); break; - case NotificationType::ACCESSIBILITY_TEXT_CHANGED: + case chrome::NOTIFICATION_ACCESSIBILITY_TEXT_CHANGED: OnTextChanged(Details<const AccessibilityControlInfo>(details).ptr()); break; - case NotificationType::ACCESSIBILITY_MENU_OPENED: + case chrome::NOTIFICATION_ACCESSIBILITY_MENU_OPENED: OnMenuOpened(Details<const AccessibilityMenuInfo>(details).ptr()); break; - case NotificationType::ACCESSIBILITY_MENU_CLOSED: + case chrome::NOTIFICATION_ACCESSIBILITY_MENU_CLOSED: OnMenuClosed(Details<const AccessibilityMenuInfo>(details).ptr()); break; default: diff --git a/chrome/browser/extensions/extension_accessibility_api.h b/chrome/browser/extensions/extension_accessibility_api.h index 2dfc4c1..62125f7 100644 --- a/chrome/browser/extensions/extension_accessibility_api.h +++ b/chrome/browser/extensions/extension_accessibility_api.h @@ -51,7 +51,7 @@ class ExtensionAccessibilityEventRouter : public NotificationObserver { virtual ~ExtensionAccessibilityEventRouter(); // NotificationObserver::Observe. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index 30cb96e..e66c0a3 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -10,6 +10,7 @@ #include "chrome/browser/extensions/extension_test_api.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/ui_test_utils.h" #include "content/common/notification_registrar.h" @@ -26,9 +27,9 @@ ExtensionApiTest::~ExtensionApiTest() {} ExtensionApiTest::ResultCatcher::ResultCatcher() : profile_restriction_(NULL), waiting_(false) { - registrar_.Add(this, NotificationType::EXTENSION_TEST_PASSED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_PASSED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_TEST_FAILED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_FAILED, NotificationService::AllSources()); } @@ -59,15 +60,15 @@ bool ExtensionApiTest::ResultCatcher::GetNextResult() { } void ExtensionApiTest::ResultCatcher::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { if (profile_restriction_ && Source<Profile>(source).ptr() != profile_restriction_) { return; } - switch (type.value) { - case NotificationType::EXTENSION_TEST_PASSED: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_TEST_PASSED: VLOG(1) << "Got EXTENSION_TEST_PASSED notification."; results_.push_back(true); messages_.push_back(""); @@ -75,7 +76,7 @@ void ExtensionApiTest::ResultCatcher::Observe( MessageLoopForUI::current()->Quit(); break; - case NotificationType::EXTENSION_TEST_FAILED: + case chrome::NOTIFICATION_EXTENSION_TEST_FAILED: VLOG(1) << "Got EXTENSION_TEST_FAILED notification."; results_.push_back(false); messages_.push_back(*(Details<std::string>(details).ptr())); diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h index d6e458f..aac6727 100644 --- a/chrome/browser/extensions/extension_apitest.h +++ b/chrome/browser/extensions/extension_apitest.h @@ -49,7 +49,7 @@ class ExtensionApiTest : public ExtensionBrowserTest { const std::string& message() { return message_; } private: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_app_api.cc b/chrome/browser/extensions/extension_app_api.cc index b5e8c12..24cc2ed 100644 --- a/chrome/browser/extensions/extension_app_api.cc +++ b/chrome/browser/extensions/extension_app_api.cc @@ -8,10 +8,10 @@ #include "base/values.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/render_messages.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" const char kBodyTextKey[] = "bodyText"; @@ -29,7 +29,7 @@ AppNotification::~AppNotification() {} AppNotificationManager::AppNotificationManager() { registrar_.Add(this, - NotificationType::EXTENSION_UNINSTALLED, + chrome::NOTIFICATION_EXTENSION_UNINSTALLED, NotificationService::AllSources()); } @@ -69,10 +69,10 @@ void AppNotificationManager::ClearAll(const std::string& extension_id) { notifications_.erase(found); } -void AppNotificationManager::Observe(NotificationType type, +void AppNotificationManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - CHECK(type == NotificationType::EXTENSION_UNINSTALLED); + CHECK(type == chrome::NOTIFICATION_EXTENSION_UNINSTALLED); const std::string& id = Details<UninstalledExtensionInfo>(details)->extension_id; ClearAll(id); @@ -125,7 +125,7 @@ bool AppNotifyFunction::RunImpl() { manager->Add(item.release()); NotificationService::current()->Notify( - NotificationType::APP_NOTIFICATION_STATE_CHANGED, + chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, Source<Profile>(profile_), Details<const std::string>(&extension_id())); @@ -137,7 +137,7 @@ bool AppClearAllNotificationsFunction::RunImpl() { profile()->GetExtensionService()->app_notification_manager(); manager->ClearAll(extension_id()); NotificationService::current()->Notify( - NotificationType::APP_NOTIFICATION_STATE_CHANGED, + chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, Source<Profile>(profile_), Details<const std::string>(&extension_id())); return true; diff --git a/chrome/browser/extensions/extension_app_api.h b/chrome/browser/extensions/extension_app_api.h index 3e6b22c..c0c9413 100644 --- a/chrome/browser/extensions/extension_app_api.h +++ b/chrome/browser/extensions/extension_app_api.h @@ -50,7 +50,7 @@ class AppNotificationManager : public NotificationObserver { void ClearAll(const std::string& extension_id); // Implementing NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/extensions/extension_bookmarks_module.cc b/chrome/browser/extensions/extension_bookmarks_module.cc index c61c8dd..1a1ab791 100644 --- a/chrome/browser/extensions/extension_bookmarks_module.cc +++ b/chrome/browser/extensions/extension_bookmarks_module.cc @@ -30,6 +30,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" #include "content/common/notification_service.h" @@ -77,7 +78,7 @@ void BookmarksFunction::Run() { BookmarkModel* model = profile()->GetBookmarkModel(); if (!model->IsLoaded()) { // Bookmarks are not ready yet. We'll wait. - registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, NotificationService::AllSources()); AddRef(); // Balanced in Observe(). return; @@ -86,7 +87,7 @@ void BookmarksFunction::Run() { bool success = RunImpl(); if (success) { NotificationService::current()->Notify( - NotificationType::EXTENSION_BOOKMARKS_API_INVOKED, + chrome::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, Source<const Extension>(GetExtension()), Details<const BookmarksFunction>(this)); } @@ -109,10 +110,10 @@ bool BookmarksFunction::EditBookmarksEnabled() { return false; } -void BookmarksFunction::Observe(NotificationType type, +void BookmarksFunction::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BOOKMARK_MODEL_LOADED); + DCHECK(type == chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED); DCHECK(profile()->GetBookmarkModel()->IsLoaded()); Run(); Release(); // Balanced in Run(). diff --git a/chrome/browser/extensions/extension_bookmarks_module.h b/chrome/browser/extensions/extension_bookmarks_module.h index 079656e..0aecb29 100644 --- a/chrome/browser/extensions/extension_bookmarks_module.h +++ b/chrome/browser/extensions/extension_bookmarks_module.h @@ -84,7 +84,7 @@ class BookmarksFunction : public AsyncExtensionFunction, private: // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/extensions/extension_browser_actions_api.cc b/chrome/browser/extensions/extension_browser_actions_api.cc index 3cf1499..750d121 100644 --- a/chrome/browser/extensions/extension_browser_actions_api.cc +++ b/chrome/browser/extensions/extension_browser_actions_api.cc @@ -8,6 +8,7 @@ #include "base/values.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/render_messages.h" #include "content/common/notification_service.h" @@ -38,7 +39,7 @@ bool BrowserActionFunction::RunImpl() { return false; NotificationService::current()->Notify( - NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, + chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, Source<ExtensionAction>(browser_action_), NotificationService::NoDetails()); return true; diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc index e510b2d..66a2cf0 100644 --- a/chrome/browser/extensions/extension_browser_event_router.cc +++ b/chrome/browser/extensions/extension_browser_event_router.cc @@ -14,6 +14,7 @@ #include "chrome/browser/tabs/tab_strip_model.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/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "content/browser/tab_contents/navigation_entry.h" @@ -72,7 +73,7 @@ void ExtensionBrowserEventRouter::Init() { #elif defined(OS_MACOSX) // Needed for when no suitable window can be passed to an extension as the // currently focused window. - registrar_.Add(this, NotificationType::NO_KEY_WINDOW, + registrar_.Add(this, content::NOTIFICATION_NO_KEY_WINDOW, NotificationService::AllSources()); #endif @@ -127,7 +128,7 @@ void ExtensionBrowserEventRouter::RegisterForBrowserNotifications( // If this is a new window, it isn't ready at this point, so we register to be // notified when it is. If this is an existing window, this is a no-op that we // just do to reduce code complexity. - registrar_.Add(this, NotificationType::BROWSER_WINDOW_READY, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY, Source<const Browser>(browser)); for (int i = 0; i < browser->tabstrip_model()->count(); ++i) @@ -136,22 +137,22 @@ void ExtensionBrowserEventRouter::RegisterForBrowserNotifications( void ExtensionBrowserEventRouter::RegisterForTabNotifications( TabContents* contents) { - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&contents->controller())); // Observing TAB_CONTENTS_DESTROYED is necessary because it's // possible for tabs to be created, detached and then destroyed without // ever having been re-attached and closed. This happens in the case of // a devtools TabContents that is opened in window, docked, then closed. - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(contents)); } void ExtensionBrowserEventRouter::UnregisterForTabNotifications( TabContents* contents) { - registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&contents->controller())); - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(contents)); } @@ -175,7 +176,7 @@ void ExtensionBrowserEventRouter::OnBrowserRemoved(const Browser* browser) { // Stop listening to TabStripModel events for this browser. browser->tabstrip_model()->RemoveObserver(this); - registrar_.Remove(this, NotificationType::BROWSER_WINDOW_READY, + registrar_.Remove(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY, Source<const Browser>(browser)); DispatchSimpleBrowserEvent(browser->profile(), @@ -487,25 +488,25 @@ ExtensionBrowserEventRouter::TabEntry* ExtensionBrowserEventRouter::GetTabEntry( return &i->second; } -void ExtensionBrowserEventRouter::Observe(NotificationType type, +void ExtensionBrowserEventRouter::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::NAV_ENTRY_COMMITTED) { + if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { NavigationController* source_controller = Source<NavigationController>(source).ptr(); TabUpdated(source_controller->tab_contents(), true); - } else if (type == NotificationType::TAB_CONTENTS_DESTROYED) { + } else if (type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED) { // Tab was destroyed after being detached (without being re-attached). TabContents* contents = Source<TabContents>(source).ptr(); - registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&contents->controller())); - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(contents)); - } else if (type == NotificationType::BROWSER_WINDOW_READY) { + } else if (type == chrome::NOTIFICATION_BROWSER_WINDOW_READY) { const Browser* browser = Source<const Browser>(source).ptr(); OnBrowserWindowReady(browser); #if defined(OS_MACOSX) - } else if (type == NotificationType::NO_KEY_WINDOW) { + } else if (type == content::NOTIFICATION_NO_KEY_WINDOW) { OnBrowserSetLastActive(NULL); #endif } else { diff --git a/chrome/browser/extensions/extension_browser_event_router.h b/chrome/browser/extensions/extension_browser_event_router.h index eda06a6..ddd878b 100644 --- a/chrome/browser/extensions/extension_browser_event_router.h +++ b/chrome/browser/extensions/extension_browser_event_router.h @@ -92,7 +92,7 @@ class ExtensionBrowserEventRouter : public TabStripModelObserver, Browser* browser); // NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index fed530d..540b8e3 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -22,12 +22,12 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/ui_test_utils.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" ExtensionBrowserTest::ExtensionBrowserTest() : loaded_(false), @@ -64,7 +64,7 @@ const Extension* ExtensionBrowserTest::LoadExtensionImpl( ExtensionService* service = browser()->profile()->GetExtensionService(); { NotificationRegistrar registrar; - registrar.Add(this, NotificationType::EXTENSION_LOADED, + registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); service->LoadExtension(path); ui_test_utils::RunMessageLoop(); @@ -94,7 +94,7 @@ const Extension* ExtensionBrowserTest::LoadExtensionImpl( service->SetIsIncognitoEnabled(extension_id, incognito_enabled); ui_test_utils::WindowedNotificationObserver extension_loaded_signal( - NotificationType::EXTENSION_LOADED, + chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(browser()->profile())); service->SetAllowFileAccess(extension, fileaccess_enabled); @@ -226,11 +226,11 @@ bool ExtensionBrowserTest::InstallOrUpdateExtension(const std::string& id, { NotificationRegistrar registrar; - registrar.Add(this, NotificationType::EXTENSION_LOADED, + registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); - registrar.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED, + registrar.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, NotificationService::AllSources()); - registrar.Add(this, NotificationType::EXTENSION_INSTALL_ERROR, + registrar.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); ExtensionInstallUI* install_ui = NULL; @@ -284,7 +284,7 @@ void ExtensionBrowserTest::ReloadExtension(const std::string& extension_id) { ExtensionService* service = browser()->profile()->GetExtensionService(); service->ReloadExtension(extension_id); ui_test_utils::RegisterAndWait(this, - NotificationType::EXTENSION_LOADED, + chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); } @@ -314,7 +314,7 @@ bool ExtensionBrowserTest::WaitForPageActionCountChangeTo(int count) { if (location_bar->PageActionCount() != count) { target_page_action_count_ = count; ui_test_utils::RegisterAndWait(this, - NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, NotificationService::AllSources()); } return location_bar->PageActionCount() == count; @@ -326,7 +326,7 @@ bool ExtensionBrowserTest::WaitForPageActionVisibilityChangeTo(int count) { if (location_bar->PageActionVisibleCount() != count) { target_visible_page_action_count_ = count; ui_test_utils::RegisterAndWait(this, - NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, NotificationService::AllSources()); } return location_bar->PageActionVisibleCount() == count; @@ -335,7 +335,7 @@ bool ExtensionBrowserTest::WaitForPageActionVisibilityChangeTo(int count) { bool ExtensionBrowserTest::WaitForExtensionHostsToLoad() { // Wait for all the extension hosts that exist to finish loading. NotificationRegistrar registrar; - registrar.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING, + registrar.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, NotificationService::AllSources()); ExtensionProcessManager* manager = @@ -358,7 +358,8 @@ bool ExtensionBrowserTest::WaitForExtensionHostsToLoad() { bool ExtensionBrowserTest::WaitForExtensionInstall() { int before = extension_installs_observed_; - ui_test_utils::RegisterAndWait(this, NotificationType::EXTENSION_INSTALLED, + ui_test_utils::RegisterAndWait(this, + chrome::NOTIFICATION_EXTENSION_INSTALLED, NotificationService::AllSources()); return extension_installs_observed_ == (before + 1); } @@ -366,13 +367,13 @@ bool ExtensionBrowserTest::WaitForExtensionInstall() { bool ExtensionBrowserTest::WaitForExtensionInstallError() { int before = extension_installs_observed_; ui_test_utils::RegisterAndWait(this, - NotificationType::EXTENSION_INSTALL_ERROR, + chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); return extension_installs_observed_ == before; } void ExtensionBrowserTest::WaitForExtensionLoad() { - ui_test_utils::RegisterAndWait(this, NotificationType::EXTENSION_LOADED, + ui_test_utils::RegisterAndWait(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); WaitForExtensionHostsToLoad(); } @@ -385,54 +386,54 @@ bool ExtensionBrowserTest::WaitForExtensionCrash( // The extension is already unloaded, presumably due to a crash. return true; } - ui_test_utils::RegisterAndWait(this, - NotificationType::EXTENSION_PROCESS_TERMINATED, - NotificationService::AllSources()); + ui_test_utils::RegisterAndWait( + this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + NotificationService::AllSources()); return (service->GetExtensionById(extension_id, true) == NULL); } -void ExtensionBrowserTest::Observe(NotificationType type, +void ExtensionBrowserTest::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_LOADED: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_LOADED: last_loaded_extension_id_ = Details<const Extension>(details).ptr()->id(); VLOG(1) << "Got EXTENSION_LOADED notification."; MessageLoopForUI::current()->Quit(); break; - case NotificationType::EXTENSION_UPDATE_DISABLED: + case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: VLOG(1) << "Got EXTENSION_UPDATE_DISABLED notification."; MessageLoopForUI::current()->Quit(); break; - case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: + case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: VLOG(1) << "Got EXTENSION_HOST_DID_STOP_LOADING notification."; MessageLoopForUI::current()->Quit(); break; - case NotificationType::EXTENSION_INSTALLED: + case chrome::NOTIFICATION_EXTENSION_INSTALLED: VLOG(1) << "Got EXTENSION_INSTALLED notification."; ++extension_installs_observed_; MessageLoopForUI::current()->Quit(); break; - case NotificationType::EXTENSION_INSTALL_ERROR: + case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: VLOG(1) << "Got EXTENSION_INSTALL_ERROR notification."; MessageLoopForUI::current()->Quit(); break; - case NotificationType::EXTENSION_PROCESS_CREATED: + case chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED: VLOG(1) << "Got EXTENSION_PROCESS_CREATED notification."; MessageLoopForUI::current()->Quit(); break; - case NotificationType::EXTENSION_PROCESS_TERMINATED: + case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: VLOG(1) << "Got EXTENSION_PROCESS_TERMINATED notification."; MessageLoopForUI::current()->Quit(); break; - case NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED: { + case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED: { LocationBarTesting* location_bar = browser()->window()->GetLocationBar()->GetLocationBarForTesting(); VLOG(1) << "Got EXTENSION_PAGE_ACTION_COUNT_CHANGED notification. Number " @@ -445,7 +446,7 @@ void ExtensionBrowserTest::Observe(NotificationType type, break; } - case NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { + case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { LocationBarTesting* location_bar = browser()->window()->GetLocationBar()->GetLocationBarForTesting(); VLOG(1) << "Got EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED notification. " diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index 93e3627..c76701a 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h @@ -12,9 +12,9 @@ #include "base/file_path.h" #include "base/scoped_temp_dir.h" #include "chrome/test/in_process_browser_test.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_observer.h" -#include "content/common/notification_type.h" class Extension; @@ -112,7 +112,7 @@ class ExtensionBrowserTest bool WaitForExtensionCrash(const std::string& extension_id); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_cookies_api.cc b/chrome/browser/extensions/extension_cookies_api.cc index 75c3ea6..a462172 100644 --- a/chrome/browser/extensions/extension_cookies_api.cc +++ b/chrome/browser/extensions/extension_cookies_api.cc @@ -14,11 +14,11 @@ #include "chrome/browser/extensions/extension_event_router.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_error_utils.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "net/base/cookie_monster.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" @@ -33,19 +33,19 @@ ExtensionCookiesEventRouter::~ExtensionCookiesEventRouter() {} void ExtensionCookiesEventRouter::Init() { CHECK(registrar_.IsEmpty()); registrar_.Add(this, - NotificationType::COOKIE_CHANGED, + chrome::NOTIFICATION_COOKIE_CHANGED, NotificationService::AllSources()); } -void ExtensionCookiesEventRouter::Observe(NotificationType type, +void ExtensionCookiesEventRouter::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { Profile* profile = Source<Profile>(source).ptr(); if (!profile_->IsSameProfile(profile)) { return; } - switch (type.value) { - case NotificationType::COOKIE_CHANGED: + switch (type) { + case chrome::NOTIFICATION_COOKIE_CHANGED: CookieChanged( profile, Details<ChromeCookieDetails>(details).ptr()); diff --git a/chrome/browser/extensions/extension_cookies_api.h b/chrome/browser/extensions/extension_cookies_api.h index 5d4fc13..fbeaf83 100644 --- a/chrome/browser/extensions/extension_cookies_api.h +++ b/chrome/browser/extensions/extension_cookies_api.h @@ -37,7 +37,7 @@ class ExtensionCookiesEventRouter : public NotificationObserver { private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_debugger_api.cc b/chrome/browser/extensions/extension_debugger_api.cc index 2183c1f7..8c6adc8 100644 --- a/chrome/browser/extensions/extension_debugger_api.cc +++ b/chrome/browser/extensions/extension_debugger_api.cc @@ -24,6 +24,7 @@ #include "content/browser/debugger/devtools_client_host.h" #include "content/browser/debugger/devtools_manager.h" #include "content/browser/tab_contents/tab_contents.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/devtools_messages.h" #include "content/common/notification_service.h" @@ -53,7 +54,7 @@ class ExtensionDevToolsClientHost : public DevToolsClientHost, private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); void OnDispatchOnInspectorFrontend(const std::string& data); @@ -116,7 +117,7 @@ ExtensionDevToolsClientHost::ExtensionDevToolsClientHost( AttachedClientHosts::GetInstance()->Add(this); // Detach from debugger when extension unloads. - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(tab_contents_->profile())); // Attach to debugger and tell it we are ready. @@ -194,10 +195,10 @@ void ExtensionDevToolsClientHost::SendMessageToBackend( } void ExtensionDevToolsClientHost::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::EXTENSION_UNLOADED); + DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); Close(); } diff --git a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc index 1b92ac0..14f8a80 100644 --- a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc +++ b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc @@ -12,6 +12,7 @@ #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_file_util.h" #include "chrome/common/extensions/extension_resource.h" #include "content/browser/tab_contents/tab_contents.h" @@ -97,7 +98,7 @@ class ExtensionDisabledInfobarDelegate : public ConfirmInfoBarDelegate, virtual bool Accept() OVERRIDE; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; @@ -116,9 +117,9 @@ ExtensionDisabledInfobarDelegate::ExtensionDisabledInfobarDelegate( service_(service), extension_(extension) { // The user might re-enable the extension in other ways, so watch for that. - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(service->profile())); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(service->profile())); } @@ -150,16 +151,16 @@ bool ExtensionDisabledInfobarDelegate::Accept() { } void ExtensionDisabledInfobarDelegate::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { // TODO(mpcomplete): RemoveInfoBar doesn't seem to always result in us getting // deleted. const Extension* extension = NULL; - if (type.value == NotificationType::EXTENSION_LOADED) { + if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { extension = Details<const Extension>(details).ptr(); } else { - DCHECK_EQ(NotificationType::EXTENSION_UNLOADED, type.value); + DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); UnloadedExtensionInfo* info = Details<UnloadedExtensionInfo>(details).ptr(); if (info->reason == UnloadedExtensionInfo::DISABLE || info->reason == UnloadedExtensionInfo::UNINSTALL) diff --git a/chrome/browser/extensions/extension_event_router.cc b/chrome/browser/extensions/extension_event_router.cc index f7663be..fcfe551 100644 --- a/chrome/browser/extensions/extension_event_router.cc +++ b/chrome/browser/extensions/extension_event_router.cc @@ -65,9 +65,9 @@ void ExtensionEventRouter::DispatchEvent(IPC::Message::Sender* ipc_sender, ExtensionEventRouter::ExtensionEventRouter(Profile* profile) : profile_(profile), extension_devtools_manager_(profile->GetExtensionDevToolsManager()) { - registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, NotificationService::AllSources()); } @@ -221,12 +221,12 @@ void ExtensionEventRouter::DispatchEventImpl( } } -void ExtensionEventRouter::Observe(NotificationType type, +void ExtensionEventRouter::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::RENDERER_PROCESS_TERMINATED: - case NotificationType::RENDERER_PROCESS_CLOSED: { + switch (type) { + case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: + case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { RenderProcessHost* renderer = Source<RenderProcessHost>(source).ptr(); // Remove all event listeners associated with this renderer for (ListenerMap::iterator it = listeners_.begin(); diff --git a/chrome/browser/extensions/extension_event_router.h b/chrome/browser/extensions/extension_event_router.h index 51ee249..d46e05f 100644 --- a/chrome/browser/extensions/extension_event_router.h +++ b/chrome/browser/extensions/extension_event_router.h @@ -101,7 +101,7 @@ class ExtensionEventRouter : public NotificationObserver { // An extension listening to an event. struct EventListener; - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc index fbb6c03a..c12f3fc 100644 --- a/chrome/browser/extensions/extension_function.cc +++ b/chrome/browser/extensions/extension_function.cc @@ -14,8 +14,8 @@ #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/user_metrics.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "content/common/result_codes.h" // static @@ -27,15 +27,15 @@ UIThreadExtensionFunction::RenderViewHostTracker::RenderViewHostTracker( UIThreadExtensionFunction* function) : function_(function) { registrar_.Add(this, - NotificationType::RENDER_VIEW_HOST_DELETED, + content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, Source<RenderViewHost>(function->render_view_host())); } void UIThreadExtensionFunction::RenderViewHostTracker::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - CHECK(type == NotificationType::RENDER_VIEW_HOST_DELETED); + CHECK(type == content::NOTIFICATION_RENDER_VIEW_HOST_DELETED); CHECK(Source<RenderViewHost>(source).ptr() == function_->render_view_host()); function_->SetRenderViewHost(NULL); diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h index c57f0b1..bffffdb7 100644 --- a/chrome/browser/extensions/extension_function.h +++ b/chrome/browser/extensions/extension_function.h @@ -263,7 +263,7 @@ class UIThreadExtensionFunction : public ExtensionFunction { public: explicit RenderViewHostTracker(UIThreadExtensionFunction* function); private: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); UIThreadExtensionFunction* function_; diff --git a/chrome/browser/extensions/extension_gallery_install_apitest.cc b/chrome/browser/extensions/extension_gallery_install_apitest.cc index 2a0b8be..0b2117b 100644 --- a/chrome/browser/extensions/extension_gallery_install_apitest.cc +++ b/chrome/browser/extensions/extension_gallery_install_apitest.cc @@ -9,12 +9,12 @@ #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_webstore_private_api.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/ui_test_utils.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "net/base/mock_host_resolver.h" // This is a helper class to let us automatically accept extension install @@ -25,7 +25,7 @@ class GalleryInstallApiTestObserver : public: GalleryInstallApiTestObserver() { registrar_.Add(this, - NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, NotificationService::AllSources()); } @@ -33,7 +33,7 @@ class GalleryInstallApiTestObserver : delegate->InstallUIProceed(); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE { ExtensionInstallUI* prompt = Source<ExtensionInstallUI>(source).ptr(); diff --git a/chrome/browser/extensions/extension_history_api.cc b/chrome/browser/extensions/extension_history_api.cc index ea36ecd..cf699e00 100644 --- a/chrome/browser/extensions/extension_history_api.cc +++ b/chrome/browser/extensions/extension_history_api.cc @@ -15,8 +15,8 @@ #include "chrome/browser/history/history.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace keys = extension_history_api_constants; @@ -72,23 +72,23 @@ void ExtensionHistoryEventRouter::ObserveProfile(Profile* profile) { NotificationSource source = Source<Profile>(profile); CHECK(registrar_.IsEmpty()); registrar_.Add(this, - NotificationType::HISTORY_URL_VISITED, + chrome::NOTIFICATION_HISTORY_URL_VISITED, source); registrar_.Add(this, - NotificationType::HISTORY_URLS_DELETED, + chrome::NOTIFICATION_HISTORY_URLS_DELETED, source); } -void ExtensionHistoryEventRouter::Observe(NotificationType type, +void ExtensionHistoryEventRouter::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::HISTORY_URL_VISITED: + switch (type) { + case chrome::NOTIFICATION_HISTORY_URL_VISITED: HistoryUrlVisited( Source<Profile>(source).ptr(), Details<const history::URLVisitedDetails>(details).ptr()); break; - case NotificationType::HISTORY_URLS_DELETED: + case chrome::NOTIFICATION_HISTORY_URLS_DELETED: HistoryUrlsRemoved( Source<Profile>(source).ptr(), Details<const history::URLsDeletedDetails>(details).ptr()); diff --git a/chrome/browser/extensions/extension_history_api.h b/chrome/browser/extensions/extension_history_api.h index bb6f55a..d547a46 100644 --- a/chrome/browser/extensions/extension_history_api.h +++ b/chrome/browser/extensions/extension_history_api.h @@ -24,7 +24,7 @@ class ExtensionHistoryEventRouter : public NotificationObserver { private: // NotificationObserver::Observe. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 88f6b93..86b7c2d 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -27,6 +27,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_messages.h" @@ -146,17 +147,17 @@ ExtensionHost::ExtensionHost(const Extension* extension, // Listen for when the render process' handle is available so we can add it // to the task manager then. - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, Source<RenderProcessHost>(render_process_host())); // Listen for when an extension is unloaded from the same profile, as it may // be the same extension that this points to. - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile_)); } ExtensionHost::~ExtensionHost() { NotificationService::current()->Notify( - NotificationType::EXTENSION_HOST_DESTROYED, + chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, Source<Profile>(profile_), Details<ExtensionHost>(this)); ProcessCreationQueue::GetInstance()->Remove(this); @@ -258,7 +259,7 @@ void ExtensionHost::NavigateToURL(const GURL& url) { if (!is_background_page() && !profile_->GetExtensionService()->IsBackgroundPageReady(extension_)) { // Make sure the background page loads before any others. - registrar_.Add(this, NotificationType::EXTENSION_BACKGROUND_PAGE_READY, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, Source<Extension>(extension_)); return; } @@ -266,22 +267,22 @@ void ExtensionHost::NavigateToURL(const GURL& url) { render_view_host_->NavigateToURL(url_); } -void ExtensionHost::Observe(NotificationType type, +void ExtensionHost::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_BACKGROUND_PAGE_READY: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY: DCHECK(profile_->GetExtensionService()-> IsBackgroundPageReady(extension_)); NavigateToURL(url_); break; - case NotificationType::RENDERER_PROCESS_CREATED: + case content::NOTIFICATION_RENDERER_PROCESS_CREATED: NotificationService::current()->Notify( - NotificationType::EXTENSION_PROCESS_CREATED, + chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED, Source<Profile>(profile_), Details<ExtensionHost>(this)); break; - case NotificationType::EXTENSION_UNLOADED: + case chrome::NOTIFICATION_EXTENSION_UNLOADED: // The extension object will be deleted after this notification has been // sent. NULL it out so that dirty pointer issues don't arise in cases // when multiple ExtensionHost objects pointing to the same Extension are @@ -332,7 +333,7 @@ void ExtensionHost::RenderViewGone(RenderViewHost* render_view_host, // more central, like EPM maybe. DCHECK_EQ(render_view_host_, render_view_host); NotificationService::current()->Notify( - NotificationType::EXTENSION_PROCESS_TERMINATED, + chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, Source<Profile>(profile_), Details<ExtensionHost>(this)); } @@ -377,7 +378,7 @@ void ExtensionHost::DidStopLoading() { } if (notify) { NotificationService::current()->Notify( - NotificationType::EXTENSION_HOST_DID_STOP_LOADING, + chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, Source<Profile>(profile_), Details<ExtensionHost>(this)); if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) { @@ -420,7 +421,7 @@ void ExtensionHost::DocumentOnLoadCompletedInMainFrame(RenderViewHost* rvh, int32 page_id) { if (ViewType::EXTENSION_POPUP == GetRenderViewType()) { NotificationService::current()->Notify( - NotificationType::EXTENSION_POPUP_VIEW_READY, + chrome::NOTIFICATION_EXTENSION_POPUP_VIEW_READY, Source<Profile>(profile_), Details<ExtensionHost>(this)); } @@ -491,7 +492,7 @@ void ExtensionHost::Close(RenderViewHost* render_view_host) { extension_host_type_ == ViewType::EXTENSION_DIALOG || extension_host_type_ == ViewType::EXTENSION_INFOBAR) { NotificationService::current()->Notify( - NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, + chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(profile_), Details<ExtensionHost>(this)); } @@ -737,7 +738,7 @@ void ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { if (event.type == NativeWebKeyboardEvent::RawKeyDown && event.windowsKeyCode == ui::VKEY_ESCAPE) { NotificationService::current()->Notify( - NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, + chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(profile_), Details<ExtensionHost>(this)); return; diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index b78895d..34dd215 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -183,7 +183,7 @@ class ExtensionHost : public RenderViewHostDelegate, virtual void ClearInspectorSettings(); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_infobar_delegate.cc b/chrome/browser/extensions/extension_infobar_delegate.cc index 25d7152..b52154f 100644 --- a/chrome/browser/extensions/extension_infobar_delegate.cc +++ b/chrome/browser/extensions/extension_infobar_delegate.cc @@ -9,10 +9,10 @@ #include "chrome/browser/profiles/profile.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/common/extensions/extension.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(Browser* browser, TabContents* tab_contents, @@ -28,9 +28,9 @@ ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(Browser* browser, extension_host_.reset(manager->CreateInfobarHost(url, browser)); extension_host_->set_associated_tab_contents(tab_contents); - registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(browser->profile())); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(browser->profile())); } @@ -68,19 +68,19 @@ ExtensionInfoBarDelegate* return this; } -void ExtensionInfoBarDelegate::Observe(NotificationType type, +void ExtensionInfoBarDelegate::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_); - switch (type.value) { - case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { + switch (type) { + case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { const ExtensionHost* result = Details<ExtensionHost>(details).ptr(); if (extension_host_.get() == result) wrapper->RemoveInfoBar(this); break; } - case NotificationType::EXTENSION_UNLOADED: { + case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* extension = Details<UnloadedExtensionInfo>(details)->extension; if (extension_ == extension) diff --git a/chrome/browser/extensions/extension_infobar_delegate.h b/chrome/browser/extensions/extension_infobar_delegate.h index f204300..815618a 100644 --- a/chrome/browser/extensions/extension_infobar_delegate.h +++ b/chrome/browser/extensions/extension_infobar_delegate.h @@ -54,7 +54,7 @@ class ExtensionInfoBarDelegate : public InfoBarDelegate, virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() OVERRIDE; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/extensions/extension_input_api.cc b/chrome/browser/extensions/extension_input_api.cc index 19a65c2..883437e 100644 --- a/chrome/browser/extensions/extension_input_api.cc +++ b/chrome/browser/extensions/extension_input_api.cc @@ -137,7 +137,7 @@ bool SendKeyboardEventInputFunction::RunImpl() { #if defined(TOUCH_UI) bool HideKeyboardFunction::RunImpl() { NotificationService::current()->Notify( - NotificationType::HIDE_KEYBOARD_INVOKED, + chrome::HIDE_KEYBOARD_INVOKED, Source<HideKeyboardFunction>(this), NotificationService::NoDetails()); return true; @@ -156,7 +156,7 @@ bool SetKeyboardHeightFunction::RunImpl() { // and set the height of virtual keyboard directly instead of using // notification. NotificationService::current()->Notify( - NotificationType::SET_KEYBOARD_HEIGHT_INVOKED, + chrome::SET_KEYBOARD_HEIGHT_INVOKED, Source<SetKeyboardHeightFunction>(this), Details<int>(&height)); return true; diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index 6fc8368..62d904a 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -24,6 +24,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_resource.h" @@ -197,7 +198,7 @@ void ExtensionInstallUI::OnImageLoaded( // TODO(jcivelli): http://crbug.com/44771 We should not show an install // dialog when installing an app from the gallery. NotificationService* service = NotificationService::current(); - service->Notify(NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + service->Notify(chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, Source<ExtensionInstallUI>(this), NotificationService::NoDetails()); diff --git a/chrome/browser/extensions/extension_management_api.cc b/chrome/browser/extensions/extension_management_api.cc index 4dd6726..61a8327 100644 --- a/chrome/browser/extensions/extension_management_api.cc +++ b/chrome/browser/extensions/extension_management_api.cc @@ -19,13 +19,13 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/webui/extension_icon_source.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_error_utils.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/url_pattern.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" using base::IntToString; namespace events = extension_event_names; @@ -256,11 +256,11 @@ ExtensionManagementEventRouter::ExtensionManagementEventRouter(Profile* profile) ExtensionManagementEventRouter::~ExtensionManagementEventRouter() {} void ExtensionManagementEventRouter::Init() { - NotificationType::Type types[] = { - NotificationType::EXTENSION_INSTALLED, - NotificationType::EXTENSION_UNINSTALLED, - NotificationType::EXTENSION_LOADED, - NotificationType::EXTENSION_UNLOADED + int types[] = { + chrome::NOTIFICATION_EXTENSION_INSTALLED, + chrome::NOTIFICATION_EXTENSION_UNINSTALLED, + chrome::NOTIFICATION_EXTENSION_LOADED, + chrome::NOTIFICATION_EXTENSION_UNLOADED }; CHECK(registrar_.IsEmpty()); @@ -272,7 +272,7 @@ void ExtensionManagementEventRouter::Init() { } void ExtensionManagementEventRouter::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { const char* event_name = NULL; @@ -282,17 +282,17 @@ void ExtensionManagementEventRouter::Observe( return; } - switch (type.value) { - case NotificationType::EXTENSION_INSTALLED: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_INSTALLED: event_name = events::kOnExtensionInstalled; break; - case NotificationType::EXTENSION_UNINSTALLED: + case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: event_name = events::kOnExtensionUninstalled; break; - case NotificationType::EXTENSION_LOADED: + case chrome::NOTIFICATION_EXTENSION_LOADED: event_name = events::kOnExtensionEnabled; break; - case NotificationType::EXTENSION_UNLOADED: + case chrome::NOTIFICATION_EXTENSION_UNLOADED: event_name = events::kOnExtensionDisabled; break; default: diff --git a/chrome/browser/extensions/extension_management_api.h b/chrome/browser/extensions/extension_management_api.h index 92099a3..1096fc1 100644 --- a/chrome/browser/extensions/extension_management_api.h +++ b/chrome/browser/extensions/extension_management_api.h @@ -56,7 +56,7 @@ class ExtensionManagementEventRouter : public NotificationObserver { private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_management_apitest.cc b/chrome/browser/extensions/extension_management_apitest.cc index d18972f..f62383f2 100644 --- a/chrome/browser/extensions/extension_management_apitest.cc +++ b/chrome/browser/extensions/extension_management_apitest.cc @@ -8,6 +8,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/ui_test_utils.h" namespace { @@ -97,7 +98,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) { // Close the app panel. ui_test_utils::WindowedNotificationObserver signal( - NotificationType::BROWSER_CLOSED, + chrome::NOTIFICATION_BROWSER_CLOSED, Source<Browser>(app_browser)); app_browser->CloseWindow(); diff --git a/chrome/browser/extensions/extension_management_browsertest.cc b/chrome/browser/extensions/extension_management_browsertest.cc index 53a7e21..95c3670 100644 --- a/chrome/browser/extensions/extension_management_browsertest.cc +++ b/chrome/browser/extensions/extension_management_browsertest.cc @@ -15,6 +15,7 @@ #include "chrome/browser/profiles/profile.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/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/test/ui_test_utils.h" @@ -234,10 +235,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, DisableEnable) { class NotificationListener : public NotificationObserver { public: NotificationListener() : started_(false), finished_(false) { - NotificationType::Type types[] = { - NotificationType::EXTENSION_UPDATING_STARTED, - NotificationType::EXTENSION_UPDATING_FINISHED, - NotificationType::EXTENSION_UPDATE_FOUND + int types[] = { + chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, + chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED, + chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND }; for (size_t i = 0; i < arraysize(types); i++) { registrar_.Add(this, types[i], NotificationService::AllSources()); @@ -258,21 +259,21 @@ class NotificationListener : public NotificationObserver { } // Implements NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_UPDATING_STARTED: { + switch (type) { + case chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED: { DCHECK(!started_); started_ = true; break; } - case NotificationType::EXTENSION_UPDATING_FINISHED: { + case chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED: { DCHECK(!finished_); finished_ = true; break; } - case NotificationType::EXTENSION_UPDATE_FOUND: { + case chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND: { const std::string* id = Details<const std::string>(details).ptr(); updates_.insert(*id); break; diff --git a/chrome/browser/extensions/extension_menu_manager.cc b/chrome/browser/extensions/extension_menu_manager.cc index 33ed7fc..6e87364 100644 --- a/chrome/browser/extensions/extension_menu_manager.cc +++ b/chrome/browser/extensions/extension_menu_manager.cc @@ -15,6 +15,7 @@ #include "chrome/browser/extensions/extension_event_router.h" #include "chrome/browser/extensions/extension_tabs_module.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/common/notification_service.h" #include "ui/base/l10n/l10n_util.h" @@ -95,7 +96,7 @@ const int ExtensionMenuManager::kAllowedSchemes = URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS; ExtensionMenuManager::ExtensionMenuManager() { - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); } @@ -448,11 +449,11 @@ void ExtensionMenuManager::ExecuteCommand( item->extension_id(), event_name, json_args, profile, GURL()); } -void ExtensionMenuManager::Observe(NotificationType type, +void ExtensionMenuManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Remove menu items for disabled/uninstalled extensions. - if (type != NotificationType::EXTENSION_UNLOADED) { + if (type != chrome::NOTIFICATION_EXTENSION_UNLOADED) { NOTREACHED(); return; } diff --git a/chrome/browser/extensions/extension_menu_manager.h b/chrome/browser/extensions/extension_menu_manager.h index eb87ae7..01471c7 100644 --- a/chrome/browser/extensions/extension_menu_manager.h +++ b/chrome/browser/extensions/extension_menu_manager.h @@ -250,7 +250,7 @@ class ExtensionMenuManager : public NotificationObserver { const SkBitmap& GetIconForExtension(const std::string& extension_id); // Implements the NotificationObserver interface. - virtual void Observe(NotificationType type, const NotificationSource& source, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); // Returns true if |url| has an allowed scheme for extension context menu diff --git a/chrome/browser/extensions/extension_menu_manager_unittest.cc b/chrome/browser/extensions/extension_menu_manager_unittest.cc index fff6f91..71847dc 100644 --- a/chrome/browser/extensions/extension_menu_manager_unittest.cc +++ b/chrome/browser/extensions/extension_menu_manager_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/browser/extensions/extension_event_router.h" #include "chrome/browser/extensions/extension_menu_manager.h" #include "chrome/browser/extensions/test_extension_prefs.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" @@ -330,7 +331,7 @@ TEST_F(ExtensionMenuManagerTest, ExtensionUnloadRemovesMenuItems) { // Notify that the extension was unloaded, and make sure the right item is // gone. UnloadedExtensionInfo details(extension1, UnloadedExtensionInfo::DISABLE); - notifier->Notify(NotificationType::EXTENSION_UNLOADED, + notifier->Notify(chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(NULL), Details<UnloadedExtensionInfo>(&details)); ASSERT_EQ(NULL, manager_.MenuItems(extension1->id())); diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc index c905436..73e37b8 100644 --- a/chrome/browser/extensions/extension_message_service.cc +++ b/chrome/browser/extensions/extension_message_service.cc @@ -116,11 +116,11 @@ void ExtensionMessageService::AllocatePortIdPair(int* port1, int* port2) { ExtensionMessageService::ExtensionMessageService(Profile* profile) : profile_(profile) { - registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDER_VIEW_HOST_DELETED, + registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, NotificationService::AllSources()); } @@ -324,17 +324,17 @@ void ExtensionMessageService::PostMessageFromRenderer( DispatchOnMessage(port, message, dest_port_id); } -void ExtensionMessageService::Observe(NotificationType type, +void ExtensionMessageService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::RENDERER_PROCESS_TERMINATED: - case NotificationType::RENDERER_PROCESS_CLOSED: { + switch (type) { + case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: + case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { RenderProcessHost* renderer = Source<RenderProcessHost>(source).ptr(); OnSenderClosed(renderer); break; } - case NotificationType::RENDER_VIEW_HOST_DELETED: + case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED: OnSenderClosed(Source<RenderViewHost>(source).ptr()); break; default: diff --git a/chrome/browser/extensions/extension_message_service.h b/chrome/browser/extensions/extension_message_service.h index 5f01a9c..91e8239 100644 --- a/chrome/browser/extensions/extension_message_service.h +++ b/chrome/browser/extensions/extension_message_service.h @@ -134,7 +134,7 @@ class ExtensionMessageService bool notify_other_port); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_messages_apitest.cc b/chrome/browser/extensions/extension_messages_apitest.cc index 8d26ace..215f5b9 100644 --- a/chrome/browser/extensions/extension_messages_apitest.cc +++ b/chrome/browser/extensions/extension_messages_apitest.cc @@ -5,6 +5,7 @@ #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_event_router.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" #include "googleurl/src/gurl.h" @@ -14,12 +15,12 @@ namespace { class MessageSender : public NotificationObserver { public: MessageSender() { - registrar_.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, NotificationService::AllSources()); } private: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { ExtensionEventRouter* event_router = diff --git a/chrome/browser/extensions/extension_metrics_apitest.cc b/chrome/browser/extensions/extension_metrics_apitest.cc index 522ea40..74bd826 100644 --- a/chrome/browser/extensions/extension_metrics_apitest.cc +++ b/chrome/browser/extensions/extension_metrics_apitest.cc @@ -64,7 +64,7 @@ class UserActionObserver : public NotificationObserver { const RecordedUserAction* recorded, int count); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -85,11 +85,11 @@ class UserActionObserver : public NotificationObserver { }; UserActionObserver::UserActionObserver() { - registrar_.Add(this, NotificationType::USER_ACTION, + registrar_.Add(this, content::NOTIFICATION_USER_ACTION, NotificationService::AllSources()); } -void UserActionObserver::Observe(NotificationType type, +void UserActionObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { const char* name = *Details<const char*>(details).ptr(); diff --git a/chrome/browser/extensions/extension_omnibox_api.cc b/chrome/browser/extensions/extension_omnibox_api.cc index d5bd8b5..21a7227 100644 --- a/chrome/browser/extensions/extension_omnibox_api.cc +++ b/chrome/browser/extensions/extension_omnibox_api.cc @@ -15,6 +15,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_constants.h" #include "content/common/notification_service.h" @@ -99,7 +100,7 @@ void ExtensionOmniboxEventRouter::OnInputEntered( extension_id, events::kOnInputEntered, json_args, profile, GURL()); NotificationService::current()->Notify( - NotificationType::EXTENSION_OMNIBOX_INPUT_ENTERED, + chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, Source<Profile>(profile), NotificationService::NoDetails()); } @@ -140,7 +141,7 @@ bool OmniboxSendSuggestionsFunction::RunImpl() { } NotificationService::current()->Notify( - NotificationType::EXTENSION_OMNIBOX_SUGGESTIONS_READY, + chrome::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY, Source<Profile>(profile_), Details<ExtensionOmniboxSuggestions>(&suggestions)); @@ -171,7 +172,7 @@ bool OmniboxSetDefaultSuggestionFunction::RunImpl() { suggestion); NotificationService::current()->Notify( - NotificationType::EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, + chrome::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, Source<Profile>(profile_), NotificationService::NoDetails()); diff --git a/chrome/browser/extensions/extension_omnibox_apitest.cc b/chrome/browser/extensions/extension_omnibox_apitest.cc index ba762ca..554c7e5 100644 --- a/chrome/browser/extensions/extension_omnibox_apitest.cc +++ b/chrome/browser/extensions/extension_omnibox_apitest.cc @@ -19,9 +19,10 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "chrome/test/ui_test_utils.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #if defined(TOOLKIT_GTK) #include "chrome/browser/ui/gtk/browser_window_gtk.h" @@ -68,14 +69,14 @@ class OmniboxApiTest : public ExtensionApiTest { model->Load(); if (!model->loaded()) { ui_test_utils::WaitForNotification( - NotificationType::TEMPLATE_URL_SERVICE_LOADED); + chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); } } void WaitForAutocompleteDone(AutocompleteController* controller) { while (!controller->done()) { ui_test_utils::WaitForNotification( - NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_READY); + chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY); } } }; diff --git a/chrome/browser/extensions/extension_preference_api.cc b/chrome/browser/extensions/extension_preference_api.cc index 21b1f71..da463ddb 100644 --- a/chrome/browser/extensions/extension_preference_api.cc +++ b/chrome/browser/extensions/extension_preference_api.cc @@ -19,10 +19,10 @@ #include "chrome/browser/extensions/extension_proxy_api.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_error_utils.h" #include "chrome/common/extensions/extension_permission_set.h" #include "chrome/common/pref_names.h" -#include "content/common/notification_type.h" #include "content/common/notification_service.h" namespace { @@ -233,10 +233,10 @@ ExtensionPreferenceEventRouter::ExtensionPreferenceEventRouter( ExtensionPreferenceEventRouter::~ExtensionPreferenceEventRouter() { } void ExtensionPreferenceEventRouter::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { const std::string* pref_key = Details<const std::string>(details).ptr(); OnPrefChanged(Source<PrefService>(source).ptr(), *pref_key); diff --git a/chrome/browser/extensions/extension_preference_api.h b/chrome/browser/extensions/extension_preference_api.h index 1dab6b9..804d062 100644 --- a/chrome/browser/extensions/extension_preference_api.h +++ b/chrome/browser/extensions/extension_preference_api.h @@ -19,7 +19,7 @@ class ExtensionPreferenceEventRouter : public NotificationObserver { private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 600dea7..5b4b36b 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -10,6 +10,7 @@ #include "chrome/browser/extensions/extension_pref_store.h" #include "chrome/browser/prefs/pref_notifier.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/url_pattern.h" @@ -1042,7 +1043,7 @@ void ExtensionPrefs::SetBrowserActionVisibility(const Extension* extension, UpdateExtensionPref(extension->id(), kBrowserActionVisible, Value::CreateBooleanValue(visible)); NotificationService::current()->Notify( - NotificationType::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, + chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, Source<ExtensionPrefs>(this), Details<const Extension>(extension)); } @@ -1354,7 +1355,7 @@ void ExtensionPrefs::SetAppLauncherOrder( SetAppLaunchIndex(extension_ids.at(i), i); NotificationService::current()->Notify( - NotificationType::EXTENSION_LAUNCHER_REORDERED, + chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, Source<ExtensionPrefs>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index 4be0f74..dea004a 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -13,12 +13,12 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace { @@ -40,7 +40,7 @@ class IncognitoExtensionProcessManager : public ExtensionProcessManager { private: // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -87,19 +87,19 @@ ExtensionProcessManager* ExtensionProcessManager::Create(Profile* profile) { ExtensionProcessManager::ExtensionProcessManager(Profile* profile) : browsing_instance_(new BrowsingInstance(profile)) { Profile* original_profile = profile->GetOriginalProfile(); - registrar_.Add(this, NotificationType::EXTENSIONS_READY, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, Source<Profile>(original_profile)); - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(original_profile)); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(original_profile)); - registrar_.Add(this, NotificationType::EXTENSION_HOST_DESTROYED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, Source<Profile>(profile)); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::APP_TERMINATING, + registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, NotificationService::AllSources()); } @@ -269,17 +269,17 @@ bool ExtensionProcessManager::HasExtensionHost(ExtensionHost* host) const { return all_hosts_.find(host) != all_hosts_.end(); } -void ExtensionProcessManager::Observe(NotificationType type, +void ExtensionProcessManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSIONS_READY: { + switch (type) { + case chrome::NOTIFICATION_EXTENSIONS_READY: { CreateBackgroundHosts(this, Source<Profile>(source).ptr()->GetExtensionService()->extensions()); break; } - case NotificationType::EXTENSION_LOADED: { + case chrome::NOTIFICATION_EXTENSION_LOADED: { ExtensionService* service = Source<Profile>(source).ptr()->GetExtensionService(); if (service->is_ready()) { @@ -289,7 +289,7 @@ void ExtensionProcessManager::Observe(NotificationType type, break; } - case NotificationType::EXTENSION_UNLOADED: { + case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* extension = Details<UnloadedExtensionInfo>(details)->extension; for (ExtensionHostSet::iterator iter = background_hosts_.begin(); @@ -305,21 +305,21 @@ void ExtensionProcessManager::Observe(NotificationType type, break; } - case NotificationType::EXTENSION_HOST_DESTROYED: { + case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { ExtensionHost* host = Details<ExtensionHost>(details).ptr(); all_hosts_.erase(host); background_hosts_.erase(host); break; } - case NotificationType::RENDERER_PROCESS_TERMINATED: - case NotificationType::RENDERER_PROCESS_CLOSED: { + case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: + case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { RenderProcessHost* host = Source<RenderProcessHost>(source).ptr(); UnregisterExtensionProcess(host->id()); break; } - case NotificationType::APP_TERMINATING: { + case content::NOTIFICATION_APP_TERMINATING: { // Close background hosts when the last browser is closed so that they // have time to shutdown various objects on different threads. Our // destructor is called too late in the shutdown sequence. @@ -340,7 +340,7 @@ void ExtensionProcessManager::OnExtensionHostCreated(ExtensionHost* host, if (is_background) background_hosts_.insert(host); NotificationService::current()->Notify( - NotificationType::EXTENSION_HOST_CREATED, + chrome::NOTIFICATION_EXTENSION_HOST_CREATED, Source<ExtensionProcessManager>(this), Details<ExtensionHost>(host)); } @@ -365,7 +365,7 @@ IncognitoExtensionProcessManager::IncognitoExtensionProcessManager( GetExtensionProcessManager()) { DCHECK(profile->IsOffTheRecord()); - registrar_.Add(this, NotificationType::BROWSER_WINDOW_READY, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY, NotificationService::AllSources()); } @@ -439,11 +439,11 @@ bool IncognitoExtensionProcessManager::IsIncognitoEnabled( } void IncognitoExtensionProcessManager::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::BROWSER_WINDOW_READY: { + switch (type) { + case chrome::NOTIFICATION_BROWSER_WINDOW_READY: { // We want to spawn our background hosts as soon as the user opens an // incognito window. Watch for new browsers and create the hosts if // it matches our profile. diff --git a/chrome/browser/extensions/extension_process_manager.h b/chrome/browser/extensions/extension_process_manager.h index 8bf5e77..c2a7710 100644 --- a/chrome/browser/extensions/extension_process_manager.h +++ b/chrome/browser/extensions/extension_process_manager.h @@ -100,7 +100,7 @@ class ExtensionProcessManager : public NotificationObserver { void CloseBackgroundHosts(); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_processes_api.cc b/chrome/browser/extensions/extension_processes_api.cc index 266afdc..0daa174 100644 --- a/chrome/browser/extensions/extension_processes_api.cc +++ b/chrome/browser/extensions/extension_processes_api.cc @@ -22,7 +22,7 @@ #include "chrome/common/extensions/extension_error_utils.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" namespace keys = extension_processes_api_constants; diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index c2c32d7..94e237f 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -58,6 +58,7 @@ #include "chrome/browser/ui/webui/favicon_source.h" #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" #include "chrome/common/child_process_logging.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" @@ -74,9 +75,9 @@ #include "content/browser/plugin_process_host.h" #include "content/browser/plugin_service.h" #include "content/browser/renderer_host/render_process_host.h" +#include "content/common/content_notification_types.h" #include "content/common/json_value_serializer.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "content/common/pepper_plugin_registry.h" #include "googleurl/src/gurl.h" #include "net/base/registry_controlled_domain.h" @@ -352,7 +353,7 @@ void ExtensionServiceBackend::ReportExtensionLoadError( CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (frontend_.get()) frontend_->ReportExtensionLoadError( - extension_path, error, NotificationType::EXTENSION_INSTALL_ERROR, + extension_path, error, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, true /* alert_on_error */); } @@ -561,11 +562,11 @@ ExtensionService::ExtensionService(Profile* profile, extensions_enabled_ = false; } - registrar_.Add(this, NotificationType::EXTENSION_PROCESS_TERMINATED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); pref_change_registrar_.Init(profile->GetPrefs()); pref_change_registrar_.Add(prefs::kExtensionInstallAllowList, this); @@ -834,7 +835,7 @@ bool ExtensionService::UninstallExtension( // managed extensions. if (!Extension::UserMayDisable(location) && !external_uninstall) { NotificationService::current()->Notify( - NotificationType::EXTENSION_UNINSTALL_NOT_ALLOWED, + chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, Source<Profile>(profile_), Details<const Extension>(extension)); if (error != NULL) { @@ -878,7 +879,7 @@ bool ExtensionService::UninstallExtension( // Notify interested parties that we've uninstalled this extension. NotificationService::current()->Notify( - NotificationType::EXTENSION_UNINSTALLED, + chrome::NOTIFICATION_EXTENSION_UNINSTALLED, Source<Profile>(profile_), Details<UninstalledExtensionInfo>(&uninstalled_extension_info)); @@ -1253,7 +1254,7 @@ void ExtensionService::LoadInstalledExtension(const ExtensionInfo& info, if (!extension) { ReportExtensionLoadError(info.extension_path, error, - NotificationType::EXTENSION_INSTALL_ERROR, + chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, false); return; } @@ -1276,7 +1277,7 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { // Tell subsystems that use the EXTENSION_LOADED notification about the new // extension. NotificationService::current()->Notify( - NotificationType::EXTENSION_LOADED, + chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(profile_), Details<const Extension>(extension)); @@ -1373,7 +1374,7 @@ void ExtensionService::NotifyExtensionUnloaded( const Extension* extension, UnloadedExtensionInfo::Reason reason) { UnloadedExtensionInfo details(extension, reason); NotificationService::current()->Notify( - NotificationType::EXTENSION_UNLOADED, + chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile_), Details<UnloadedExtensionInfo>(&details)); @@ -1791,7 +1792,7 @@ void ExtensionService::UnloadExtension( details.already_disabled = true; disabled_extensions_.erase(iter); NotificationService::current()->Notify( - NotificationType::EXTENSION_UNLOADED, + chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile_), Details<UnloadedExtensionInfo>(&details)); // Make sure the profile cleans up its RequestContexts when an already @@ -1863,7 +1864,7 @@ void ExtensionService::OnLoadedInstalledExtensions() { ready_ = true; NotificationService::current()->Notify( - NotificationType::EXTENSIONS_READY, + chrome::NOTIFICATION_EXTENSIONS_READY, Source<Profile>(profile_), NotificationService::NoDetails()); } @@ -1904,7 +1905,7 @@ void ExtensionService::AddExtension(const Extension* extension) { // with a disabled extension for other reasons other than that an update was // disabled. NotificationService::current()->Notify( - NotificationType::EXTENSION_UPDATE_DISABLED, + chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, Source<Profile>(profile_), Details<const Extension>(extension)); return; @@ -2038,7 +2039,7 @@ void ExtensionService::OnExtensionInstalled(const Extension* extension) { << "; not installing"; NotificationService::current()->Notify( - NotificationType::EXTENSION_INSTALL_NOT_ALLOWED, + chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED, Source<Profile>(profile_), Details<const Extension>(extension)); @@ -2080,7 +2081,7 @@ void ExtensionService::OnExtensionInstalled(const Extension* extension) { } NotificationService::current()->Notify( - NotificationType::EXTENSION_INSTALLED, + chrome::NOTIFICATION_EXTENSION_INSTALLED, Source<Profile>(profile_), Details<const Extension>(extension)); @@ -2239,7 +2240,7 @@ void ExtensionService::OnExternalExtensionFileFound( void ExtensionService::ReportExtensionLoadError( const FilePath& extension_path, const std::string &error, - NotificationType type, + int type, bool be_noisy) { NotificationService* service = NotificationService::current(); service->Notify(type, @@ -2265,11 +2266,11 @@ void ExtensionService::DidCreateRenderViewForBackgroundPage( orphaned_dev_tools_.erase(iter); } -void ExtensionService::Observe(NotificationType type, +void ExtensionService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_PROCESS_TERMINATED: { + switch (type) { + case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { if (profile_ != Source<Profile>(source).ptr()->GetOriginalProfile()) break; @@ -2287,7 +2288,7 @@ void ExtensionService::Observe(NotificationType type, host->extension())); break; } - case NotificationType::RENDERER_PROCESS_CREATED: { + case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); // Valid extension function names, used to setup bindings in renderer. std::vector<std::string> function_names; @@ -2306,12 +2307,12 @@ void ExtensionService::Observe(NotificationType type, } break; } - case NotificationType::RENDERER_PROCESS_TERMINATED: { + case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); installed_app_hosts_.erase(process->id()); break; } - case NotificationType::PREF_CHANGED: { + case chrome::NOTIFICATION_PREF_CHANGED: { std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kExtensionInstallAllowList || *pref_name == prefs::kExtensionInstallDenyList) { @@ -2356,7 +2357,7 @@ void ExtensionService::SetBackgroundPageReady(const Extension* extension) { DCHECK(!extension->background_url().is_empty()); extension_runtime_data_[extension->id()].background_page_ready = true; NotificationService::current()->Notify( - NotificationType::EXTENSION_BACKGROUND_PAGE_READY, + chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, Source<const Extension>(extension), NotificationService::NoDetails()); } diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 401eef4..d8c84c9 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -470,7 +470,7 @@ class ExtensionService // This method is public because ExtensionServiceBackend can post to here. void ReportExtensionLoadError(const FilePath& extension_path, const std::string& error, - NotificationType type, + int type, bool be_noisy); // ExtensionHost of background page calls this method right after its render @@ -501,7 +501,7 @@ class ExtensionService virtual void OnExternalProviderReady(); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -660,7 +660,7 @@ class ExtensionService // Used by dispatchers to limit API quota for individual extensions. ExtensionsQuotaService quota_service_; - // Record that Init() has been called, and NotificationType::EXTENSIONS_READY + // Record that Init() has been called, and chrome::EXTENSIONS_READY // has fired. bool ready_; diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 8008828..210ab66 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -39,6 +39,7 @@ #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/pref_service_mock_builder.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" @@ -56,7 +57,6 @@ #include "content/common/json_value_serializer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "net/base/cookie_monster.h" #include "net/base/cookie_options.h" @@ -492,19 +492,19 @@ class ExtensionServiceTest : public ExtensionServiceTestBase, public NotificationObserver { public: ExtensionServiceTest() : installed_(NULL) { - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_INSTALLED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, NotificationService::AllSources()); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_LOADED: { + switch (type) { + case chrome::NOTIFICATION_EXTENSION_LOADED: { const Extension* extension = Details<const Extension>(details).ptr(); loaded_.push_back(make_scoped_refptr(extension)); // The tests rely on the errors being in a certain order, which can vary @@ -513,7 +513,7 @@ class ExtensionServiceTest break; } - case NotificationType::EXTENSION_UNLOADED: { + case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* e = Details<UnloadedExtensionInfo>(details)->extension; unloaded_id_ = e->id(); @@ -526,7 +526,7 @@ class ExtensionServiceTest loaded_.erase(i); break; } - case NotificationType::EXTENSION_INSTALLED: + case chrome::NOTIFICATION_EXTENSION_INSTALLED: installed_ = Details<const Extension>(details).ptr(); break; @@ -3194,7 +3194,7 @@ TEST_F(ExtensionServiceTest, LoadAndRelocalizeExtensions) { class ExtensionsReadyRecorder : public NotificationObserver { public: ExtensionsReadyRecorder() : ready_(false) { - registrar_.Add(this, NotificationType::EXTENSIONS_READY, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, NotificationService::AllSources()); } @@ -3202,11 +3202,11 @@ class ExtensionsReadyRecorder : public NotificationObserver { bool ready() { return ready_; } private: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSIONS_READY: + switch (type) { + case chrome::NOTIFICATION_EXTENSIONS_READY: ready_ = true; break; default: diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc index dc046a1..554c210 100644 --- a/chrome/browser/extensions/extension_startup_browsertest.cc +++ b/chrome/browser/extensions/extension_startup_browsertest.cc @@ -12,13 +12,13 @@ #include "chrome/browser/extensions/user_script_master.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/chrome_switches.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_details.h" -#include "content/common/notification_type.h" #include "net/base/net_util.h" // This file contains high-level startup tests for the extensions system. We've @@ -93,7 +93,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { UserScriptMaster* master = browser()->profile()->GetUserScriptMaster(); if (!master->ScriptsReady()) { ui_test_utils::WaitForNotification( - NotificationType::USER_SCRIPTS_UPDATED); + chrome::NOTIFICATION_USER_SCRIPTS_UPDATED); } ASSERT_TRUE(master->ScriptsReady()); } @@ -168,7 +168,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, MAYBE_NoFileAccess) { if (service->AllowFileAccess(service->extensions()->at(i))) { service->SetAllowFileAccess(service->extensions()->at(i), false); ui_test_utils::WaitForNotification( - NotificationType::USER_SCRIPTS_UPDATED); + chrome::NOTIFICATION_USER_SCRIPTS_UPDATED); } } diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc index 0b9ead9..5495e6e 100644 --- a/chrome/browser/extensions/extension_tab_helper.cc +++ b/chrome/browser/extensions/extension_tab_helper.cc @@ -11,6 +11,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_messages.h" @@ -52,7 +53,7 @@ void ExtensionTabHelper::SetExtensionApp(const Extension* extension) { UpdateExtensionAppIcon(extension_app_); NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, + chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, Source<ExtensionTabHelper>(this), NotificationService::NoDetails()); } @@ -97,7 +98,7 @@ void ExtensionTabHelper::DidNavigateMainFramePostCommit( browser_action->ClearAllValuesForTab( wrapper_->restore_tab_helper()->session_id().id()); NotificationService::current()->Notify( - NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, + chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, Source<ExtensionAction>(browser_action), NotificationService::NoDetails()); } diff --git a/chrome/browser/extensions/extension_tab_id_map.cc b/chrome/browser/extensions/extension_tab_id_map.cc index ec319c0..202bd28 100644 --- a/chrome/browser/extensions/extension_tab_id_map.cc +++ b/chrome/browser/extensions/extension_tab_id_map.cc @@ -31,7 +31,7 @@ class ExtensionTabIdMap::TabObserver : public NotificationObserver { private: // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -40,11 +40,11 @@ class ExtensionTabIdMap::TabObserver : public NotificationObserver { ExtensionTabIdMap::TabObserver::TabObserver() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - registrar_.Add(this, NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, + registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDER_VIEW_HOST_DELETED, + registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::TAB_PARENTED, + registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED, NotificationService::AllSources()); } @@ -53,10 +53,10 @@ ExtensionTabIdMap::TabObserver::~TabObserver() { } void ExtensionTabIdMap::TabObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: { + switch (type) { + case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { TabContents* contents = Source<TabContents>(source).ptr(); TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents(contents); @@ -75,7 +75,7 @@ void ExtensionTabIdMap::TabObserver::Observe( tab->restore_tab_helper()->window_id().id())); break; } - case NotificationType::TAB_PARENTED: { + case content::NOTIFICATION_TAB_PARENTED: { TabContentsWrapper* tab = Source<TabContentsWrapper>(source).ptr(); RenderViewHost* host = tab->render_view_host(); BrowserThread::PostTask( @@ -88,7 +88,7 @@ void ExtensionTabIdMap::TabObserver::Observe( tab->restore_tab_helper()->window_id().id())); break; } - case NotificationType::RENDER_VIEW_HOST_DELETED: { + case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED: { RenderViewHost* host = Source<RenderViewHost>(source).ptr(); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index dbe4b30..bd4008e 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -27,6 +27,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/window_sizer.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_error_utils.h" @@ -1205,7 +1206,7 @@ bool CaptureVisibleTabFunction::RunImpl() { TabContentsWrapper* wrapper = browser->GetSelectedTabContentsWrapper(); wrapper->CaptureSnapshot(); registrar_.Add(this, - NotificationType::TAB_SNAPSHOT_TAKEN, + chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, Source<TabContentsWrapper>(wrapper)); AddRef(); // Balanced in CaptureVisibleTabFunction::Observe(). @@ -1234,10 +1235,10 @@ bool CaptureVisibleTabFunction::CaptureSnapshotFromBackingStore( // If a backing store was not available in CaptureVisibleTabFunction::RunImpl, // than the renderer was asked for a snapshot. Listen for a notification // that the snapshot is available. -void CaptureVisibleTabFunction::Observe(NotificationType type, +void CaptureVisibleTabFunction::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TAB_SNAPSHOT_TAKEN); + DCHECK(type == chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN); const SkBitmap *screen_capture = Details<const SkBitmap>(details).ptr(); const bool error = screen_capture->empty(); @@ -1347,20 +1348,20 @@ bool DetectTabLanguageFunction::RunImpl() { } // The tab contents does not know its language yet. Let's wait until it // receives it, or until the tab is closed/navigates to some other page. - registrar_.Add(this, NotificationType::TAB_LANGUAGE_DETERMINED, + registrar_.Add(this, chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, Source<TabContents>(contents->tab_contents())); - registrar_.Add(this, NotificationType::TAB_CLOSING, + registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, Source<NavigationController>(&(contents->controller()))); - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&(contents->controller()))); return true; } -void DetectTabLanguageFunction::Observe(NotificationType type, +void DetectTabLanguageFunction::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { std::string language; - if (type == NotificationType::TAB_LANGUAGE_DETERMINED) + if (type == chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED) language = *Details<std::string>(details).ptr(); registrar_.RemoveAll(); diff --git a/chrome/browser/extensions/extension_tabs_module.h b/chrome/browser/extensions/extension_tabs_module.h index b2d7034..f02f9ed 100644 --- a/chrome/browser/extensions/extension_tabs_module.h +++ b/chrome/browser/extensions/extension_tabs_module.h @@ -145,7 +145,7 @@ class DetectTabLanguageFunction : public AsyncExtensionFunction, virtual ~DetectTabLanguageFunction() {} virtual bool RunImpl(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); void GotLanguage(const std::string& language); @@ -166,7 +166,7 @@ class CaptureVisibleTabFunction : public AsyncExtensionFunction, virtual ~CaptureVisibleTabFunction() {} virtual bool RunImpl(); virtual bool CaptureSnapshotFromBackingStore(BackingStore* backing_store); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); virtual void SendResultFromBitmap(const SkBitmap& screen_capture); diff --git a/chrome/browser/extensions/extension_test_api.cc b/chrome/browser/extensions/extension_test_api.cc index e5bc60f..693d111 100644 --- a/chrome/browser/extensions/extension_test_api.cc +++ b/chrome/browser/extensions/extension_test_api.cc @@ -12,6 +12,7 @@ #include "chrome/browser/extensions/extensions_quota_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" namespace { @@ -28,7 +29,7 @@ ExtensionTestPassFunction::~ExtensionTestPassFunction() {} bool ExtensionTestPassFunction::RunImpl() { NotificationService::current()->Notify( - NotificationType::EXTENSION_TEST_PASSED, + chrome::NOTIFICATION_EXTENSION_TEST_PASSED, Source<Profile>(dispatcher()->profile()), NotificationService::NoDetails()); return true; @@ -40,7 +41,7 @@ bool ExtensionTestFailFunction::RunImpl() { std::string message; EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &message)); NotificationService::current()->Notify( - NotificationType::EXTENSION_TEST_FAILED, + chrome::NOTIFICATION_EXTENSION_TEST_FAILED, Source<Profile>(dispatcher()->profile()), Details<std::string>(&message)); return true; @@ -80,7 +81,7 @@ bool ExtensionTestSendMessageFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &message)); AddRef(); // balanced in Reply NotificationService::current()->Notify( - NotificationType::EXTENSION_TEST_MESSAGE, + chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, Source<ExtensionTestSendMessageFunction>(this), Details<std::string>(&message)); return true; diff --git a/chrome/browser/extensions/extension_test_message_listener.cc b/chrome/browser/extensions/extension_test_message_listener.cc index 444b700..8067be5 100644 --- a/chrome/browser/extensions/extension_test_message_listener.cc +++ b/chrome/browser/extensions/extension_test_message_listener.cc @@ -5,9 +5,9 @@ #include "chrome/browser/extensions/extension_test_message_listener.h" #include "chrome/browser/extensions/extension_test_api.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/ui_test_utils.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" ExtensionTestMessageListener::ExtensionTestMessageListener( const std::string& expected_message, @@ -16,7 +16,7 @@ ExtensionTestMessageListener::ExtensionTestMessageListener( satisfied_(false), waiting_(false), will_reply_(will_reply) { - registrar_.Add(this, NotificationType::EXTENSION_TEST_MESSAGE, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, NotificationService::AllSources()); } @@ -39,7 +39,7 @@ void ExtensionTestMessageListener::Reply(const std::string& message) { } void ExtensionTestMessageListener::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { const std::string& content = *Details<std::string>(details).ptr(); diff --git a/chrome/browser/extensions/extension_test_message_listener.h b/chrome/browser/extensions/extension_test_message_listener.h index fa06dc7..66be515 100644 --- a/chrome/browser/extensions/extension_test_message_listener.h +++ b/chrome/browser/extensions/extension_test_message_listener.h @@ -59,7 +59,7 @@ class ExtensionTestMessageListener : public NotificationObserver { void Reply(const std::string& message); // Implements the NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_toolbar_model.cc b/chrome/browser/extensions/extension_toolbar_model.cc index 659f7a4..d71f620 100644 --- a/chrome/browser/extensions/extension_toolbar_model.cc +++ b/chrome/browser/extensions/extension_toolbar_model.cc @@ -8,6 +8,7 @@ #include "chrome/browser/extensions/extension_service.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/common/notification_service.h" @@ -18,15 +19,15 @@ ExtensionToolbarModel::ExtensionToolbarModel(ExtensionService* service) extensions_initialized_(false) { DCHECK(service_); - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(service_->profile())); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(service_->profile())); - registrar_.Add(this, NotificationType::EXTENSIONS_READY, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, Source<Profile>(service_->profile())); - registrar_.Add(this, - NotificationType::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, - NotificationService::AllSources()); + registrar_.Add( + this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, + NotificationService::AllSources()); visible_icon_count_ = prefs_->GetInteger(prefs::kExtensionToolbarSize); } @@ -79,10 +80,10 @@ void ExtensionToolbarModel::SetVisibleIconCount(int count) { prefs_->ScheduleSavePersistentPrefs(); } -void ExtensionToolbarModel::Observe(NotificationType type, +void ExtensionToolbarModel::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::EXTENSIONS_READY) { + if (type == chrome::NOTIFICATION_EXTENSIONS_READY) { InitializeExtensionList(); return; } @@ -91,12 +92,12 @@ void ExtensionToolbarModel::Observe(NotificationType type, return; const Extension* extension = NULL; - if (type == NotificationType::EXTENSION_UNLOADED) { + if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { extension = Details<UnloadedExtensionInfo>(details)->extension; } else { extension = Details<const Extension>(details).ptr(); } - if (type == NotificationType::EXTENSION_LOADED) { + if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { // We don't want to add the same extension twice. It may have already been // added by EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED below, if the user // hides the browser action and then disables and enables the extension. @@ -106,10 +107,11 @@ void ExtensionToolbarModel::Observe(NotificationType type, } if (service_->GetBrowserActionVisibility(extension)) AddExtension(extension); - } else if (type == NotificationType::EXTENSION_UNLOADED) { + } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { RemoveExtension(extension); - } else if (type == - NotificationType::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED) { + } else if ( + type == + chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED) { if (service_->GetBrowserActionVisibility(extension)) AddExtension(extension); else diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h index 3b1642d..e60d7e0 100644 --- a/chrome/browser/extensions/extension_toolbar_model.h +++ b/chrome/browser/extensions/extension_toolbar_model.h @@ -74,7 +74,7 @@ class ExtensionToolbarModel : public NotificationObserver { private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index aa4c14c9..797b371 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -29,6 +29,7 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_utility_messages.h" #include "chrome/common/chrome_version_info.h" @@ -894,7 +895,7 @@ bool ExtensionUpdater::MaybeInstallCRXFile() { // Source parameter ensures that we only see the completion event for the // the installer we started. registrar_.Add(this, - NotificationType::CRX_INSTALLER_DONE, + chrome::NOTIFICATION_CRX_INSTALLER_DONE, Source<CrxInstaller>(installer)); } in_progress_ids_.erase(crx_file.id); @@ -905,14 +906,14 @@ bool ExtensionUpdater::MaybeInstallCRXFile() { return crx_install_is_running_; } -void ExtensionUpdater::Observe(NotificationType type, +void ExtensionUpdater::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - 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); crx_install_is_running_ = false; // If any files are available to update, start one. @@ -1207,14 +1208,14 @@ void ExtensionUpdater::FetchUpdatedExtension(const std::string& id, void ExtensionUpdater::NotifyStarted() { NotificationService::current()->Notify( - NotificationType::EXTENSION_UPDATING_STARTED, + chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, Source<Profile>(profile_), NotificationService::NoDetails()); } void ExtensionUpdater::NotifyUpdateFound(const std::string& extension_id) { NotificationService::current()->Notify( - NotificationType::EXTENSION_UPDATE_FOUND, + chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, Source<Profile>(profile_), Details<const std::string>(&extension_id)); } @@ -1222,7 +1223,7 @@ void ExtensionUpdater::NotifyUpdateFound(const std::string& extension_id) { void ExtensionUpdater::NotifyIfFinished() { if (in_progress_ids_.empty()) { NotificationService::current()->Notify( - NotificationType::EXTENSION_UPDATING_FINISHED, + chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED, Source<Profile>(profile_), NotificationService::NoDetails()); VLOG(1) << "Sending EXTENSION_UPDATING_FINISHED"; diff --git a/chrome/browser/extensions/extension_updater.h b/chrome/browser/extensions/extension_updater.h index 1be1439..d2db59e 100644 --- a/chrome/browser/extensions/extension_updater.h +++ b/chrome/browser/extensions/extension_updater.h @@ -332,7 +332,7 @@ class ExtensionUpdater : public URLFetcher::Delegate, bool MaybeInstallCRXFile(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_web_socket_proxy_private_api.cc b/chrome/browser/extensions/extension_web_socket_proxy_private_api.cc index 08d1518..115c0b9 100644 --- a/chrome/browser/extensions/extension_web_socket_proxy_private_api.cc +++ b/chrome/browser/extensions/extension_web_socket_proxy_private_api.cc @@ -40,7 +40,7 @@ bool WebSocketProxyPrivateGetPassportForTCPFunction::RunImpl() { if (!chromeos::WebSocketProxyController::IsInitiated()) { delay_response = true; registrar_.Add( - this, NotificationType::WEB_SOCKET_PROXY_STARTED, + this, chrome::WEB_SOCKET_PROXY_STARTED, NotificationService::AllSources()); chromeos::WebSocketProxyController::Initiate(); } @@ -67,10 +67,10 @@ bool WebSocketProxyPrivateGetPassportForTCPFunction::RunImpl() { } void WebSocketProxyPrivateGetPassportForTCPFunction::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { #if defined(OS_CHROMEOS) - DCHECK(type.value == NotificationType::WEB_SOCKET_PROXY_STARTED); + DCHECK(type == chrome::WEB_SOCKET_PROXY_STARTED); #else NOTREACHED(); #endif diff --git a/chrome/browser/extensions/extension_web_socket_proxy_private_api.h b/chrome/browser/extensions/extension_web_socket_proxy_private_api.h index e65a034..ece09a4 100644 --- a/chrome/browser/extensions/extension_web_socket_proxy_private_api.h +++ b/chrome/browser/extensions/extension_web_socket_proxy_private_api.h @@ -24,7 +24,7 @@ class WebSocketProxyPrivateGetPassportForTCPFunction // NotificationObserver implementation. virtual void Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; // Finalizes async operation. diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc index 513760e..bf395ab 100644 --- a/chrome/browser/extensions/extension_webnavigation_api.cc +++ b/chrome/browser/extensions/extension_webnavigation_api.cc @@ -255,17 +255,17 @@ ExtensionWebNavigationEventRouter::~ExtensionWebNavigationEventRouter() {} void ExtensionWebNavigationEventRouter::Init() { if (registrar_.IsEmpty()) { registrar_.Add(this, - NotificationType::CREATING_NEW_WINDOW, + content::NOTIFICATION_CREATING_NEW_WINDOW, NotificationService::AllSources()); } } void ExtensionWebNavigationEventRouter::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::CREATING_NEW_WINDOW: + switch (type) { + case content::NOTIFICATION_CREATING_NEW_WINDOW: CreatingNewWindow( Source<TabContents>(source).ptr(), Details<const ViewHostMsg_CreateWindow_Params>(details).ptr()); diff --git a/chrome/browser/extensions/extension_webnavigation_api.h b/chrome/browser/extensions/extension_webnavigation_api.h index 431507d..e2e3816 100644 --- a/chrome/browser/extensions/extension_webnavigation_api.h +++ b/chrome/browser/extensions/extension_webnavigation_api.h @@ -141,7 +141,7 @@ class ExtensionWebNavigationEventRouter : public NotificationObserver { private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_webstore_private_api.cc b/chrome/browser/extensions/extension_webstore_private_api.cc index 4fe40ed..b0a6445 100644 --- a/chrome/browser/extensions/extension_webstore_private_api.cc +++ b/chrome/browser/extensions/extension_webstore_private_api.cc @@ -19,6 +19,7 @@ #include "chrome/browser/net/gaia/token_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_utility_messages.h" #include "chrome/common/extensions/extension_constants.h" @@ -28,7 +29,6 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "net/base/escape.h" @@ -591,10 +591,10 @@ bool PromptBrowserLoginFunction::RunImpl() { // Start listening for notifications about the token. TokenService* token_service = profile->GetTokenService(); registrar_.Add(this, - NotificationType::TOKEN_AVAILABLE, + chrome::NOTIFICATION_TOKEN_AVAILABLE, Source<TokenService>(token_service)); registrar_.Add(this, - NotificationType::TOKEN_REQUEST_FAILED, + chrome::NOTIFICATION_TOKEN_REQUEST_FAILED, Source<TokenService>(token_service)); GetBrowserSignin(profile)->RequestSignin(tab, @@ -646,16 +646,16 @@ void PromptBrowserLoginFunction::OnLoginFailure( Release(); } -void PromptBrowserLoginFunction::Observe(NotificationType type, +void PromptBrowserLoginFunction::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Make sure this notification is for the service we are interested in. std::string service; - if (type == NotificationType::TOKEN_AVAILABLE) { + if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { TokenService::TokenAvailableDetails* available = Details<TokenService::TokenAvailableDetails>(details).ptr(); service = available->service(); - } else if (type == NotificationType::TOKEN_REQUEST_FAILED) { + } else if (type == chrome::NOTIFICATION_TOKEN_REQUEST_FAILED) { TokenService::TokenRequestFailedDetails* failed = Details<TokenService::TokenRequestFailedDetails>(details).ptr(); service = failed->service(); diff --git a/chrome/browser/extensions/extension_webstore_private_api.h b/chrome/browser/extensions/extension_webstore_private_api.h index 0a6dd0a..59ee0a1 100644 --- a/chrome/browser/extensions/extension_webstore_private_api.h +++ b/chrome/browser/extensions/extension_webstore_private_api.h @@ -148,7 +148,7 @@ class PromptBrowserLoginFunction : public AsyncExtensionFunction, virtual void OnLoginFailure(const GoogleServiceAuthError& error); // Implements the NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/extension_webstore_private_apitest.cc b/chrome/browser/extensions/extension_webstore_private_apitest.cc index 9bd6ac8..41c17d0c 100644 --- a/chrome/browser/extensions/extension_webstore_private_apitest.cc +++ b/chrome/browser/extensions/extension_webstore_private_apitest.cc @@ -9,6 +9,7 @@ #include "chrome/browser/extensions/extension_webstore_private_api.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/ui_test_utils.h" #include "content/common/notification_observer.h" @@ -91,7 +92,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallNoGesture) { IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest1) { ui_test_utils::WindowedNotificationObserver observer( - NotificationType::EXTENSION_INSTALL_ERROR, + chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); ASSERT_TRUE(RunInstallTest("incorrect_manifest1.html", "extension.crx")); observer.Wait(); @@ -100,7 +101,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, IncorrectManifest2) { ui_test_utils::WindowedNotificationObserver observer( - NotificationType::EXTENSION_INSTALL_ERROR, + chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); ASSERT_TRUE(RunInstallTest("incorrect_manifest2.html", "extension.crx")); observer.Wait(); diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index 3b7729a..915f2ce 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -28,6 +28,7 @@ #include "chrome/browser/tab_contents/background_contents.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/webui/extension_icon_source.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/url_pattern.h" @@ -41,8 +42,8 @@ #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "grit/browser_resources.h" #include "grit/chromium_strings.h" @@ -290,31 +291,31 @@ void ExtensionsDOMHandler::HandleRequestExtensionsData(const ListValue* args) { void ExtensionsDOMHandler::RegisterForNotifications() { // Register for notifications that we need to reload the page. - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_PROCESS_CREATED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::NAV_ENTRY_COMMITTED, + content::NOTIFICATION_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::RENDER_VIEW_HOST_CREATED, + content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::RENDER_VIEW_HOST_DELETED, + content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::BACKGROUND_CONTENTS_NAVIGATED, + chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::BACKGROUND_CONTENTS_DELETED, + chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, + chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, NotificationService::AllSources()); } @@ -617,10 +618,10 @@ void ExtensionsDOMHandler::MultiFilesSelected( NOTREACHED(); } -void ExtensionsDOMHandler::Observe(NotificationType type, +void ExtensionsDOMHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { + switch (type) { // We listen for notifications that will result in the page being // repopulated with data twice for the same event in certain cases. // For instance, EXTENSION_LOADED & EXTENSION_PROCESS_CREATED because @@ -635,22 +636,22 @@ void ExtensionsDOMHandler::Observe(NotificationType type, // // Doing it this way gets everything but causes the page to be rendered // more than we need. It doesn't seem to result in any noticeable flicker. - case NotificationType::RENDER_VIEW_HOST_DELETED: + case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED: deleting_rvh_ = Source<RenderViewHost>(source).ptr(); MaybeUpdateAfterNotification(); break; - case NotificationType::BACKGROUND_CONTENTS_DELETED: + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED: deleting_rvh_ = Details<BackgroundContents>(details)->render_view_host(); MaybeUpdateAfterNotification(); break; - case NotificationType::EXTENSION_LOADED: - case NotificationType::EXTENSION_PROCESS_CREATED: - case NotificationType::EXTENSION_UNLOADED: - case NotificationType::EXTENSION_UPDATE_DISABLED: - case NotificationType::RENDER_VIEW_HOST_CREATED: - case NotificationType::NAV_ENTRY_COMMITTED: - case NotificationType::BACKGROUND_CONTENTS_NAVIGATED: - case NotificationType::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED: + case chrome::NOTIFICATION_EXTENSION_LOADED: + case chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED: + case chrome::NOTIFICATION_EXTENSION_UNLOADED: + case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: + case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED: + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED: + case chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED: MaybeUpdateAfterNotification(); break; default: diff --git a/chrome/browser/extensions/extensions_ui.h b/chrome/browser/extensions/extensions_ui.h index d8ba972..2b20716 100644 --- a/chrome/browser/extensions/extensions_ui.h +++ b/chrome/browser/extensions/extensions_ui.h @@ -154,7 +154,7 @@ class ExtensionsDOMHandler : public WebUIMessageHandler, virtual void FileSelectionCanceled(void* params) {} // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/external_policy_extension_loader.cc b/chrome/browser/extensions/external_policy_extension_loader.cc index 4d9401e..69cc317 100644 --- a/chrome/browser/extensions/external_policy_extension_loader.cc +++ b/chrome/browser/extensions/external_policy_extension_loader.cc @@ -11,8 +11,8 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" namespace { @@ -41,7 +41,7 @@ ExternalPolicyExtensionLoader::ExternalPolicyExtensionLoader( pref_change_registrar_.Init(profile_->GetPrefs()); pref_change_registrar_.Add(prefs::kExtensionInstallForceList, this); notification_registrar_.Add(this, - NotificationType::PROFILE_DESTROYED, + chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); } @@ -73,12 +73,12 @@ void ExternalPolicyExtensionLoader::StartLoading() { } void ExternalPolicyExtensionLoader::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { if (profile_ == NULL) return; - switch (type.value) { - case NotificationType::PREF_CHANGED: { + switch (type) { + case chrome::NOTIFICATION_PREF_CHANGED: { if (Source<PrefService>(source).ptr() == profile_->GetPrefs()) { std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kExtensionInstallForceList) { @@ -89,7 +89,7 @@ void ExternalPolicyExtensionLoader::Observe( } break; } - case NotificationType::PROFILE_DESTROYED: { + case chrome::NOTIFICATION_PROFILE_DESTROYED: { if (Source<Profile>(source).ptr() == profile_) { notification_registrar_.RemoveAll(); pref_change_registrar_.RemoveAll(); diff --git a/chrome/browser/extensions/external_policy_extension_loader.h b/chrome/browser/extensions/external_policy_extension_loader.h index 3d36b94..d346daca 100644 --- a/chrome/browser/extensions/external_policy_extension_loader.h +++ b/chrome/browser/extensions/external_policy_extension_loader.h @@ -26,7 +26,7 @@ class ExternalPolicyExtensionLoader explicit ExternalPolicyExtensionLoader(Profile* profile); // NotificationObserver implementation - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/image_loading_tracker.cc b/chrome/browser/extensions/image_loading_tracker.cc index 5f7ffa8..9fab9cb 100644 --- a/chrome/browser/extensions/image_loading_tracker.cc +++ b/chrome/browser/extensions/image_loading_tracker.cc @@ -8,8 +8,8 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_resource.h" #include "content/browser/browser_thread.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "skia/ext/image_operations.h" #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/glue/image_decoder.h" @@ -121,7 +121,7 @@ class ImageLoadingTracker::ImageLoader ImageLoadingTracker::ImageLoadingTracker(Observer* observer) : observer_(observer), next_id_(0) { - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); } @@ -179,10 +179,10 @@ void ImageLoadingTracker::OnImageLoaded( observer_->OnImageLoaded(image, resource, id); } -void ImageLoadingTracker::Observe(NotificationType type, +void ImageLoadingTracker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::EXTENSION_UNLOADED); + DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); const Extension* extension = Details<UnloadedExtensionInfo>(details)->extension; diff --git a/chrome/browser/extensions/image_loading_tracker.h b/chrome/browser/extensions/image_loading_tracker.h index ca0d863..a48a6ef 100644 --- a/chrome/browser/extensions/image_loading_tracker.h +++ b/chrome/browser/extensions/image_loading_tracker.h @@ -86,7 +86,7 @@ class ImageLoadingTracker : public NotificationObserver { // NotificationObserver method. If an extension is uninstalled while we're // waiting for the image we remove the entry from load_map_. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/image_loading_tracker_unittest.cc b/chrome/browser/extensions/image_loading_tracker_unittest.cc index f98edb7..6e85d8a 100644 --- a/chrome/browser/extensions/image_loading_tracker_unittest.cc +++ b/chrome/browser/extensions/image_loading_tracker_unittest.cc @@ -5,6 +5,7 @@ #include "base/message_loop.h" #include "base/path_service.h" #include "chrome/browser/extensions/image_loading_tracker.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_icon_set.h" @@ -12,7 +13,6 @@ #include "content/browser/browser_thread.h" #include "content/common/json_value_serializer.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/size.h" @@ -163,7 +163,7 @@ TEST_F(ImageLoadingTrackerTest, DeleteExtensionWhileWaitingForCache) { UnloadedExtensionInfo details(extension.get(), UnloadedExtensionInfo::UNINSTALL); NotificationService::current()->Notify( - NotificationType::EXTENSION_UNLOADED, + chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources(), Details<UnloadedExtensionInfo>(&details)); diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc index 040963f..27e9c03 100644 --- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc +++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc @@ -12,6 +12,7 @@ #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -33,7 +34,7 @@ ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate( previous_using_native_theme_(previous_using_native_theme), tab_contents_(tab_contents) { theme_service_->OnInfobarDisplayed(); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); } @@ -97,10 +98,10 @@ string16 ThemeInstalledInfoBarDelegate::GetButtonLabel( } void ThemeInstalledInfoBarDelegate::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(NotificationType::BROWSER_THEME_CHANGED, type.value); + DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type); // If the new theme is different from what this info bar is associated // with, close this info bar since it is no longer relevant. if (theme_id_ != theme_service_->GetThemeID()) { diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.h b/chrome/browser/extensions/theme_installed_infobar_delegate.h index 9efa54a..581b143 100644 --- a/chrome/browser/extensions/theme_installed_infobar_delegate.h +++ b/chrome/browser/extensions/theme_installed_infobar_delegate.h @@ -48,7 +48,7 @@ class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate, virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc index dcc64c8..ea94bd1 100644 --- a/chrome/browser/extensions/user_script_listener.cc +++ b/chrome/browser/extensions/user_script_listener.cc @@ -6,6 +6,7 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/url_pattern.h" #include "content/browser/browser_thread.h" @@ -19,11 +20,11 @@ UserScriptListener::UserScriptListener() user_scripts_ready_(false) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::USER_SCRIPTS_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, NotificationService::AllSources()); AddRef(); // Will be balanced in Cleanup(). } @@ -120,13 +121,13 @@ void UserScriptListener::CollectURLPatterns(const Extension* extension, } } -void UserScriptListener::Observe(NotificationType type, +void UserScriptListener::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - switch (type.value) { - case NotificationType::EXTENSION_LOADED: { + switch (type) { + case chrome::NOTIFICATION_EXTENSION_LOADED: { const Extension* extension = Details<const Extension>(details).ptr(); if (extension->content_scripts().empty()) return; // no new patterns from this extension. @@ -143,7 +144,7 @@ void UserScriptListener::Observe(NotificationType type, break; } - case NotificationType::EXTENSION_UNLOADED: { + case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* unloaded_extension = Details<UnloadedExtensionInfo>(details)->extension; if (unloaded_extension->content_scripts().empty()) @@ -165,7 +166,7 @@ void UserScriptListener::Observe(NotificationType type, break; } - case NotificationType::USER_SCRIPTS_UPDATED: { + case chrome::NOTIFICATION_USER_SCRIPTS_UPDATED: { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, NewRunnableMethod(this, &UserScriptListener::StartDelayedRequests)); diff --git a/chrome/browser/extensions/user_script_listener.h b/chrome/browser/extensions/user_script_listener.h index da61a36..5ebae08 100644 --- a/chrome/browser/extensions/user_script_listener.h +++ b/chrome/browser/extensions/user_script_listener.h @@ -89,7 +89,7 @@ class UserScriptListener void CollectURLPatterns(const Extension* extension, URLPatterns* patterns); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index e7c912d..cbe946d 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -6,6 +6,7 @@ #include "base/threading/thread.h" #include "chrome/browser/extensions/extension_service_unittest.h" #include "chrome/browser/extensions/user_script_listener.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension_file_util.h" #include "content/browser/mock_resource_context.h" @@ -14,7 +15,6 @@ #include "content/browser/renderer_host/resource_handler.h" #include "content/browser/renderer_host/resource_queue.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_test_job.h" #include "net/url_request/url_request_test_util.h" @@ -184,7 +184,7 @@ TEST_F(UserScriptListenerTest, DelayAndUpdate) { ASSERT_FALSE(request->is_pending()); NotificationService::current()->Notify( - NotificationType::USER_SCRIPTS_UPDATED, + chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, Source<Profile>(profile_.get()), NotificationService::NoDetails()); MessageLoop::current()->RunAllPending(); @@ -207,7 +207,7 @@ TEST_F(UserScriptListenerTest, DelayAndUnload) { ASSERT_FALSE(request->is_pending()); NotificationService::current()->Notify( - NotificationType::USER_SCRIPTS_UPDATED, + chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, Source<Profile>(profile_.get()), NotificationService::NoDetails()); MessageLoop::current()->RunAllPending(); diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index 3772ac6..96ade99b 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -16,6 +16,7 @@ #include "base/version.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/extensions/extension_resource.h" @@ -250,13 +251,13 @@ UserScriptMaster::UserScriptMaster(Profile* profile) : extensions_service_ready_(false), pending_load_(false), profile_(profile) { - registrar_.Add(this, NotificationType::EXTENSIONS_READY, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, Source<Profile>(profile_)); - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(profile_)); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile_)); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, NotificationService::AllSources()); } @@ -286,22 +287,22 @@ void UserScriptMaster::NewScriptsAvailable(base::SharedMemory* handle) { } NotificationService::current()->Notify( - NotificationType::USER_SCRIPTS_UPDATED, + chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, Source<Profile>(profile_), Details<base::SharedMemory>(handle)); } } -void UserScriptMaster::Observe(NotificationType type, +void UserScriptMaster::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { bool should_start_load = false; - switch (type.value) { - case NotificationType::EXTENSIONS_READY: + switch (type) { + case chrome::NOTIFICATION_EXTENSIONS_READY: extensions_service_ready_ = true; should_start_load = true; break; - case NotificationType::EXTENSION_LOADED: { + case chrome::NOTIFICATION_EXTENSION_LOADED: { // Add any content scripts inside the extension. const Extension* extension = Details<const Extension>(details).ptr(); bool incognito_enabled = profile_->GetExtensionService()-> @@ -316,7 +317,7 @@ void UserScriptMaster::Observe(NotificationType type, should_start_load = true; break; } - case NotificationType::EXTENSION_UNLOADED: { + case chrome::NOTIFICATION_EXTENSION_UNLOADED: { // Remove any content scripts. const Extension* extension = Details<UnloadedExtensionInfo>(details)->extension; @@ -334,7 +335,7 @@ void UserScriptMaster::Observe(NotificationType type, break; } - case NotificationType::RENDERER_PROCESS_CREATED: { + case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); if (ScriptsReady()) SendUpdate(process, GetSharedMemory()); diff --git a/chrome/browser/extensions/user_script_master.h b/chrome/browser/extensions/user_script_master.h index f45e11e..2df53d8 100644 --- a/chrome/browser/extensions/user_script_master.h +++ b/chrome/browser/extensions/user_script_master.h @@ -113,7 +113,7 @@ class UserScriptMaster : public base::RefCountedThreadSafe<UserScriptMaster>, private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc index c38f7f6..c5d6af1 100644 --- a/chrome/browser/extensions/user_script_master_unittest.cc +++ b/chrome/browser/extensions/user_script_master_unittest.cc @@ -12,6 +12,7 @@ #include "base/path_service.h" #include "base/scoped_temp_dir.h" #include "base/string_util.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" #include "content/common/notification_registrar.h" @@ -33,7 +34,7 @@ class UserScriptMasterTest : public testing::Test, ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); // Register for all user script notifications. - registrar_.Add(this, NotificationType::USER_SCRIPTS_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_USER_SCRIPTS_UPDATED, NotificationService::AllSources()); // UserScriptMaster posts tasks to the file thread so make the current @@ -49,10 +50,10 @@ class UserScriptMasterTest : public testing::Test, ui_thread_.reset(); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::USER_SCRIPTS_UPDATED); + DCHECK(type == chrome::NOTIFICATION_USER_SCRIPTS_UPDATED); shared_memory_ = Details<base::SharedMemory>(details).ptr(); if (MessageLoop::current() == &message_loop_) diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 83c80a8..2245494 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -32,6 +32,7 @@ #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" #include "chrome/common/automation_messages.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" #include "content/browser/debugger/devtools_toggle_action.h" @@ -177,19 +178,19 @@ bool ExternalTabContainer::Init(Profile* profile, } NavigationController* controller = &tab_contents_->controller(); - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, + registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, + registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, Source<TabContents>(tab_contents_->tab_contents())); - registrar_.Add(this, NotificationType::RENDER_VIEW_HOST_DELETED, + registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, NotificationService::AllSources()); NotificationService::current()->Notify( - NotificationType::EXTERNAL_TAB_CREATED, + chrome::NOTIFICATION_EXTERNAL_TAB_CREATED, Source<NavigationController>(controller), NotificationService::NoDetails()); @@ -233,7 +234,7 @@ void ExternalTabContainer::Uninitialize() { GetWidget()->GetRootView()->RemoveAllChildViews(true); NotificationService::current()->Notify( - NotificationType::EXTERNAL_TAB_CLOSED, + chrome::NOTIFICATION_EXTERNAL_TAB_CLOSED, Source<NavigationController>(&tab_contents_->controller()), Details<ExternalTabContainer>(this)); @@ -701,7 +702,7 @@ void ExternalTabContainer::OnForwardMessageToExternalHost( //////////////////////////////////////////////////////////////////////////////// // ExternalTabContainer, NotificationObserver implementation: -void ExternalTabContainer::Observe(NotificationType type, +void ExternalTabContainer::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (!automation_) @@ -710,8 +711,8 @@ void ExternalTabContainer::Observe(NotificationType type, static const int kHttpClientErrorStart = 400; static const int kHttpServerErrorEnd = 510; - switch (type.value) { - case NotificationType::LOAD_STOP: { + switch (type) { + case content::NOTIFICATION_LOAD_STOP: { const LoadNotificationDetails* load = Details<LoadNotificationDetails>(details).ptr(); if (load != NULL && PageTransition::IsMainFrame(load->origin())) { @@ -722,7 +723,7 @@ void ExternalTabContainer::Observe(NotificationType type, } break; } - case NotificationType::NAV_ENTRY_COMMITTED: { + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { if (ignore_next_load_notification_) { ignore_next_load_notification_ = false; return; @@ -750,7 +751,7 @@ void ExternalTabContainer::Observe(NotificationType type, } break; } - case NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR: { + case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR: { const ProvisionalLoadDetails* load_details = Details<ProvisionalLoadDetails>(details).ptr(); automation_->Send(new AutomationMsg_NavigationFailed( @@ -759,14 +760,14 @@ void ExternalTabContainer::Observe(NotificationType type, ignore_next_load_notification_ = true; break; } - case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: { + case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { if (load_requests_via_automation_) { RenderViewHost* rvh = Details<RenderViewHost>(details).ptr(); RegisterRenderViewHostForAutomation(rvh, false); } break; } - case NotificationType::RENDER_VIEW_HOST_DELETED: { + case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED: { if (load_requests_via_automation_) { RenderViewHost* rvh = Source<RenderViewHost>(source).ptr(); UnregisterRenderViewHost(rvh); diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h index c043c9e..a9a9d57 100644 --- a/chrome/browser/external_tab_container_win.h +++ b/chrome/browser/external_tab_container_win.h @@ -180,7 +180,7 @@ class ExternalTabContainer : public TabContentsDelegate, const std::string& target); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -366,7 +366,7 @@ class TemporaryPopupExternalTabContainer : public ExternalTabContainer { return false; } - virtual void Observe(NotificationType type, const NotificationSource& source, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) {} virtual void OpenURLFromTab(TabContents* source, const GURL& url, diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc index 426d3e7..11b756f 100644 --- a/chrome/browser/favicon/favicon_tab_helper.cc +++ b/chrome/browser/favicon/favicon_tab_helper.cc @@ -8,6 +8,7 @@ #include "chrome/browser/history/history.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/icon_messages.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_controller.h" @@ -137,7 +138,7 @@ void FaviconTabHelper::StartDownload(int id, const GURL& url, int image_size) { void FaviconTabHelper::NotifyFaviconUpdated() { NotificationService::current()->Notify( - NotificationType::FAVICON_UPDATED, + chrome::NOTIFICATION_FAVICON_UPDATED, Source<TabContents>(tab_contents()), NotificationService::NoDetails()); tab_contents()->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index 2480501..4ca416e 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc @@ -238,9 +238,9 @@ void FileSelectHelper::RunFileChooser( DCHECK(!render_view_host_); render_view_host_ = render_view_host; notification_registrar_.RemoveAll(); - notification_registrar_.Add(this, - NotificationType::RENDER_WIDGET_HOST_DESTROYED, - Source<RenderViewHost>(render_view_host)); + notification_registrar_.Add( + this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, + Source<RenderViewHost>(render_view_host)); if (!select_file_dialog_.get()) select_file_dialog_ = SelectFileDialog::Create(this); @@ -289,10 +289,10 @@ void FileSelectHelper::EnumerateDirectory(int request_id, StartNewEnumeration(path, request_id, render_view_host); } -void FileSelectHelper::Observe(NotificationType type, +void FileSelectHelper::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::RENDER_WIDGET_HOST_DESTROYED); + DCHECK(type == content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED); DCHECK(Details<RenderViewHost>(details).ptr() == render_view_host_); render_view_host_ = NULL; } diff --git a/chrome/browser/file_select_helper.h b/chrome/browser/file_select_helper.h index a013715..a2059fd 100644 --- a/chrome/browser/file_select_helper.h +++ b/chrome/browser/file_select_helper.h @@ -74,7 +74,7 @@ class FileSelectHelper virtual void FileSelectionCanceled(void* params) OVERRIDE; // NotificationObserver overrides. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index c678510..a5b1e91 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -27,6 +27,7 @@ #include "chrome/browser/importer/importer_list.h" #include "chrome/browser/importer/importer_progress_dialog.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/worker_thread_ticker.h" #include "chrome/installer/util/browser_distribution.h" @@ -59,18 +60,18 @@ class FirstRunDelayedTasks : public NotificationObserver { explicit FirstRunDelayedTasks(Tasks task) { if (task == INSTALL_EXTENSIONS) { - registrar_.Add(this, NotificationType::EXTENSIONS_READY, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, NotificationService::AllSources()); } - registrar_.Add(this, NotificationType::BROWSER_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, NotificationService::AllSources()); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // After processing the notification we always delete ourselves. - if (type.value == NotificationType::EXTENSIONS_READY) + if (type == chrome::NOTIFICATION_EXTENSIONS_READY) DoExtensionWork(Source<Profile>(source).ptr()->GetExtensionService()); delete this; return; diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc index 3a557bb..c2db97f 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc @@ -23,9 +23,9 @@ #include "content/browser/browser_thread.h" #include "content/browser/geolocation/geolocation_provider.h" #include "content/browser/renderer_host/render_process_host.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/theme_resources.h" @@ -81,7 +81,7 @@ class GeolocationInfoBarQueueController : NotificationObserver { bool allowed); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -418,9 +418,9 @@ void GeolocationInfoBarQueueController::OnPermissionSet( } void GeolocationInfoBarQueueController::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, source); TabContents* tab_contents = Source<TabContents>(source).ptr(); for (PendingInfoBarRequests::iterator i = pending_infobar_requests_.begin(); @@ -451,10 +451,10 @@ void GeolocationInfoBarQueueController::ShowQueuedInfoBar(int render_process_id, } if (!i->infobar_delegate) { - if (!registrar_.IsRegistered(this, - NotificationType::TAB_CONTENTS_DESTROYED, - Source<TabContents>(tab_contents))) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + if (!registrar_.IsRegistered( + this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, + Source<TabContents>(tab_contents))) { + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents)); } i->infobar_delegate = new GeolocationConfirmInfoBarDelegate( diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc index b685d3f..86635ac 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc @@ -20,6 +20,7 @@ #include "content/browser/geolocation/mock_location_provider.h" #include "content/browser/renderer_host/mock_render_process_host.h" #include "content/browser/tab_contents/test_tab_contents.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/geolocation_messages.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" @@ -36,7 +37,7 @@ class ClosedDelegateTracker : public NotificationObserver { virtual ~ClosedDelegateTracker(); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -53,17 +54,17 @@ class ClosedDelegateTracker : public NotificationObserver { }; ClosedDelegateTracker::ClosedDelegateTracker() { - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, + registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, NotificationService::AllSources()); } ClosedDelegateTracker::~ClosedDelegateTracker() { } -void ClosedDelegateTracker::Observe(NotificationType type, +void ClosedDelegateTracker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type.value == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED); + DCHECK(type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED); removed_infobar_delegates_.insert( Details<InfoBarRemovedDetails>(details)->first); } diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index bbe01c9..2daa7a9 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc @@ -16,6 +16,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.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/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" @@ -27,7 +28,6 @@ #include "content/common/geoposition.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "net/base/net_util.h" #include "net/test/test_server.h" @@ -44,9 +44,9 @@ class IFrameLoader : public NotificationObserver { javascript_completed_(false) { NavigationController* controller = &browser->GetSelectedTabContents()->controller(); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, + registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, NotificationService::AllSources()); std::string script = base::StringPrintf( "window.domAutomationController.setAutomationId(0);" @@ -71,12 +71,12 @@ class IFrameLoader : public NotificationObserver { GURL iframe_url() const { return iframe_url_; } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::LOAD_STOP) { + if (type == content::NOTIFICATION_LOAD_STOP) { navigation_completed_ = true; - } else if (type == NotificationType::DOM_OPERATION_RESPONSE) { + } else if (type == chrome::NOTIFICATION_DOM_OPERATION_RESPONSE) { Details<DomOperationNotificationDetails> dom_op_details(details); javascript_response_ = dom_op_details->json(); javascript_completed_ = true; @@ -112,17 +112,17 @@ class GeolocationNotificationObserver : public NotificationObserver { infobar_(NULL), navigation_started_(false), navigation_completed_(false) { - registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, + registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, NotificationService::AllSources()); if (wait_for_infobar) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_ADDED, + registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, NotificationService::AllSources()); } else { - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::LOAD_START, + registrar_.Add(this, content::NOTIFICATION_LOAD_START, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); } } @@ -147,21 +147,21 @@ class GeolocationNotificationObserver : public NotificationObserver { } // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::TAB_CONTENTS_INFOBAR_ADDED) { + if (type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED) { infobar_ = Details<InfoBarAddedDetails>(details).ptr(); ASSERT_TRUE(infobar_->GetIcon()); ASSERT_TRUE(infobar_->AsConfirmInfoBarDelegate()); - } else if (type == NotificationType::DOM_OPERATION_RESPONSE) { + } else if (type == chrome::NOTIFICATION_DOM_OPERATION_RESPONSE) { Details<DomOperationNotificationDetails> dom_op_details(details); javascript_response_ = dom_op_details->json(); LOG(WARNING) << "javascript_response " << javascript_response_; - } else if (type == NotificationType::NAV_ENTRY_COMMITTED || - type == NotificationType::LOAD_START) { + } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED || + type == content::NOTIFICATION_LOAD_START) { navigation_started_ = true; - } else if (type == NotificationType::LOAD_STOP) { + } else if (type == content::NOTIFICATION_LOAD_STOP) { if (navigation_started_) { navigation_started_ = false; navigation_completed_ = true; diff --git a/chrome/browser/geolocation/geolocation_content_settings_map.cc b/chrome/browser/geolocation/geolocation_content_settings_map.cc index 8f65eb5..7c90c58 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_map.cc +++ b/chrome/browser/geolocation/geolocation_content_settings_map.cc @@ -24,12 +24,12 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "net/base/dns_util.h" #include "net/base/static_cookie_policy.h" @@ -43,7 +43,7 @@ GeolocationContentSettingsMap::GeolocationContentSettingsMap(Profile* profile) prefs_registrar_.Init(profile_->GetPrefs()); prefs_registrar_.Add(prefs::kGeolocationDefaultContentSetting, this); prefs_registrar_.Add(prefs::kGeolocationContentSettings, this); - notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); } @@ -199,16 +199,16 @@ void GeolocationContentSettingsMap::ResetToDefault() { void GeolocationContentSettingsMap::NotifyObservers( const ContentSettingsDetails& details) { NotificationService::current()->Notify( - NotificationType::GEOLOCATION_SETTINGS_CHANGED, + chrome::NOTIFICATION_GEOLOCATION_SETTINGS_CHANGED, Source<GeolocationContentSettingsMap>(this), Details<const ContentSettingsDetails>(&details)); } void GeolocationContentSettingsMap::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { const std::string& name = *Details<std::string>(details).ptr(); if (name == prefs::kGeolocationDefaultContentSetting) { ContentSettingsDetails details(ContentSettingsPattern(), @@ -217,7 +217,7 @@ void GeolocationContentSettingsMap::Observe( std::string()); NotifyObservers(details); } - } else if (NotificationType::PROFILE_DESTROYED == type) { + } else if (chrome::NOTIFICATION_PROFILE_DESTROYED == type) { UnregisterObservers(); } else { NOTREACHED(); @@ -229,7 +229,7 @@ void GeolocationContentSettingsMap::UnregisterObservers() { if (!profile_) return; prefs_registrar_.RemoveAll(); - notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Remove(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); profile_ = NULL; } diff --git a/chrome/browser/geolocation/geolocation_content_settings_map.h b/chrome/browser/geolocation/geolocation_content_settings_map.h index a6d189f..0aa1309 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_map.h +++ b/chrome/browser/geolocation/geolocation_content_settings_map.h @@ -91,7 +91,7 @@ class GeolocationContentSettingsMap void ResetToDefault(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc index 74a3626..af6bec9 100644 --- a/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc +++ b/chrome/browser/geolocation/geolocation_content_settings_map_unittest.cc @@ -7,6 +7,7 @@ #include "chrome/browser/geolocation/geolocation_content_settings_map.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" @@ -23,7 +24,7 @@ class MockGeolocationSettingsObserver : public NotificationObserver { public: MockGeolocationSettingsObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -36,12 +37,12 @@ class MockGeolocationSettingsObserver : public NotificationObserver { }; MockGeolocationSettingsObserver::MockGeolocationSettingsObserver() { - registrar_.Add(this, NotificationType::GEOLOCATION_SETTINGS_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_GEOLOCATION_SETTINGS_CHANGED, NotificationService::AllSources()); } void MockGeolocationSettingsObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { GeolocationContentSettingsMap* map = diff --git a/chrome/browser/google/google_url_tracker.cc b/chrome/browser/google/google_url_tracker.cc index b50d34c..ad87589 100644 --- a/chrome/browser/google/google_url_tracker.cc +++ b/chrome/browser/google/google_url_tracker.cc @@ -14,6 +14,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/navigation_controller.h" @@ -257,9 +258,10 @@ void GoogleURLTracker::AcceptGoogleURL(const GURL& new_google_url) { google_url_.spec()); g_browser_process->local_state()->SetString(prefs::kLastPromptedGoogleURL, google_url_.spec()); - NotificationService::current()->Notify(NotificationType::GOOGLE_URL_UPDATED, - NotificationService::AllSources(), - NotificationService::NoDetails()); + NotificationService::current()->Notify( + chrome::NOTIFICATION_GOOGLE_URL_UPDATED, + NotificationService::AllSources(), + NotificationService::NoDetails()); need_to_prompt_ = false; } @@ -288,26 +290,26 @@ void GoogleURLTracker::RedoSearch() { PageTransition::GENERATED); } -void GoogleURLTracker::Observe(NotificationType type, +void GoogleURLTracker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::NAV_ENTRY_PENDING: { + switch (type) { + case content::NOTIFICATION_NAV_ENTRY_PENDING: { NavigationController* controller = Source<NavigationController>(source).ptr(); OnNavigationPending(source, controller->pending_entry()->url()); break; } - case NotificationType::NAV_ENTRY_COMMITTED: - case NotificationType::TAB_CLOSED: + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: + case content::NOTIFICATION_TAB_CLOSED: OnNavigationCommittedOrTabClosed( Source<NavigationController>(source).ptr()->tab_contents(), - type.value); + type); break; default: - NOTREACHED() << "Unknown notification received:" << type.value; + NOTREACHED() << "Unknown notification received:" << type; } } @@ -320,7 +322,7 @@ void GoogleURLTracker::SearchCommitted() { if (registrar_.IsEmpty() && (need_to_prompt_ || fetcher_.get())) { // This notification will fire a bit later in the same call chain we're // currently in. - registrar_.Add(this, NotificationType::NAV_ENTRY_PENDING, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, NotificationService::AllSources()); } } @@ -329,22 +331,22 @@ void GoogleURLTracker::OnNavigationPending(const NotificationSource& source, const GURL& pending_url) { controller_ = Source<NavigationController>(source).ptr(); search_url_ = pending_url; - registrar_.Remove(this, NotificationType::NAV_ENTRY_PENDING, + registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, NotificationService::AllSources()); // Start listening for the commit notification. We also need to listen for the // tab close command since that means the load will never commit. - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(controller_)); - registrar_.Add(this, NotificationType::TAB_CLOSED, + registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, Source<NavigationController>(controller_)); } void GoogleURLTracker::OnNavigationCommittedOrTabClosed( TabContents* tab_contents, - NotificationType::Type type) { + int type) { registrar_.RemoveAll(); - if (type == NotificationType::NAV_ENTRY_COMMITTED) { + if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { ShowGoogleURLInfoBarIfNecessary(tab_contents); } else { controller_ = NULL; diff --git a/chrome/browser/google/google_url_tracker.h b/chrome/browser/google/google_url_tracker.h index c95a229..96ba592 100644 --- a/chrome/browser/google/google_url_tracker.h +++ b/chrome/browser/google/google_url_tracker.h @@ -89,7 +89,7 @@ class GoogleURLTracker : public URLFetcher::Delegate, const GURL&); // Registers consumer interest in getting an updated URL from the server. - // It will be notified as NotificationType::GOOGLE_URL_UPDATED, so the + // It will be notified as chrome::GOOGLE_URL_UPDATED, so the // consumer should observe this notification before calling this. void SetNeedToFetch(); @@ -114,7 +114,7 @@ class GoogleURLTracker : public URLFetcher::Delegate, const std::string& data); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -125,7 +125,7 @@ class GoogleURLTracker : public URLFetcher::Delegate, void OnNavigationPending(const NotificationSource& source, const GURL& pending_url); void OnNavigationCommittedOrTabClosed(TabContents* tab_contents, - NotificationType::Type type); + int type); void ShowGoogleURLInfoBarIfNecessary(TabContents* tab_contents); NotificationRegistrar registrar_; @@ -147,7 +147,7 @@ class GoogleURLTracker : public URLFetcher::Delegate, // updated URL. If this is never set, we won't // bother to fetch anything. // Consumers should observe - // NotificationType::GOOGLE_URL_UPDATED. + // chrome::GOOGLE_URL_UPDATED. bool need_to_prompt_; // True if the last fetched Google URL is not // matched with current user's default Google URL // nor the last prompted Google URL. diff --git a/chrome/browser/google/google_url_tracker_unittest.cc b/chrome/browser/google/google_url_tracker_unittest.cc index ceb1a30..a704795 100644 --- a/chrome/browser/google/google_url_tracker_unittest.cc +++ b/chrome/browser/google/google_url_tracker_unittest.cc @@ -9,6 +9,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_browser_process_test.h" #include "chrome/test/testing_pref_service.h" @@ -30,7 +31,7 @@ class TestNotificationObserver : public NotificationObserver { TestNotificationObserver(); virtual ~TestNotificationObserver(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); bool notified() const { return notified_; } @@ -46,7 +47,7 @@ TestNotificationObserver::TestNotificationObserver() : notified_(false) { TestNotificationObserver::~TestNotificationObserver() { } -void TestNotificationObserver::Observe(NotificationType type, +void TestNotificationObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { notified_ = true; @@ -186,9 +187,9 @@ void GoogleURLTrackerTest::MockSearchDomainCheckResponse( void GoogleURLTrackerTest::RequestServerCheck() { if (!registrar_.IsRegistered(observer_.get(), - NotificationType::GOOGLE_URL_UPDATED, + chrome::NOTIFICATION_GOOGLE_URL_UPDATED, NotificationService::AllSources())) { - registrar_.Add(observer_.get(), NotificationType::GOOGLE_URL_UPDATED, + registrar_.Add(observer_.get(), chrome::NOTIFICATION_GOOGLE_URL_UPDATED, NotificationService::AllSources()); } GoogleURLTracker::RequestServerCheck(); @@ -228,7 +229,7 @@ void GoogleURLTrackerTest::SearchCommitted(const GURL& search_url) { g_browser_process->google_url_tracker(); google_url_tracker->SearchCommitted(); if (google_url_tracker->registrar_.IsRegistered(google_url_tracker, - NotificationType::NAV_ENTRY_PENDING, + content::NOTIFICATION_NAV_ENTRY_PENDING, NotificationService::AllSources())) google_url_tracker->search_url_ = search_url; } diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc index a672e27..0542ab8 100644 --- a/chrome/browser/history/expire_history_backend.cc +++ b/chrome/browser/history/expire_history_backend.cc @@ -17,7 +17,7 @@ #include "chrome/browser/history/text_database.h" #include "chrome/browser/history/text_database_manager.h" #include "chrome/browser/history/thumbnail_database.h" -#include "content/common/notification_type.h" +#include "chrome/common/chrome_notification_types.h" using base::Time; using base::TimeDelta; @@ -346,8 +346,8 @@ void ExpireHistoryBackend::BroadcastDeleteNotifications( if (dependencies->deleted_urls[i].typed_count() > 0) typed_urls_changed.push_back(dependencies->deleted_urls[i]); } - delegate_->BroadcastNotifications(NotificationType::HISTORY_URLS_DELETED, - deleted_details); + delegate_->BroadcastNotifications( + chrome::NOTIFICATION_HISTORY_URLS_DELETED, deleted_details); } } diff --git a/chrome/browser/history/expire_history_backend.h b/chrome/browser/history/expire_history_backend.h index c2704c2a..753331a 100644 --- a/chrome/browser/history/expire_history_backend.h +++ b/chrome/browser/history/expire_history_backend.h @@ -19,7 +19,6 @@ class BookmarkService; class GURL; -class NotificationType; class TestingProfile; namespace history { @@ -35,7 +34,7 @@ class BroadcastNotificationDelegate { public: // Schedules a broadcast of the given notification on the application main // thread. The details argument will have ownership taken by this function. - virtual void BroadcastNotifications(NotificationType type, + virtual void BroadcastNotifications(int type, HistoryDetails* details_deleted) = 0; protected: diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc index dde8c0d..414f662 100644 --- a/chrome/browser/history/expire_history_backend_unittest.cc +++ b/chrome/browser/history/expire_history_backend_unittest.cc @@ -22,6 +22,7 @@ #include "chrome/browser/history/text_database_manager.h" #include "chrome/browser/history/thumbnail_database.h" #include "chrome/browser/history/top_sites.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/thumbnail_score.h" #include "chrome/test/testing_profile.h" #include "chrome/tools/profiles/thumbnail-inl.h" @@ -119,7 +120,7 @@ class ExpireHistoryTest : public testing::Test, // Notifications intended to be broadcast, we can check these values to make // sure that the deletor is doing the correct broadcasts. We own the details // pointers. - typedef std::vector< std::pair<NotificationType, HistoryDetails*> > + typedef std::vector< std::pair<int, HistoryDetails*> > NotificationList; NotificationList notifications_; @@ -168,7 +169,7 @@ class ExpireHistoryTest : public testing::Test, } // BroadcastNotificationDelegate implementation. - void BroadcastNotifications(NotificationType type, + void BroadcastNotifications(int type, HistoryDetails* details_deleted) { // This gets called when there are notifications to broadcast. Instead, we // store them so we can tell that the correct notifications were sent. @@ -376,7 +377,7 @@ void ExpireHistoryTest::EnsureURLInfoGone(const URLRow& row) { bool found_delete_notification = false; for (size_t i = 0; i < notifications_.size(); i++) { - if (notifications_[i].first == NotificationType::HISTORY_URLS_DELETED) { + if (notifications_[i].first == chrome::NOTIFICATION_HISTORY_URLS_DELETED) { const URLsDeletedDetails* deleted_details = reinterpret_cast<URLsDeletedDetails*>(notifications_[i].second); if (deleted_details->urls.find(row.url()) != @@ -384,9 +385,10 @@ void ExpireHistoryTest::EnsureURLInfoGone(const URLRow& row) { found_delete_notification = true; } } else { - EXPECT_NE(notifications_[i].first, NotificationType::HISTORY_URL_VISITED); EXPECT_NE(notifications_[i].first, - NotificationType::HISTORY_TYPED_URLS_MODIFIED); + chrome::NOTIFICATION_HISTORY_URL_VISITED); + EXPECT_NE(notifications_[i].first, + chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED); } } EXPECT_TRUE(found_delete_notification); diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc index 74cb0b3..92f0e16 100644 --- a/chrome/browser/history/history.cc +++ b/chrome/browser/history/history.cc @@ -44,6 +44,7 @@ #include "chrome/browser/ui/profile_error_dialog.h" #include "chrome/browser/visitedlink/visitedlink_master.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/url_constants.h" @@ -87,7 +88,7 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate { } virtual void BroadcastNotifications( - NotificationType type, + int type, history::HistoryDetails* details) OVERRIDE { // Send the notification on the history thread. if (NotificationService::current()) { @@ -136,9 +137,9 @@ HistoryService::HistoryService(Profile* profile) no_db_(false), needs_top_sites_migration_(false) { DCHECK(profile_); - registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, Source<Profile>(profile_)); - registrar_.Add(this, NotificationType::TEMPLATE_URL_REMOVED, + registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_REMOVED, Source<Profile>(profile_)); } @@ -618,14 +619,14 @@ HistoryService::Handle HistoryService::QueryMostVisitedURLs( result_count, days_back); } -void HistoryService::Observe(NotificationType type, +void HistoryService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (!thread_) return; - switch (type.value) { - case NotificationType::HISTORY_URLS_DELETED: { + switch (type) { + case chrome::NOTIFICATION_HISTORY_URLS_DELETED: { // Update the visited link system for deleted URLs. We will update the // visited link system for added URLs as soon as we get the add // notification (we don't have to wait for the backend, which allows us to @@ -648,7 +649,7 @@ void HistoryService::Observe(NotificationType type, break; } - case NotificationType::TEMPLATE_URL_REMOVED: + case chrome::NOTIFICATION_TEMPLATE_URL_REMOVED: DeleteAllSearchTermsForKeyword(*(Details<TemplateURLID>(details).ptr())); break; @@ -742,7 +743,7 @@ void HistoryService::ExpireHistoryBetween( } void HistoryService::BroadcastNotifications( - NotificationType type, + int type, history::HistoryDetails* details_deleted) { // We take ownership of the passed-in pointer and delete it. It was made for // us on another thread, so the caller doesn't know when we will handle it. @@ -789,7 +790,7 @@ void HistoryService::LoadBackendIfNecessary() { void HistoryService::OnDBLoaded() { backend_loaded_ = true; - NotificationService::current()->Notify(NotificationType::HISTORY_LOADED, + NotificationService::current()->Notify(chrome::NOTIFICATION_HISTORY_LOADED, Source<Profile>(profile_), Details<HistoryService>(this)); if (thread_ && profile_) { diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h index b262b57..131ef95 100644 --- a/chrome/browser/history/history.h +++ b/chrome/browser/history/history.h @@ -605,7 +605,7 @@ class HistoryService : public CancelableRequestProvider, friend class TestingProfile; // Implementation of NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -628,7 +628,7 @@ class HistoryService : public CancelableRequestProvider, // notification. The function takes ownership of the pointer and deletes it // when the notification is sent (it is coming from another thread, so must // be allocated on the heap). - void BroadcastNotifications(NotificationType type, + void BroadcastNotifications(int type, history::HistoryDetails* details_deleted); // Initializes the backend. diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 83388dc..5da8424 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -27,8 +27,8 @@ #include "chrome/browser/history/page_usage_data.h" #include "chrome/browser/history/top_sites.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -718,7 +718,7 @@ std::pair<URLID, VisitID> HistoryBackend::AddPageVisit( // TODO(meelapshah) Disabled due to potential PageCycler regression. // Re-enable this. // GetMostRecentRedirectsTo(url, &details->redirects); - BroadcastNotifications(NotificationType::HISTORY_URL_VISITED, details); + BroadcastNotifications(chrome::NOTIFICATION_HISTORY_URL_VISITED, details); } else { VLOG(0) << "Failed to build visit insert statement: " << "url_id = " << url_id; @@ -807,7 +807,7 @@ void HistoryBackend::AddPagesWithDetails(const std::vector<URLRow>& urls, // // TODO(brettw) bug 1140015: Add an "add page" notification so the history // views can keep in sync. - BroadcastNotifications(NotificationType::HISTORY_TYPED_URLS_MODIFIED, + BroadcastNotifications(chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, modified.release()); ScheduleCommit(); @@ -863,7 +863,7 @@ void HistoryBackend::SetPageTitle(const GURL& url, if (changed_urls[i].typed_count() > 0) modified->changed_urls.push_back(changed_urls[i]); } - BroadcastNotifications(NotificationType::HISTORY_TYPED_URLS_MODIFIED, + BroadcastNotifications(chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, modified); } @@ -1042,8 +1042,8 @@ void HistoryBackend::SetKeywordSearchTermsForURL(const GURL& url, details->url = url; details->keyword_id = keyword_id; details->term = term; - BroadcastNotifications(NotificationType::HISTORY_KEYWORD_SEARCH_TERM_UPDATED, - details); + BroadcastNotifications( + chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED, details); ScheduleCommit(); } @@ -1666,7 +1666,8 @@ void HistoryBackend::SetImportedFavicons( // Send the notification about the changed favicon URLs. FaviconChangeDetails* changed_details = new FaviconChangeDetails; changed_details->urls.swap(favicons_changed); - BroadcastNotifications(NotificationType::FAVICON_CHANGED, changed_details); + BroadcastNotifications(chrome::NOTIFICATION_FAVICON_CHANGED, + changed_details); } } @@ -1810,7 +1811,8 @@ void HistoryBackend::SetFaviconMapping(const GURL& page_url, // Send the notification about the changed favicons. FaviconChangeDetails* changed_details = new FaviconChangeDetails; changed_details->urls.swap(favicons_changed); - BroadcastNotifications(NotificationType::FAVICON_CHANGED, changed_details); + BroadcastNotifications(chrome::NOTIFICATION_FAVICON_CHANGED, + changed_details); ScheduleCommit(); } @@ -2037,7 +2039,7 @@ void HistoryBackend::ProcessDBTask( } void HistoryBackend::BroadcastNotifications( - NotificationType type, + int type, HistoryDetails* details_deleted) { DCHECK(delegate_.get()); delegate_->BroadcastNotifications(type, details_deleted); @@ -2123,7 +2125,7 @@ void HistoryBackend::DeleteAllHistory() { // will pick this up and clear itself. URLsDeletedDetails* details = new URLsDeletedDetails; details->all_history = true; - BroadcastNotifications(NotificationType::HISTORY_URLS_DELETED, details); + BroadcastNotifications(chrome::NOTIFICATION_HISTORY_URLS_DELETED, details); } bool HistoryBackend::ClearAllThumbnailHistory( diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h index 29f2272..9b3edc3 100644 --- a/chrome/browser/history/history_backend.h +++ b/chrome/browser/history/history_backend.h @@ -75,7 +75,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, // the main thread. // // Ownership of the HistoryDetails is transferred to this function. - virtual void BroadcastNotifications(NotificationType type, + virtual void BroadcastNotifications(int type, HistoryDetails* details) = 0; // Invoked when the backend has finished loading the db. @@ -487,7 +487,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, // Schedules a broadcast of the given notification on the main thread. The // details argument will have ownership taken by this function (it will be // sent to the main thread and deleted there). - virtual void BroadcastNotifications(NotificationType type, + virtual void BroadcastNotifications(int type, HistoryDetails* details_deleted); // Deleting all history ------------------------------------------------------ diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc index 1a3cdd8..36984b1 100644 --- a/chrome/browser/history/history_backend_unittest.cc +++ b/chrome/browser/history/history_backend_unittest.cc @@ -55,7 +55,7 @@ class HistoryBackendTestDelegate : public HistoryBackend::Delegate { virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE {} virtual void SetInMemoryBackend(InMemoryHistoryBackend* backend) OVERRIDE; - virtual void BroadcastNotifications(NotificationType type, + virtual void BroadcastNotifications(int type, HistoryDetails* details) OVERRIDE; virtual void DBLoaded() OVERRIDE; virtual void StartTopSitesMigration() OVERRIDE; @@ -169,7 +169,7 @@ class HistoryBackendTest : public testing::Test { mem_backend_.reset(backend); } - void BroadcastNotifications(NotificationType type, + void BroadcastNotifications(int type, HistoryDetails* details) { // Send the notifications directly to the in-memory database. Details<HistoryDetails> det(details); @@ -189,7 +189,7 @@ void HistoryBackendTestDelegate::SetInMemoryBackend( } void HistoryBackendTestDelegate::BroadcastNotifications( - NotificationType type, + int type, HistoryDetails* details) { test_->BroadcastNotifications(type, details); } diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc index dcb46fe..442694d 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc @@ -19,7 +19,7 @@ HistoryTabHelper::HistoryTabHelper(TabContents* tab_contents) : TabContentsObserver(tab_contents), received_page_title_(false) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_TITLE_UPDATED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED, Source<TabContents>(tab_contents)); } @@ -104,10 +104,10 @@ void HistoryTabHelper::DidNavigateAnyFramePostCommit( UpdateHistoryForNavigation(add_page_args); } -void HistoryTabHelper::Observe(NotificationType type, +void HistoryTabHelper::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type.value == NotificationType::TAB_CONTENTS_TITLE_UPDATED); + DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED); TitleUpdatedDetails* title = Details<TitleUpdatedDetails>(details).ptr(); if (received_page_title_) diff --git a/chrome/browser/history/history_tab_helper.h b/chrome/browser/history/history_tab_helper.h index 80bdec6..763e1c0 100644 --- a/chrome/browser/history/history_tab_helper.h +++ b/chrome/browser/history/history_tab_helper.h @@ -51,7 +51,7 @@ class HistoryTabHelper : public TabContentsObserver, const ViewHostMsg_FrameNavigate_Params& params); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index 361a737..9d8f097 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -90,7 +90,7 @@ class BackendDelegate : public HistoryBackend::Delegate { virtual void NotifyProfileError(sql::InitStatus init_status) OVERRIDE {} virtual void SetInMemoryBackend(InMemoryHistoryBackend* backend) OVERRIDE; - virtual void BroadcastNotifications(NotificationType type, + virtual void BroadcastNotifications(int type, HistoryDetails* details) OVERRIDE; virtual void DBLoaded() OVERRIDE {} virtual void StartTopSitesMigration() OVERRIDE {} @@ -290,7 +290,7 @@ void BackendDelegate::SetInMemoryBackend(InMemoryHistoryBackend* backend) { history_test_->in_mem_backend_.reset(backend); } -void BackendDelegate::BroadcastNotifications(NotificationType type, +void BackendDelegate::BroadcastNotifications(int type, HistoryDetails* details) { // Currently, just send the notifications directly to the in-memory database. // We may want do do something more fancy in the future. diff --git a/chrome/browser/history/in_memory_history_backend.cc b/chrome/browser/history/in_memory_history_backend.cc index e69009b..79c6a34 100644 --- a/chrome/browser/history/in_memory_history_backend.cc +++ b/chrome/browser/history/in_memory_history_backend.cc @@ -16,6 +16,7 @@ #include "chrome/browser/history/in_memory_url_index.h" #include "chrome/browser/history/url_database.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -62,19 +63,21 @@ void InMemoryHistoryBackend::AttachToHistoryService(Profile* profile) { // Register for the notifications we care about. // We only want notifications for the associated profile. Source<Profile> source(profile_); - registrar_.Add(this, NotificationType::HISTORY_URL_VISITED, source); - registrar_.Add(this, NotificationType::HISTORY_TYPED_URLS_MODIFIED, source); - registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, source); - registrar_.Add(this, NotificationType::HISTORY_KEYWORD_SEARCH_TERM_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URL_VISITED, source); + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, source); - registrar_.Add(this, NotificationType::TEMPLATE_URL_REMOVED, source); + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, source); + registrar_.Add(this, + chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED, + source); + registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_REMOVED, source); } -void InMemoryHistoryBackend::Observe(NotificationType type, +void InMemoryHistoryBackend::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::HISTORY_URL_VISITED: { + switch (type) { + case chrome::NOTIFICATION_HISTORY_URL_VISITED: { Details<history::URLVisitedDetails> visited_details(details); PageTransition::Type primary_type = PageTransition::StripQualifier(visited_details->transition); @@ -87,18 +90,18 @@ void InMemoryHistoryBackend::Observe(NotificationType type, } break; } - case NotificationType::HISTORY_KEYWORD_SEARCH_TERM_UPDATED: + case chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED: OnKeywordSearchTermUpdated( *Details<history::KeywordSearchTermDetails>(details).ptr()); break; - case NotificationType::HISTORY_TYPED_URLS_MODIFIED: + case chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED: OnTypedURLsModified( *Details<history::URLsModifiedDetails>(details).ptr()); break; - case NotificationType::HISTORY_URLS_DELETED: + case chrome::NOTIFICATION_HISTORY_URLS_DELETED: OnURLsDeleted(*Details<history::URLsDeletedDetails>(details).ptr()); break; - case NotificationType::TEMPLATE_URL_REMOVED: + case chrome::NOTIFICATION_TEMPLATE_URL_REMOVED: db_->DeleteAllSearchTermsForKeyword( *(Details<TemplateURLID>(details).ptr())); break; diff --git a/chrome/browser/history/in_memory_history_backend.h b/chrome/browser/history/in_memory_history_backend.h index d2c602d..13bf030 100644 --- a/chrome/browser/history/in_memory_history_backend.h +++ b/chrome/browser/history/in_memory_history_backend.h @@ -66,7 +66,7 @@ class InMemoryHistoryBackend : public NotificationObserver { } // Notification callback. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc index 3d5a5e0..0ab324b 100644 --- a/chrome/browser/history/top_sites.cc +++ b/chrome/browser/history/top_sites.cc @@ -22,6 +22,7 @@ #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/thumbnail_score.h" @@ -142,9 +143,9 @@ TopSites::TopSites(Profile* profile) return; if (NotificationService::current()) { - registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, Source<Profile>(profile_)); - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); } @@ -784,13 +785,13 @@ void TopSites::ProcessPendingCallbacks( } } -void TopSites::Observe(NotificationType type, +void TopSites::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (!loaded_) return; - if (type == NotificationType::HISTORY_URLS_DELETED) { + if (type == chrome::NOTIFICATION_HISTORY_URLS_DELETED) { Details<history::URLsDeletedDetails> deleted_details(details); if (deleted_details->all_history) { SetTopSites(MostVisitedURLList()); @@ -816,7 +817,7 @@ void TopSites::Observe(NotificationType type, SetTopSites(new_top_sites); } StartQueryForMostVisited(); - } else if (type == NotificationType::NAV_ENTRY_COMMITTED) { + } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { if (!IsFull()) { content::LoadCommittedDetails* load_details = Details<content::LoadCommittedDetails>(details).ptr(); @@ -911,7 +912,7 @@ void TopSites::MoveStateToLoaded() { ProcessPendingCallbacks(pending_callbacks, filtered_urls); - NotificationService::current()->Notify(NotificationType::TOP_SITES_LOADED, + NotificationService::current()->Notify(chrome::NOTIFICATION_TOP_SITES_LOADED, Source<Profile>(profile_), Details<TopSites>(this)); } @@ -931,7 +932,7 @@ void TopSites::ResetThreadSafeImageCache() { void TopSites::NotifyTopSitesChanged() { NotificationService::current()->Notify( - NotificationType::TOP_SITES_CHANGED, + chrome::NOTIFICATION_TOP_SITES_CHANGED, Source<TopSites>(this), NotificationService::NoDetails()); } @@ -1005,7 +1006,7 @@ void TopSites::OnTopSitesAvailableFromHistory( // Used only in testing. NotificationService::current()->Notify( - NotificationType::TOP_SITES_UPDATED, + chrome::NOTIFICATION_TOP_SITES_UPDATED, Source<TopSites>(this), Details<CancelableRequestProvider::Handle>(&handle)); } diff --git a/chrome/browser/history/top_sites.h b/chrome/browser/history/top_sites.h index a6bb9a2..c69a61c 100644 --- a/chrome/browser/history/top_sites.h +++ b/chrome/browser/history/top_sites.h @@ -273,7 +273,7 @@ class TopSites const MostVisitedURLList& urls); // Implementation of NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/importer/importer_host.cc b/chrome/browser/importer/importer_host.cc index 101fc7b..d4b66cc 100644 --- a/chrome/browser/importer/importer_host.cc +++ b/chrome/browser/importer/importer_host.cc @@ -19,6 +19,7 @@ #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_source.h" #include "grit/generated_resources.h" @@ -207,7 +208,7 @@ void ImporterHost::CheckForLoadedModels(uint16 items) { if (!writer_->TemplateURLServiceIsLoaded()) { TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(profile_); - registrar_.Add(this, NotificationType::TEMPLATE_URL_SERVICE_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, Source<TemplateURLService>(model)); model->Load(); } @@ -237,10 +238,10 @@ void ImporterHost::BookmarkModelBeingDeleted(BookmarkModel* model) { void ImporterHost::BookmarkModelChanged() { } -void ImporterHost::Observe(NotificationType type, +void ImporterHost::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TEMPLATE_URL_SERVICE_LOADED); + DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); registrar_.RemoveAll(); InvokeTaskIfDone(); } diff --git a/chrome/browser/importer/importer_host.h b/chrome/browser/importer/importer_host.h index d3426cf..5e0e933 100644 --- a/chrome/browser/importer/importer_host.h +++ b/chrome/browser/importer/importer_host.h @@ -141,7 +141,7 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>, // NotificationObserver: // Called when TemplateURLService has been loaded. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc index 9b6b085..32d915b 100644 --- a/chrome/browser/importer/profile_writer.cc +++ b/chrome/browser/importer/profile_writer.cc @@ -17,6 +17,7 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_service.h" @@ -61,7 +62,7 @@ void ShowBookmarkBar(Profile* profile) { prefs->ScheduleSavePersistentPrefs(); Source<Profile> source(profile); NotificationService::current()->Notify( - NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, source, + chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, source, NotificationService::NoDetails()); } } diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc index b2e64cb..a42698d 100644 --- a/chrome/browser/instant/instant_browsertest.cc +++ b/chrome/browser/instant/instant_browsertest.cc @@ -20,6 +20,7 @@ #include "chrome/browser/ui/omnibox/location_bar.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" @@ -51,7 +52,7 @@ class InstantTest : public InProcessBrowserTest { if (!model->loaded()) { model->Load(); ui_test_utils::WaitForNotification( - NotificationType::TEMPLATE_URL_SERVICE_LOADED); + chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); } ASSERT_TRUE(model->loaded()); @@ -123,7 +124,7 @@ class InstantTest : public InProcessBrowserTest { ASSERT_NO_FATAL_FAILURE(FindLocationBar()); location_bar_->location_entry()->SetUserText(UTF8ToUTF16(text)); ui_test_utils::WaitForNotification( - NotificationType::INSTANT_CONTROLLER_SHOWN); + chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN); } const string16& GetSuggestion() const { @@ -599,7 +600,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE_SearchServerDoesntSupportInstant) { // When the response comes back that the page doesn't support instant the tab // should be closed. - ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED); + ui_test_utils::WaitForNotification(content::NOTIFICATION_TAB_CLOSED); EXPECT_FALSE(browser()->instant()->IsShowingInstant()); EXPECT_FALSE(browser()->instant()->is_displayable()); EXPECT_TRUE(browser()->instant()->is_active()); @@ -649,7 +650,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, // When the response comes back that the page doesn't support instant the tab // should be closed. - ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED); + ui_test_utils::WaitForNotification(content::NOTIFICATION_TAB_CLOSED); EXPECT_FALSE(browser()->instant()->IsShowingInstant()); EXPECT_FALSE(browser()->instant()->is_displayable()); // But because the omnibox is still open, instant should be active. @@ -705,7 +706,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, HideOn403) { ASSERT_FALSE(browser()->instant()->is_displayable()); // When instant sees the 403, it should close the tab. - ui_test_utils::WaitForNotification(NotificationType::TAB_CLOSED); + ui_test_utils::WaitForNotification(content::NOTIFICATION_TAB_CLOSED); ASSERT_FALSE(browser()->instant()->GetPreviewContents()); ASSERT_TRUE(browser()->instant()->is_active()); ASSERT_FALSE(browser()->instant()->is_displayable()); @@ -869,7 +870,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, DontCrashOnBlockedJS) { ASSERT_NO_FATAL_FAILURE(SetupLocationBar()); // Wait for notification that the instant API has been determined. ui_test_utils::WaitForNotification( - NotificationType::INSTANT_SUPPORT_DETERMINED); + chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED); // As long as we get the notification we're good (the renderer didn't crash). } @@ -894,11 +895,11 @@ IN_PROC_BROWSER_TEST_F(InstantTest, DownloadOnEnter) { // Wait for the load to fail (because instant disables downloads). printf("1\n"); ui_test_utils::WaitForNotification( - NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR); + content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR); printf("2\n"); ui_test_utils::WindowedNotificationObserver download_observer( - NotificationType::DOWNLOAD_INITIATED, + chrome::NOTIFICATION_DOWNLOAD_INITIATED, NotificationService::AllSources()); ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN)); printf("3\n"); diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc index c7a6653..c25f62c 100644 --- a/chrome/browser/instant/instant_controller.cc +++ b/chrome/browser/instant/instant_controller.cc @@ -22,6 +22,7 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -207,7 +208,7 @@ void InstantController::Update(TabContentsWrapper* tab_contents, } NotificationService::current()->Notify( - NotificationType::INSTANT_CONTROLLER_UPDATED, + chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED, Source<InstantController>(this), NotificationService::NoDetails()); } @@ -569,7 +570,7 @@ void InstantController::UpdateDisplayableLoader() { } else { delegate_->ShowInstant(displayable_loader_->preview_contents()); NotificationService::current()->Notify( - NotificationType::INSTANT_CONTROLLER_SHOWN, + chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN, Source<InstantController>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 0e7fc35..d7f47d1 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -26,6 +26,7 @@ #include "chrome/browser/ui/download/download_tab_helper_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages.h" #include "content/browser/renderer_host/render_view_host.h" @@ -37,12 +38,12 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "content/common/page_transition_types.h" #include "content/common/renderer_preferences.h" #include "net/http/http_util.h" @@ -78,7 +79,7 @@ class InstantLoader::FrameLoadObserver : public NotificationObserver { text_(text), verbatim_(verbatim), unique_id_(tab_contents_->controller().pending_entry()->unique_id()) { - registrar_.Add(this, NotificationType::LOAD_COMPLETED_MAIN_FRAME, + registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, Source<TabContents>(tab_contents_)); } @@ -89,7 +90,7 @@ class InstantLoader::FrameLoadObserver : public NotificationObserver { void set_verbatim(bool verbatim) { verbatim_ = verbatim; } // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; @@ -115,11 +116,11 @@ class InstantLoader::FrameLoadObserver : public NotificationObserver { }; void InstantLoader::FrameLoadObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::LOAD_COMPLETED_MAIN_FRAME: { + switch (type) { + case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: { int page_id = *(Details<int>(details).ptr()); NavigationEntry* active_entry = tab_contents_->controller().GetActiveEntry(); @@ -176,7 +177,7 @@ class InstantLoader::TabContentsDelegateImpl void UnregisterForPaintNotifications(); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; @@ -268,9 +269,9 @@ InstantLoader::TabContentsDelegateImpl::TabContentsDelegateImpl( is_mouse_down_from_activate_(false), user_typed_before_load_(false) { DCHECK(loader->preview_contents()); - registrar_.Add(this, NotificationType::INTERSTITIAL_ATTACHED, + registrar_.Add(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED, Source<TabContents>(loader->preview_contents()->tab_contents())); - registrar_.Add(this, NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, + registrar_.Add(this, content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR, Source<NavigationController>(&loader->preview_contents()->controller())); } @@ -354,9 +355,9 @@ void InstantLoader::TabContentsDelegateImpl::RegisterForPaintNotifications( registered_render_widget_host_ = render_widget_host; Source<RenderWidgetHost> source = Source<RenderWidgetHost>(registered_render_widget_host_); - registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DID_PAINT, + registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, source); - registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, source); } @@ -364,20 +365,20 @@ void InstantLoader::TabContentsDelegateImpl::UnregisterForPaintNotifications() { if (registered_render_widget_host_) { Source<RenderWidgetHost> source = Source<RenderWidgetHost>(registered_render_widget_host_); - registrar_.Remove(this, NotificationType::RENDER_WIDGET_HOST_DID_PAINT, + registrar_.Remove(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, source); - registrar_.Remove(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, source); registered_render_widget_host_ = NULL; } } void InstantLoader::TabContentsDelegateImpl::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR: + switch (type) { + case content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR: if (Details<ProvisionalLoadDetails>(details)->url() == loader_->url_) { // This typically happens with downloads (which are disabled with // instant active). To ensure the download happens when the user presses @@ -385,14 +386,14 @@ void InstantLoader::TabContentsDelegateImpl::Observe( loader_->needs_reload_ = true; } break; - case NotificationType::RENDER_WIDGET_HOST_DID_PAINT: + case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: UnregisterForPaintNotifications(); PreviewPainted(); break; - case NotificationType::RENDER_WIDGET_HOST_DESTROYED: + case content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: UnregisterForPaintNotifications(); break; - case NotificationType::INTERSTITIAL_ATTACHED: + case content::NOTIFICATION_INTERSTITIAL_ATTACHED: PreviewPainted(); break; default: @@ -551,7 +552,7 @@ void InstantLoader::TabContentsDelegateImpl::OnInstantSupportDetermined( Details<const bool> details(&result); NotificationService::current()->Notify( - NotificationType::INSTANT_SUPPORT_DETERMINED, + chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED, NotificationService::AllSources(), details); @@ -747,7 +748,7 @@ TabContentsWrapper* InstantLoader::ReleasePreviewContents( SetTakesFocusOnlyOnMouseDown(false); registrar_.Remove( this, - NotificationType::RENDER_VIEW_HOST_CHANGED, + chrome::RENDER_VIEW_HOST_CHANGED, Source<NavigationController>(&preview_contents_->controller())); #endif } @@ -853,11 +854,11 @@ void InstantLoader::ShowPreview() { } } -void InstantLoader::Observe(NotificationType type, +void InstantLoader::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { #if defined(OS_MACOSX) - if (type.value == NotificationType::RENDER_VIEW_HOST_CHANGED) { + if (type == chrome::RENDER_VIEW_HOST_CHANGED) { if (preview_contents_->tab_contents()->GetRenderWidgetHostView()) { preview_contents_->tab_contents()->GetRenderWidgetHostView()-> SetTakesFocusOnlyOnMouseDown(true); @@ -865,7 +866,7 @@ void InstantLoader::Observe(NotificationType type, return; } #endif - if (type.value == NotificationType::NAV_ENTRY_COMMITTED) { + if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { content::LoadCommittedDetails* load_details = Details<content::LoadCommittedDetails>(details).ptr(); if (load_details->is_main_frame) { @@ -954,11 +955,11 @@ void InstantLoader::ReplacePreviewContents(TabContentsWrapper* old_tc, #if defined(OS_MACOSX) registrar_.Remove(this, - NotificationType::RENDER_VIEW_HOST_CHANGED, + content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, Source<NavigationController>(&old_tc->controller())); #endif registrar_.Remove(this, - NotificationType::NAV_ENTRY_COMMITTED, + content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&old_tc->controller())); // We prerendered so we should be ready to show. If we're ready, swap in @@ -995,13 +996,13 @@ void InstantLoader::SetupPreviewContents(TabContentsWrapper* tab_contents) { } registrar_.Add( this, - NotificationType::RENDER_VIEW_HOST_CHANGED, + content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, Source<NavigationController>(&preview_contents_->controller())); #endif registrar_.Add( this, - NotificationType::NAV_ENTRY_COMMITTED, + content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&preview_contents_->controller())); gfx::Rect tab_bounds; diff --git a/chrome/browser/instant/instant_loader.h b/chrome/browser/instant/instant_loader.h index d28a6d6..daa6631 100644 --- a/chrome/browser/instant/instant_loader.h +++ b/chrome/browser/instant/instant_loader.h @@ -75,7 +75,7 @@ class InstantLoader : public NotificationObserver { const TemplateURL* template_url); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc index ecb618a..f728447 100644 --- a/chrome/browser/memory_purger.cc +++ b/chrome/browser/memory_purger.cc @@ -65,7 +65,7 @@ void PurgeMemoryIOHelper::PurgeMemoryOnIOThread() { // The appcache and safe browsing services listen for this notification. NotificationService::current()->Notify( - NotificationType::PURGE_MEMORY, + content::NOTIFICATION_PURGE_MEMORY, Source<void>(NULL), NotificationService::NoDetails()); } diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 73c652c..ed6b5ce 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -181,6 +181,7 @@ #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/common/child_process_logging.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/guid.h" #include "chrome/common/pref_names.h" @@ -533,39 +534,39 @@ bool MetricsService::reporting_active() const { // static void MetricsService::SetUpNotifications(NotificationRegistrar* registrar, NotificationObserver* observer) { - registrar->Add(observer, NotificationType::BROWSER_OPENED, + registrar->Add(observer, chrome::NOTIFICATION_BROWSER_OPENED, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::BROWSER_CLOSED, + registrar->Add(observer, chrome::NOTIFICATION_BROWSER_CLOSED, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::USER_ACTION, + registrar->Add(observer, content::NOTIFICATION_USER_ACTION, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::TAB_PARENTED, + registrar->Add(observer, content::NOTIFICATION_TAB_PARENTED, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::TAB_CLOSING, + registrar->Add(observer, content::NOTIFICATION_TAB_CLOSING, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::LOAD_START, + registrar->Add(observer, content::NOTIFICATION_LOAD_START, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::LOAD_STOP, + registrar->Add(observer, content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::RENDERER_PROCESS_CLOSED, + registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::RENDERER_PROCESS_HANG, + registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_HANG, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::CHILD_PROCESS_HOST_CONNECTED, + registrar->Add(observer, content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::CHILD_INSTANCE_CREATED, + registrar->Add(observer, content::NOTIFICATION_CHILD_INSTANCE_CREATED, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::CHILD_PROCESS_CRASHED, + registrar->Add(observer, content::NOTIFICATION_CHILD_PROCESS_CRASHED, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::TEMPLATE_URL_SERVICE_LOADED, + registrar->Add(observer, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::OMNIBOX_OPENED_URL, + registrar->Add(observer, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, NotificationService::AllSources()); - registrar->Add(observer, NotificationType::BOOKMARK_MODEL_LOADED, + registrar->Add(observer, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, NotificationService::AllSources()); } -void MetricsService::Observe(NotificationType type, +void MetricsService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(current_log_); @@ -574,30 +575,30 @@ void MetricsService::Observe(NotificationType type, if (!CanLogNotification(type, source, details)) return; - switch (type.value) { - case NotificationType::USER_ACTION: + switch (type) { + case content::NOTIFICATION_USER_ACTION: current_log_->RecordUserAction(*Details<const char*>(details).ptr()); break; - case NotificationType::BROWSER_OPENED: - case NotificationType::BROWSER_CLOSED: + case chrome::NOTIFICATION_BROWSER_OPENED: + case chrome::NOTIFICATION_BROWSER_CLOSED: LogWindowChange(type, source, details); break; - case NotificationType::TAB_PARENTED: - case NotificationType::TAB_CLOSING: + case content::NOTIFICATION_TAB_PARENTED: + case content::NOTIFICATION_TAB_CLOSING: LogWindowChange(type, source, details); break; - case NotificationType::LOAD_STOP: + case content::NOTIFICATION_LOAD_STOP: LogLoadComplete(type, source, details); break; - case NotificationType::LOAD_START: + case content::NOTIFICATION_LOAD_START: LogLoadStarted(); break; - case NotificationType::RENDERER_PROCESS_CLOSED: { + case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { RenderProcessHost::RendererClosedDetails* process_details = Details<RenderProcessHost::RendererClosedDetails>(details).ptr(); if (process_details->status == @@ -613,21 +614,21 @@ void MetricsService::Observe(NotificationType type, } break; - case NotificationType::RENDERER_PROCESS_HANG: + case content::NOTIFICATION_RENDERER_PROCESS_HANG: LogRendererHang(); break; - case NotificationType::CHILD_PROCESS_HOST_CONNECTED: - case NotificationType::CHILD_PROCESS_CRASHED: - case NotificationType::CHILD_INSTANCE_CREATED: + case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED: + case content::NOTIFICATION_CHILD_PROCESS_CRASHED: + case content::NOTIFICATION_CHILD_INSTANCE_CREATED: LogChildProcessChange(type, source, details); break; - case NotificationType::TEMPLATE_URL_SERVICE_LOADED: + case chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED: LogKeywords(Source<TemplateURLService>(source).ptr()); break; - case NotificationType::OMNIBOX_OPENED_URL: { + case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: { MetricsLog* current_log = current_log_->AsMetricsLog(); DCHECK(current_log); current_log->RecordOmniboxOpenedURL( @@ -635,7 +636,7 @@ void MetricsService::Observe(NotificationType type, break; } - case NotificationType::BOOKMARK_MODEL_LOADED: { + case chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED: { Profile* p = Source<Profile>(source).ptr(); if (p) LogBookmarks(p->GetBookmarkModel()); @@ -1384,7 +1385,7 @@ void MetricsService::LogBadResponseCode() { } } -void MetricsService::LogWindowChange(NotificationType type, +void MetricsService::LogWindowChange(int type, const NotificationSource& source, const NotificationDetails& details) { int controller_id = -1; @@ -1402,14 +1403,14 @@ void MetricsService::LogWindowChange(NotificationType type, } DCHECK_NE(controller_id, -1); - switch (type.value) { - case NotificationType::TAB_PARENTED: - case NotificationType::BROWSER_OPENED: + switch (type) { + case content::NOTIFICATION_TAB_PARENTED: + case chrome::NOTIFICATION_BROWSER_OPENED: window_type = MetricsLog::WINDOW_CREATE; break; - case NotificationType::TAB_CLOSING: - case NotificationType::BROWSER_CLOSED: + case content::NOTIFICATION_TAB_CLOSING: + case chrome::NOTIFICATION_BROWSER_CLOSED: window_map_.erase(window_map_.find(window_or_tab)); window_type = MetricsLog::WINDOW_DESTROY; break; @@ -1423,7 +1424,7 @@ void MetricsService::LogWindowChange(NotificationType type, current_log_->RecordWindowEvent(window_type, controller_id, 0); } -void MetricsService::LogLoadComplete(NotificationType type, +void MetricsService::LogLoadComplete(int type, const NotificationSource& source, const NotificationDetails& details) { if (details == NotificationService::NoDetails()) @@ -1497,7 +1498,7 @@ void MetricsService::LogChromeOSCrash(const std::string &crash_type) { #endif // OS_CHROMEOS void MetricsService::LogChildProcessChange( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { Details<ChildProcessInfo> child_details(details); @@ -1510,16 +1511,16 @@ void MetricsService::LogChildProcessChange( } ChildProcessStats& stats = child_process_stats_buffer_[child_name]; - switch (type.value) { - case NotificationType::CHILD_PROCESS_HOST_CONNECTED: + switch (type) { + case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED: stats.process_launches++; break; - case NotificationType::CHILD_INSTANCE_CREATED: + case content::NOTIFICATION_CHILD_INSTANCE_CREATED: stats.instances++; break; - case NotificationType::CHILD_PROCESS_CRASHED: + case content::NOTIFICATION_CHILD_PROCESS_CRASHED: stats.process_crashes++; // Exclude plugin crashes from the count below because we report them via // a separate UMA metric. @@ -1529,7 +1530,7 @@ void MetricsService::LogChildProcessChange( break; default: - NOTREACHED() << "Unexpected notification type " << type.value; + NOTREACHED() << "Unexpected notification type " << type; return; } } @@ -1659,7 +1660,7 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { child_process_stats_buffer_.clear(); } -bool MetricsService::CanLogNotification(NotificationType type, +bool MetricsService::CanLogNotification(int type, const NotificationSource& source, const NotificationDetails& details) { // We simply don't log anything to UMA if there is a single incognito diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index 5a031ed..dd4118f 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -98,7 +98,7 @@ class MetricsService : public NotificationObserver, NotificationObserver* observer); // Implementation of NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -266,7 +266,7 @@ class MetricsService : public NotificationObserver, void LogBadResponseCode(); // Records a window-related notification. - void LogWindowChange(NotificationType type, + void LogWindowChange(int type, const NotificationSource& source, const NotificationDetails& details); @@ -302,7 +302,7 @@ class MetricsService : public NotificationObserver, // Records a child process related notification. These are recorded to an // in-object buffer because these notifications are sent on page load, and we // don't want to slow that down. - void LogChildProcessChange(NotificationType type, + void LogChildProcessChange(int type, const NotificationSource& source, const NotificationDetails& details); @@ -322,12 +322,12 @@ class MetricsService : public NotificationObserver, void LogLoadStarted(); // Records a page load notification. - void LogLoadComplete(NotificationType type, + void LogLoadComplete(int type, const NotificationSource& source, const NotificationDetails& details); // Checks whether a notification can be logged. - bool CanLogNotification(NotificationType type, + bool CanLogNotification(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc index 3f974ac..2b0da7e 100644 --- a/chrome/browser/metrics/thread_watcher.cc +++ b/chrome/browser/metrics/thread_watcher.cc @@ -572,7 +572,7 @@ void ThreadWatcherObserver::RemoveNotifications() { delete g_thread_watcher_observer_; } -void ThreadWatcherObserver::Observe(NotificationType type, +void ThreadWatcherObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // There is some user activity, see if thread watchers are to be awakened. diff --git a/chrome/browser/metrics/thread_watcher.h b/chrome/browser/metrics/thread_watcher.h index b28addf..a53316c 100644 --- a/chrome/browser/metrics/thread_watcher.h +++ b/chrome/browser/metrics/thread_watcher.h @@ -393,7 +393,7 @@ class ThreadWatcherObserver : public NotificationObserver { // method is accessible on UI thread. static void SetupNotifications(const base::TimeDelta& wakeup_interval); - // Removes all NotificationTypes from |registrar_| and deletes + // Removes all ints from |registrar_| and deletes // |g_thread_watcher_observer_|. This method is accessible on UI thread. static void RemoveNotifications(); @@ -409,14 +409,14 @@ class ThreadWatcherObserver : public NotificationObserver { // seconds. This is the implementation of NotificationObserver. When a // matching notification is posted to the notification service, this method is // called. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); // The singleton of this class. static ThreadWatcherObserver* g_thread_watcher_observer_; - // The registrar that holds NotificationTypes to be observed. + // The registrar that holds ints to be observed. NotificationRegistrar registrar_; // This is the last time when woke all thread watchers up. diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index 011454e..4c8a7c5 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -13,6 +13,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" @@ -273,12 +274,12 @@ void ChromeURLRequestContextGetter::CleanupOnUIThread() { // NotificationObserver implementation. void ChromeURLRequestContextGetter::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (NotificationType::PREF_CHANGED == type) { + if (chrome::NOTIFICATION_PREF_CHANGED == type) { std::string* pref_name_in = Details<std::string>(details).ptr(); PrefService* prefs = Source<PrefService>(source).ptr(); DCHECK(pref_name_in && prefs); @@ -388,7 +389,7 @@ ChromeURLRequestContext::~ChromeURLRequestContext() { appcache_service_->set_request_context(NULL); NotificationService::current()->Notify( - NotificationType::URL_REQUEST_CONTEXT_RELEASED, + chrome::NOTIFICATION_URL_REQUEST_CONTEXT_RELEASED, Source<net::URLRequestContext>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index e7b67dd..dd716f6 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -217,7 +217,7 @@ class ChromeURLRequestContextGetter : public net::URLRequestContextGetter, void CleanupOnUIThread(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/net/gaia/token_service.cc b/chrome/browser/net/gaia/token_service.cc index 7069165..b382861 100644 --- a/chrome/browser/net/gaia/token_service.cc +++ b/chrome/browser/net/gaia/token_service.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/string_util.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/net/gaia/gaia_auth_fetcher.h" #include "chrome/common/net/gaia/gaia_constants.h" @@ -66,7 +67,7 @@ void TokenService::Initialize(const char* const source, #endif registrar_.Add(this, - NotificationType::TOKEN_UPDATED, + chrome::NOTIFICATION_TOKEN_UPDATED, NotificationService::AllSources()); } @@ -167,7 +168,7 @@ void TokenService::FireTokenAvailableNotification( TokenAvailableDetails details(service, auth_token); NotificationService::current()->Notify( - NotificationType::TOKEN_AVAILABLE, + chrome::NOTIFICATION_TOKEN_AVAILABLE, Source<TokenService>(this), Details<const TokenAvailableDetails>(&details)); } @@ -178,7 +179,7 @@ void TokenService::FireTokenRequestFailedNotification( TokenRequestFailedDetails details(service, error); NotificationService::current()->Notify( - NotificationType::TOKEN_REQUEST_FAILED, + chrome::NOTIFICATION_TOKEN_REQUEST_FAILED, Source<TokenService>(this), Details<const TokenRequestFailedDetails>(&details)); } @@ -222,7 +223,7 @@ void TokenService::OnWebDataServiceRequestDone(WebDataService::Handle h, } NotificationService::current()->Notify( - NotificationType::TOKEN_LOADING_FINISHED, + chrome::NOTIFICATION_TOKEN_LOADING_FINISHED, Source<TokenService>(this), NotificationService::NoDetails()); } @@ -254,10 +255,10 @@ void TokenService::LoadTokensIntoMemory( } } -void TokenService::Observe(NotificationType type, +void TokenService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TOKEN_UPDATED); + DCHECK(type == chrome::NOTIFICATION_TOKEN_UPDATED); TokenAvailableDetails* tok_details = Details<TokenAvailableDetails>(details).ptr(); OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token()); diff --git a/chrome/browser/net/gaia/token_service.h b/chrome/browser/net/gaia/token_service.h index 63be386..adeb977 100644 --- a/chrome/browser/net/gaia/token_service.h +++ b/chrome/browser/net/gaia/token_service.h @@ -148,7 +148,7 @@ class TokenService : public GaiaAuthConsumer, const WDTypedResult* result); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/net/gaia/token_service_unittest.cc b/chrome/browser/net/gaia/token_service_unittest.cc index 895d4eb..fec4fcf 100644 --- a/chrome/browser/net/gaia/token_service_unittest.cc +++ b/chrome/browser/net/gaia/token_service_unittest.cc @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/synchronization/waitable_event.h" #include "chrome/browser/password_manager/encryptor.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/net/gaia/gaia_auth_fetcher_unittest.h" #include "chrome/common/net/gaia/gaia_constants.h" @@ -18,11 +19,11 @@ TokenAvailableTracker::TokenAvailableTracker() {} TokenAvailableTracker::~TokenAvailableTracker() {} -void TokenAvailableTracker::Observe(NotificationType type, +void TokenAvailableTracker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { TestNotificationTracker::Observe(type, source, details); - if (type == NotificationType::TOKEN_AVAILABLE) { + if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { Details<const TokenService::TokenAvailableDetails> full = details; details_ = *full.ptr(); } @@ -32,11 +33,11 @@ TokenFailedTracker::TokenFailedTracker() {} TokenFailedTracker::~TokenFailedTracker() {} -void TokenFailedTracker::Observe(NotificationType type, +void TokenFailedTracker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { TestNotificationTracker::Observe(type, source, details); - if (type == NotificationType::TOKEN_REQUEST_FAILED) { + if (type == chrome::NOTIFICATION_TOKEN_REQUEST_FAILED) { Details<const TokenService::TokenRequestFailedDetails> full = details; details_ = *full.ptr(); } @@ -64,9 +65,9 @@ void TokenServiceTestHarness::SetUp() { profile_->CreateWebDataService(false); WaitForDBLoadCompletion(); - success_tracker_.ListenFor(NotificationType::TOKEN_AVAILABLE, + success_tracker_.ListenFor(chrome::NOTIFICATION_TOKEN_AVAILABLE, Source<TokenService>(&service_)); - failure_tracker_.ListenFor(NotificationType::TOKEN_REQUEST_FAILED, + failure_tracker_.ListenFor(chrome::NOTIFICATION_TOKEN_REQUEST_FAILED, Source<TokenService>(&service_)); service_.Initialize("test", profile_.get()); diff --git a/chrome/browser/net/gaia/token_service_unittest.h b/chrome/browser/net/gaia/token_service_unittest.h index eb8c52a..f4deb6e 100644 --- a/chrome/browser/net/gaia/token_service_unittest.h +++ b/chrome/browser/net/gaia/token_service_unittest.h @@ -32,7 +32,7 @@ class TokenAvailableTracker : public TestNotificationTracker { } private: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -49,7 +49,7 @@ class TokenFailedTracker : public TestNotificationTracker { } private: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/net/net_pref_observer.cc b/chrome/browser/net/net_pref_observer.cc index 8a0d08e..abfcc46 100644 --- a/chrome/browser/net/net_pref_observer.cc +++ b/chrome/browser/net/net_pref_observer.cc @@ -10,9 +10,9 @@ #include "chrome/browser/prerender/prerender_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/trials/http_throttling_trial.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" -#include "content/common/notification_type.h" #include "content/common/notification_details.h" #include "net/http/http_stream_factory.h" #include "net/url_request/url_request_throttler_manager.h" @@ -45,10 +45,10 @@ NetPrefObserver::~NetPrefObserver() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -void NetPrefObserver::Observe(NotificationType type, +void NetPrefObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(type.value, NotificationType::PREF_CHANGED); + DCHECK_EQ(type, chrome::NOTIFICATION_PREF_CHANGED); std::string* pref_name = Details<std::string>(details).ptr(); ApplySettings(pref_name); diff --git a/chrome/browser/net/net_pref_observer.h b/chrome/browser/net/net_pref_observer.h index b58501a0..b7b60c0 100644 --- a/chrome/browser/net/net_pref_observer.h +++ b/chrome/browser/net/net_pref_observer.h @@ -31,7 +31,7 @@ class NetPrefObserver : public NotificationObserver { virtual ~NetPrefObserver(); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/net/predictor_api.cc b/chrome/browser/net/predictor_api.cc index 682a0ef..1d63ede 100644 --- a/chrome/browser/net/predictor_api.cc +++ b/chrome/browser/net/predictor_api.cc @@ -25,6 +25,7 @@ #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" #include "content/common/notification_registrar.h" @@ -304,24 +305,24 @@ class OffTheRecordObserver : public NotificationObserver { void Register() { // TODO(pkasting): This test should not be necessary. See crbug.com/12475. if (registrar_.IsEmpty()) { - registrar_.Add(this, NotificationType::BROWSER_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::BROWSER_OPENED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, NotificationService::AllSources()); } } - void Observe(NotificationType type, const NotificationSource& source, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::BROWSER_OPENED: + switch (type) { + case chrome::NOTIFICATION_BROWSER_OPENED: if (!Source<Browser>(source)->profile()->IsOffTheRecord()) break; ++count_off_the_record_windows_; OnTheRecord(false); break; - case NotificationType::BROWSER_CLOSED: + case chrome::NOTIFICATION_BROWSER_CLOSED: if (!Source<Browser>(source)->profile()->IsOffTheRecord()) break; // Ignore ordinary windows. DCHECK_LT(0, count_off_the_record_windows_); diff --git a/chrome/browser/net/pref_proxy_config_service.cc b/chrome/browser/net/pref_proxy_config_service.cc index 1b31bea..c726285 100644 --- a/chrome/browser/net/pref_proxy_config_service.cc +++ b/chrome/browser/net/pref_proxy_config_service.cc @@ -8,11 +8,11 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/pref_set_observer.h" #include "chrome/browser/prefs/proxy_config_dictionary.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" PrefProxyConfigTracker::PrefProxyConfigTracker(PrefService* pref_service) : pref_service_(pref_service) { @@ -52,11 +52,11 @@ void PrefProxyConfigTracker::RemoveObserver( observers_.RemoveObserver(observer); } -void PrefProxyConfigTracker::Observe(NotificationType type, +void PrefProxyConfigTracker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (type == NotificationType::PREF_CHANGED && + if (type == chrome::NOTIFICATION_PREF_CHANGED && Source<PrefService>(source).ptr() == pref_service_) { net::ProxyConfig new_config; ConfigState config_state = ReadPrefConfig(&new_config); @@ -66,7 +66,7 @@ void PrefProxyConfigTracker::Observe(NotificationType type, &PrefProxyConfigTracker::InstallProxyConfig, new_config, config_state)); } else { - NOTREACHED() << "Unexpected notification of type " << type.value; + NOTREACHED() << "Unexpected notification of type " << type; } } diff --git a/chrome/browser/net/pref_proxy_config_service.h b/chrome/browser/net/pref_proxy_config_service.h index d98fa6f..a7678b7 100644 --- a/chrome/browser/net/pref_proxy_config_service.h +++ b/chrome/browser/net/pref_proxy_config_service.h @@ -63,7 +63,7 @@ class PrefProxyConfigTracker virtual ~PrefProxyConfigTracker(); // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/net/ssl_config_service_manager_pref.cc b/chrome/browser/net/ssl_config_service_manager_pref.cc index 62433e5..c6e5cf5 100644 --- a/chrome/browser/net/ssl_config_service_manager_pref.cc +++ b/chrome/browser/net/ssl_config_service_manager_pref.cc @@ -10,9 +10,9 @@ #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/pref_names.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "net/base/ssl_config_service.h" //////////////////////////////////////////////////////////////////////////////// @@ -73,7 +73,7 @@ class SSLConfigServiceManagerPref // Callback for preference changes. This will post the changes to the IO // thread with SetNewSSLConfig. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -129,7 +129,7 @@ net::SSLConfigService* SSLConfigServiceManagerPref::Get() { return ssl_config_service_; } -void SSLConfigServiceManagerPref::Observe(NotificationType type, +void SSLConfigServiceManagerPref::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { base::Thread* io_thread = g_browser_process->io_thread(); diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index f571012..cb6a752 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -9,6 +9,7 @@ #include "chrome/browser/renderer_preferences_util.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" @@ -18,7 +19,6 @@ #include "content/common/bindings_policy.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "content/common/renderer_preferences.h" #include "content/common/view_messages.h" #include "ipc/ipc_message.h" @@ -100,7 +100,7 @@ void BalloonHost::RenderViewCreated(RenderViewHost* render_view_host) { void BalloonHost::RenderViewReady(RenderViewHost* render_view_host) { should_notify_on_disconnect_ = true; NotificationService::current()->Notify( - NotificationType::NOTIFY_BALLOON_CONNECTED, + chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, Source<BalloonHost>(this), NotificationService::NoDetails()); } @@ -229,7 +229,7 @@ void BalloonHost::NotifyDisconnect() { should_notify_on_disconnect_ = false; NotificationService::current()->Notify( - NotificationType::NOTIFY_BALLOON_DISCONNECTED, + chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, Source<BalloonHost>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index 5908592..f897361 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -21,6 +21,7 @@ #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_child_process_host.h" @@ -31,7 +32,6 @@ #include "content/browser/worker_host/worker_process_host.h" #include "content/common/desktop_notification_messages.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -293,14 +293,14 @@ void DesktopNotificationService::StartObserving() { if (!profile_->IsOffTheRecord()) { prefs_registrar_.Add(prefs::kDesktopNotificationAllowedOrigins, this); prefs_registrar_.Add(prefs::kDesktopNotificationDeniedOrigins, this); - notification_registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + notification_registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); notification_registrar_.Add( this, - NotificationType::CONTENT_SETTINGS_CHANGED, + chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, Source<HostContentSettingsMap>(profile_->GetHostContentSettingsMap())); } - notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); } @@ -350,13 +350,13 @@ void DesktopNotificationService::DenyPermission(const GURL& origin) { origin)); } -void DesktopNotificationService::Observe(NotificationType type, +void DesktopNotificationService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (NotificationType::PREF_CHANGED == type) { + if (chrome::NOTIFICATION_PREF_CHANGED == type) { const std::string& name = *Details<std::string>(details).ptr(); OnPrefsChanged(name); - } else if (NotificationType::CONTENT_SETTINGS_CHANGED == type) { + } else if (chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED == type) { // TODO(markusheintz): Check if content settings type default was changed; const ContentSetting default_content_setting = profile_->GetHostContentSettingsMap()->GetDefaultContentSetting( @@ -368,14 +368,14 @@ void DesktopNotificationService::Observe(NotificationType type, prefs_cache_.get(), &NotificationsPrefsCache::SetCacheDefaultContentSetting, default_content_setting)); - } else if (NotificationType::EXTENSION_UNLOADED == type) { + } else if (chrome::NOTIFICATION_EXTENSION_UNLOADED == type) { // Remove all notifications currently shown or queued by the extension // which was unloaded. const Extension* extension = Details<UnloadedExtensionInfo>(details)->extension; if (extension) ui_manager_->CancelAllBySourceOrigin(extension->url()); - } else if (NotificationType::PROFILE_DESTROYED == type) { + } else if (chrome::NOTIFICATION_PROFILE_DESTROYED == type) { StopObserving(); } } @@ -581,7 +581,7 @@ string16 DesktopNotificationService::DisplayNameForOrigin( void DesktopNotificationService::NotifySettingsChange() { NotificationService::current()->Notify( - NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, + chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED, Source<DesktopNotificationService>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/notifications/desktop_notification_service.h b/chrome/browser/notifications/desktop_notification_service.h index 83ab52f..4ef69fd 100644 --- a/chrome/browser/notifications/desktop_notification_service.h +++ b/chrome/browser/notifications/desktop_notification_service.h @@ -79,7 +79,7 @@ class DesktopNotificationService : public NotificationObserver, void DenyPermission(const GURL& origin); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/notifications/notification_exceptions_table_model.cc b/chrome/browser/notifications/notification_exceptions_table_model.cc index cb4db02..e4fd3ed 100644 --- a/chrome/browser/notifications/notification_exceptions_table_model.cc +++ b/chrome/browser/notifications/notification_exceptions_table_model.cc @@ -5,12 +5,12 @@ #include "chrome/browser/notifications/notification_exceptions_table_model.h" #include "base/auto_reset.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/content_settings.h" #include "chrome/common/content_settings_helper.h" #include "chrome/common/content_settings_types.h" #include "chrome/common/url_constants.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/table_model_observer.h" @@ -28,7 +28,8 @@ NotificationExceptionsTableModel::NotificationExceptionsTableModel( : service_(service), updates_disabled_(false), observer_(NULL) { - registrar_.Add(this, NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, + registrar_.Add(this, + chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED, NotificationService::AllSources()); LoadEntries(); } @@ -98,11 +99,11 @@ void NotificationExceptionsTableModel::SetObserver( } void NotificationExceptionsTableModel::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { if (!updates_disabled_) { - DCHECK(type == NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED); + DCHECK(type == chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED); entries_.clear(); LoadEntries(); diff --git a/chrome/browser/notifications/notification_exceptions_table_model.h b/chrome/browser/notifications/notification_exceptions_table_model.h index b9dc809..bd6ad8e 100644 --- a/chrome/browser/notifications/notification_exceptions_table_model.h +++ b/chrome/browser/notifications/notification_exceptions_table_model.h @@ -31,7 +31,7 @@ class NotificationExceptionsTableModel : public RemoveRowsTableModel, virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE; // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: diff --git a/chrome/browser/notifications/notification_ui_manager.cc b/chrome/browser/notifications/notification_ui_manager.cc index a5afc4c..2a4060f 100644 --- a/chrome/browser/notifications/notification_ui_manager.cc +++ b/chrome/browser/notifications/notification_ui_manager.cc @@ -13,10 +13,10 @@ #include "chrome/browser/notifications/balloon_collection.h" #include "chrome/browser/notifications/notification.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/site_instance.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace { const int kUserStatePollingIntervalSeconds = 1; @@ -50,7 +50,7 @@ class QueuedNotification { NotificationUIManager::NotificationUIManager(PrefService* local_state) : balloon_collection_(NULL), is_user_active_(true) { - registrar_.Add(this, NotificationType::APP_TERMINATING, + registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, NotificationService::AllSources()); position_pref_.Init(prefs::kDesktopNotificationPosition, local_state, this); #if defined(OS_MACOSX) @@ -232,12 +232,12 @@ void NotificationUIManager::SetPositionPreference( balloon_collection_->SetPositionPreference(preference); } -void NotificationUIManager::Observe(NotificationType type, +void NotificationUIManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::APP_TERMINATING) { + if (type == content::NOTIFICATION_APP_TERMINATING) { CancelAll(); - } else if (type == NotificationType::PREF_CHANGED) { + } else if (type == chrome::NOTIFICATION_PREF_CHANGED) { std::string* name = Details<std::string>(details).ptr(); if (*name == prefs::kDesktopNotificationPosition) balloon_collection_->SetPositionPreference( diff --git a/chrome/browser/notifications/notification_ui_manager.h b/chrome/browser/notifications/notification_ui_manager.h index 2c6d931..d31675b2 100644 --- a/chrome/browser/notifications/notification_ui_manager.h +++ b/chrome/browser/notifications/notification_ui_manager.h @@ -83,7 +83,7 @@ class NotificationUIManager explicit NotificationUIManager(PrefService* local_state); // NotificationObserver override. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc index a5b8918a..542fb08 100644 --- a/chrome/browser/omnibox_search_hint.cc +++ b/chrome/browser/omnibox_search_hint.cc @@ -23,12 +23,13 @@ #include "chrome/browser/ui/omnibox/location_bar.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/navigation_details.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" @@ -149,7 +150,7 @@ bool HintInfoBar::Accept() { OmniboxSearchHint::OmniboxSearchHint(TabContentsWrapper* tab) : tab_(tab) { NavigationController* controller = &(tab->controller()); notification_registrar_.Add(this, - NotificationType::NAV_ENTRY_COMMITTED, + content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(controller)); // Fill the search_engine_urls_ map, used for faster look-up (overkill?). for (size_t i = 0; @@ -159,17 +160,17 @@ OmniboxSearchHint::OmniboxSearchHint(TabContentsWrapper* tab) : tab_(tab) { // Listen for omnibox to figure-out when the user searches from the omnibox. notification_registrar_.Add(this, - NotificationType::OMNIBOX_OPENED_URL, + chrome::NOTIFICATION_OMNIBOX_OPENED_URL, Source<Profile>(tab->profile())); } OmniboxSearchHint::~OmniboxSearchHint() { } -void OmniboxSearchHint::Observe(NotificationType type, +void OmniboxSearchHint::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::NAV_ENTRY_COMMITTED) { + if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { NavigationEntry* entry = tab_->controller().GetActiveEntry(); if (search_engine_urls_.find(entry->url().spec()) == search_engine_urls_.end()) { @@ -185,7 +186,7 @@ void OmniboxSearchHint::Observe(NotificationType type, const TemplateURLRef* const search_url = default_provider->url(); if (search_url->GetHost() == entry->url().host()) ShowInfoBar(); - } else if (type == NotificationType::OMNIBOX_OPENED_URL) { + } else if (type == chrome::NOTIFICATION_OMNIBOX_OPENED_URL) { AutocompleteLog* log = Details<AutocompleteLog>(details).ptr(); AutocompleteMatch::Type type = log->result.match_at(log->selected_index).type; diff --git a/chrome/browser/omnibox_search_hint.h b/chrome/browser/omnibox_search_hint.h index 452c8a6..1a43436 100644 --- a/chrome/browser/omnibox_search_hint.h +++ b/chrome/browser/omnibox_search_hint.h @@ -26,7 +26,7 @@ class OmniboxSearchHint : public NotificationObserver { virtual ~OmniboxSearchHint(); // NotificationObserver method: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/password_manager/password_store_default.cc b/chrome/browser/password_manager/password_store_default.cc index 0adf126..d3f66f4 100644 --- a/chrome/browser/password_manager/password_store_default.cc +++ b/chrome/browser/password_manager/password_store_default.cc @@ -13,6 +13,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" @@ -130,7 +131,7 @@ void PasswordStoreDefault::AddLoginImpl(const PasswordForm& form) { PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); } @@ -141,7 +142,7 @@ void PasswordStoreDefault::UpdateLoginImpl(const PasswordForm& form) { PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, form)); NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); } @@ -152,7 +153,7 @@ void PasswordStoreDefault::RemoveLoginImpl(const PasswordForm& form) { PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, form)); NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); } @@ -170,7 +171,7 @@ void PasswordStoreDefault::RemoveLoginsCreatedBetweenImpl( **it)); } NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); } diff --git a/chrome/browser/password_manager/password_store_default_unittest.cc b/chrome/browser/password_manager/password_store_default_unittest.cc index 27bf5f8..06ec903 100644 --- a/chrome/browser/password_manager/password_store_default_unittest.cc +++ b/chrome/browser/password_manager/password_store_default_unittest.cc @@ -15,6 +15,7 @@ #include "chrome/browser/password_manager/password_store_default.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/webdata/web_data_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/signaling_task.h" #include "chrome/test/testing_profile.h" @@ -83,7 +84,7 @@ class DBThreadObserverHelper : void AddObserverTask(PasswordStore* password_store) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); registrar_.Add(&observer_, - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(password_store)); done_event_.Signal(); } @@ -462,7 +463,7 @@ TEST_F(PasswordStoreDefaultTest, Notifications) { }; EXPECT_CALL(helper->observer(), - Observe(NotificationType(NotificationType::LOGINS_CHANGED), + Observe(int(chrome::NOTIFICATION_LOGINS_CHANGED), Source<PasswordStore>(store), Property(&Details<const PasswordStoreChangeList>::ptr, Pointee(ElementsAreArray( @@ -486,7 +487,7 @@ TEST_F(PasswordStoreDefaultTest, Notifications) { }; EXPECT_CALL(helper->observer(), - Observe(NotificationType(NotificationType::LOGINS_CHANGED), + Observe(int(chrome::NOTIFICATION_LOGINS_CHANGED), Source<PasswordStore>(store), Property(&Details<const PasswordStoreChangeList>::ptr, Pointee(ElementsAreArray( @@ -505,7 +506,7 @@ TEST_F(PasswordStoreDefaultTest, Notifications) { }; EXPECT_CALL(helper->observer(), - Observe(NotificationType(NotificationType::LOGINS_CHANGED), + Observe(int(chrome::NOTIFICATION_LOGINS_CHANGED), Source<PasswordStore>(store), Property(&Details<const PasswordStoreChangeList>::ptr, Pointee(ElementsAreArray( diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc index 589b470..48182e5 100644 --- a/chrome/browser/password_manager/password_store_mac.cc +++ b/chrome/browser/password_manager/password_store_mac.cc @@ -20,6 +20,7 @@ #include "chrome/browser/keychain_mac.h" #include "chrome/browser/password_manager/login_database.h" #include "chrome/browser/password_manager/password_store_change.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" using webkit_glue::PasswordForm; @@ -770,7 +771,7 @@ void PasswordStoreMac::AddLoginImpl(const PasswordForm& form) { PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); } @@ -805,7 +806,7 @@ void PasswordStoreMac::UpdateLoginImpl(const PasswordForm& form) { } if (!changes.empty()) { NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); } @@ -836,7 +837,7 @@ void PasswordStoreMac::RemoveLoginImpl(const PasswordForm& form) { PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, form)); NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); } @@ -870,7 +871,7 @@ void PasswordStoreMac::RemoveLoginsCreatedBetweenImpl( **it)); } NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); } diff --git a/chrome/browser/password_manager/password_store_x.cc b/chrome/browser/password_manager/password_store_x.cc index 46a7740..10d3d7a 100644 --- a/chrome/browser/password_manager/password_store_x.cc +++ b/chrome/browser/password_manager/password_store_x.cc @@ -34,7 +34,7 @@ void PasswordStoreX::AddLoginImpl(const PasswordForm& form) { PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); allow_fallback_ = false; @@ -49,7 +49,7 @@ void PasswordStoreX::UpdateLoginImpl(const PasswordForm& form) { PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, form)); NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); allow_fallback_ = false; @@ -64,7 +64,7 @@ void PasswordStoreX::RemoveLoginImpl(const PasswordForm& form) { PasswordStoreChangeList changes; changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, form)); NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); allow_fallback_ = false; @@ -88,7 +88,7 @@ void PasswordStoreX::RemoveLoginsCreatedBetweenImpl( **it)); } NotificationService::current()->Notify( - NotificationType::LOGINS_CHANGED, + chrome::LOGINS_CHANGED, Source<PasswordStore>(this), Details<PasswordStoreChangeList>(&changes)); allow_fallback_ = false; diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc index 74be072..1a6b9bd 100644 --- a/chrome/browser/password_manager/password_store_x_unittest.cc +++ b/chrome/browser/password_manager/password_store_x_unittest.cc @@ -78,7 +78,7 @@ class DBThreadObserverHelper void AddObserverTask() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); registrar_.Add(&observer_, - NotificationType::LOGINS_CHANGED, + chrome::LOGINS_CHANGED, NotificationService::AllSources()); done_event_.Signal(); } @@ -541,7 +541,7 @@ TEST_P(PasswordStoreXTest, Notifications) { }; EXPECT_CALL(helper->observer(), - Observe(NotificationType(NotificationType::LOGINS_CHANGED), + Observe(int(chrome::LOGINS_CHANGED), NotificationService::AllSources(), Property(&Details<const PasswordStoreChangeList>::ptr, Pointee(ElementsAreArray( @@ -565,7 +565,7 @@ TEST_P(PasswordStoreXTest, Notifications) { }; EXPECT_CALL(helper->observer(), - Observe(NotificationType(NotificationType::LOGINS_CHANGED), + Observe(int(chrome::LOGINS_CHANGED), NotificationService::AllSources(), Property(&Details<const PasswordStoreChangeList>::ptr, Pointee(ElementsAreArray( @@ -584,7 +584,7 @@ TEST_P(PasswordStoreXTest, Notifications) { }; EXPECT_CALL(helper->observer(), - Observe(NotificationType(NotificationType::LOGINS_CHANGED), + Observe(int(chrome::LOGINS_CHANGED), NotificationService::AllSources(), Property(&Details<const PasswordStoreChangeList>::ptr, Pointee(ElementsAreArray( diff --git a/chrome/browser/plugin_data_remover_helper.cc b/chrome/browser/plugin_data_remover_helper.cc index 0f4df9d..599ece9 100644 --- a/chrome/browser/plugin_data_remover_helper.cc +++ b/chrome/browser/plugin_data_remover_helper.cc @@ -74,16 +74,16 @@ void PluginDataRemoverHelper::Init(const char* pref_name, PrefService* prefs, NotificationObserver* observer) { pref_.Init(pref_name, prefs, observer); - registrar_.Add(this, NotificationType::PLUGIN_ENABLE_STATUS_CHANGED, + registrar_.Add(this, content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, NotificationService::AllSources()); internal_ = make_scoped_refptr(new Internal(pref_name, prefs)); internal_->StartUpdate(); } -void PluginDataRemoverHelper::Observe(NotificationType type, +void PluginDataRemoverHelper::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::PLUGIN_ENABLE_STATUS_CHANGED) { + if (type == content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED) { internal_->StartUpdate(); } else { NOTREACHED(); diff --git a/chrome/browser/plugin_data_remover_helper.h b/chrome/browser/plugin_data_remover_helper.h index d0f8977b..dec4f41 100644 --- a/chrome/browser/plugin_data_remover_helper.h +++ b/chrome/browser/plugin_data_remover_helper.h @@ -34,7 +34,7 @@ class PluginDataRemoverHelper : public NotificationObserver { bool GetValue() const { return pref_.GetValue(); } // NotificationObserver methods: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/plugin_exceptions_table_model.cc b/chrome/browser/plugin_exceptions_table_model.cc index 1cf2a69..2a1ff0e 100644 --- a/chrome/browser/plugin_exceptions_table_model.cc +++ b/chrome/browser/plugin_exceptions_table_model.cc @@ -7,6 +7,7 @@ #include "base/auto_reset.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -19,10 +20,10 @@ PluginExceptionsTableModel::PluginExceptionsTableModel( otr_map_(otr_content_settings_map), updates_disabled_(false), observer_(NULL) { - registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, Source<HostContentSettingsMap>(map_)); if (otr_map_) { - registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, Source<HostContentSettingsMap>(otr_map_)); } } @@ -122,7 +123,7 @@ int PluginExceptionsTableModel::GetGroupID(int row) { return settings_[row].plugin_id; } -void PluginExceptionsTableModel::Observe(NotificationType type, +void PluginExceptionsTableModel::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (!updates_disabled_) diff --git a/chrome/browser/plugin_exceptions_table_model.h b/chrome/browser/plugin_exceptions_table_model.h index 55fc646..77fbee8 100644 --- a/chrome/browser/plugin_exceptions_table_model.h +++ b/chrome/browser/plugin_exceptions_table_model.h @@ -42,7 +42,7 @@ class PluginExceptionsTableModel : public RemoveRowsTableModel, virtual int GetGroupID(int row) OVERRIDE; // NotificationObserver methods: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/plugin_updater.cc b/chrome/browser/plugin_updater.cc index eaad018..bd12749 100644 --- a/chrome/browser/plugin_updater.cc +++ b/chrome/browser/plugin_updater.cc @@ -16,6 +16,7 @@ #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_content_client.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" @@ -70,10 +71,10 @@ void PluginUpdater::EnablePlugin(bool enable, NotifyPluginStatusChanged(); } -void PluginUpdater::Observe(NotificationType type, +void PluginUpdater::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(NotificationType::PREF_CHANGED, type.value); + DCHECK_EQ(chrome::NOTIFICATION_PREF_CHANGED, type); const std::string* pref_name = Details<std::string>(details).ptr(); if (!pref_name) { NOTREACHED(); @@ -328,7 +329,7 @@ void PluginUpdater::NotifyPluginStatusChanged() { void PluginUpdater::OnNotifyPluginStatusChanged() { GetInstance()->notify_pending_ = false; NotificationService::current()->Notify( - NotificationType::PLUGIN_ENABLE_STATUS_CHANGED, + content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, Source<PluginUpdater>(GetInstance()), NotificationService::NoDetails()); } diff --git a/chrome/browser/plugin_updater.h b/chrome/browser/plugin_updater.h index 0d1c856..694c3b1 100644 --- a/chrome/browser/plugin_updater.h +++ b/chrome/browser/plugin_updater.h @@ -51,7 +51,7 @@ class PluginUpdater : public NotificationObserver { void UpdatePreferences(Profile* profile, int delay_ms); // NotificationObserver method overrides - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc index baf2d03..a672e7a 100644 --- a/chrome/browser/policy/browser_policy_connector.cc +++ b/chrome/browser/policy/browser_policy_connector.cc @@ -17,6 +17,7 @@ #include "chrome/browser/policy/dummy_configuration_policy_provider.h" #include "chrome/browser/policy/user_policy_cache.h" #include "chrome/browser/policy/user_policy_token_cache.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/net/gaia/gaia_constants.h" @@ -246,7 +247,7 @@ void BrowserPolicyConnector::InitializeUserPolicy(const std::string& user_name, if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { token_service_ = token_service; registrar_.Add(this, - NotificationType::TOKEN_AVAILABLE, + chrome::NOTIFICATION_TOKEN_AVAILABLE, Source<TokenService>(token_service_)); FilePath policy_cache_dir = policy_dir.Append(kPolicyDir); @@ -336,11 +337,11 @@ void BrowserPolicyConnector::InitializeDevicePolicySubsystem() { #endif } -void BrowserPolicyConnector::Observe(NotificationType type, +void BrowserPolicyConnector::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (type == NotificationType::TOKEN_AVAILABLE) { + if (type == chrome::NOTIFICATION_TOKEN_AVAILABLE) { const TokenService* token_source = Source<const TokenService>(source).ptr(); DCHECK_EQ(token_service_, token_source); diff --git a/chrome/browser/policy/browser_policy_connector.h b/chrome/browser/policy/browser_policy_connector.h index e58b331..0b8971f 100644 --- a/chrome/browser/policy/browser_policy_connector.h +++ b/chrome/browser/policy/browser_policy_connector.h @@ -113,7 +113,7 @@ class BrowserPolicyConnector : public NotificationObserver { CloudPolicyProvider* recommended_cloud_provider); // NotificationObserver method overrides: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/policy/cloud_policy_subsystem.cc b/chrome/browser/policy/cloud_policy_subsystem.cc index 7394fee..9fd0060 100644 --- a/chrome/browser/policy/cloud_policy_subsystem.cc +++ b/chrome/browser/policy/cloud_policy_subsystem.cc @@ -16,11 +16,11 @@ #include "chrome/browser/policy/device_token_fetcher.h" #include "chrome/browser/policy/policy_notifier.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" namespace { @@ -154,10 +154,10 @@ void CloudPolicySubsystem::UpdatePolicyRefreshRate(int64 refresh_rate) { } } -void CloudPolicySubsystem::Observe(NotificationType type, +void CloudPolicySubsystem::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { DCHECK_EQ(*(Details<std::string>(details).ptr()), std::string(refresh_pref_name_)); PrefService* local_state = g_browser_process->local_state(); diff --git a/chrome/browser/policy/cloud_policy_subsystem.h b/chrome/browser/policy/cloud_policy_subsystem.h index e839716..0dfd897 100644 --- a/chrome/browser/policy/cloud_policy_subsystem.h +++ b/chrome/browser/policy/cloud_policy_subsystem.h @@ -120,7 +120,7 @@ class CloudPolicySubsystem virtual void CreateCloudPolicyController(); // NotificationObserver overrides. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/policy/managed_prefs_banner_base.cc b/chrome/browser/policy/managed_prefs_banner_base.cc index 45c824d..ca43667 100644 --- a/chrome/browser/policy/managed_prefs_banner_base.cc +++ b/chrome/browser/policy/managed_prefs_banner_base.cc @@ -7,9 +7,9 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/pref_set_observer.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_details.h" -#include "content/common/notification_type.h" namespace policy { @@ -98,10 +98,10 @@ void ManagedPrefsBannerBase::Init(PrefService* local_state, } } -void ManagedPrefsBannerBase::Observe(NotificationType type, +void ManagedPrefsBannerBase::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (NotificationType::PREF_CHANGED == type) { + if (chrome::NOTIFICATION_PREF_CHANGED == type) { std::string* pref = Details<std::string>(details).ptr(); if (pref && (local_state_set_->IsObserved(*pref) || user_pref_set_->IsObserved(*pref))) diff --git a/chrome/browser/policy/managed_prefs_banner_base.h b/chrome/browser/policy/managed_prefs_banner_base.h index 8e5d52c..3a04b2c 100644 --- a/chrome/browser/policy/managed_prefs_banner_base.h +++ b/chrome/browser/policy/managed_prefs_banner_base.h @@ -60,7 +60,7 @@ class ManagedPrefsBannerBase : public NotificationObserver { OptionsPage page); // |NotificationObserver| implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/policy/policy_stubs.cc b/chrome/browser/policy/policy_stubs.cc index b33dc77..92d1b4b 100644 --- a/chrome/browser/policy/policy_stubs.cc +++ b/chrome/browser/policy/policy_stubs.cc @@ -25,7 +25,7 @@ BrowserPolicyConnector* BrowserPolicyConnector::CreateForTests() { BrowserPolicyConnector::~BrowserPolicyConnector() { } -void BrowserPolicyConnector::Observe(NotificationType type, +void BrowserPolicyConnector::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { } diff --git a/chrome/browser/prefs/pref_change_registrar_unittest.cc b/chrome/browser/prefs/pref_change_registrar_unittest.cc index 55ccb11..d0044dd 100644 --- a/chrome/browser/prefs/pref_change_registrar_unittest.cc +++ b/chrome/browser/prefs/pref_change_registrar_unittest.cc @@ -4,10 +4,10 @@ #include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/test/testing_pref_service.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_observer_mock.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/prefs/pref_member.cc b/chrome/browser/prefs/pref_member.cc index 78a485d..43fee58 100644 --- a/chrome/browser/prefs/pref_member.cc +++ b/chrome/browser/prefs/pref_member.cc @@ -7,7 +7,7 @@ #include "base/logging.h" #include "base/value_conversions.h" #include "chrome/browser/prefs/pref_service.h" -#include "content/common/notification_type.h" +#include "chrome/common/chrome_notification_types.h" namespace subtle { @@ -51,11 +51,11 @@ void PrefMemberBase::MoveToThread(BrowserThread::ID thread_id) { internal()->MoveToThread(thread_id); } -void PrefMemberBase::Observe(NotificationType type, +void PrefMemberBase::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { VerifyValuePrefName(); - DCHECK(NotificationType::PREF_CHANGED == type); + DCHECK(chrome::NOTIFICATION_PREF_CHANGED == type); UpdateValueFromPref(); if (!setting_value_ && observer_) observer_->Observe(type, source, details); diff --git a/chrome/browser/prefs/pref_member.h b/chrome/browser/prefs/pref_member.h index 5e58a39..b5d9618 100644 --- a/chrome/browser/prefs/pref_member.h +++ b/chrome/browser/prefs/pref_member.h @@ -92,7 +92,7 @@ class PrefMemberBase : public NotificationObserver { void MoveToThread(BrowserThread::ID thread_id); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/prefs/pref_member_unittest.cc b/chrome/browser/prefs/pref_member_unittest.cc index 3cc4cb6..fdbfbb3 100644 --- a/chrome/browser/prefs/pref_member_unittest.cc +++ b/chrome/browser/prefs/pref_member_unittest.cc @@ -6,13 +6,12 @@ #include "base/message_loop.h" #include "chrome/browser/prefs/pref_value_store.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/testing_pref_service.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gtest/include/gtest/gtest.h" - namespace { const char kBoolPref[] = "bool"; @@ -73,10 +72,10 @@ class PrefMemberTestClass : public NotificationObserver { str_.Init(kStringPref, prefs, this); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(NotificationType::PREF_CHANGED == type); + DCHECK(chrome::NOTIFICATION_PREF_CHANGED == type); PrefService* prefs_in = Source<PrefService>(source).ptr(); EXPECT_EQ(prefs_in, prefs_); std::string* pref_name_in = Details<std::string>(details).ptr(); diff --git a/chrome/browser/prefs/pref_model_associator.cc b/chrome/browser/prefs/pref_model_associator.cc index e05134b..5c004a7b 100644 --- a/chrome/browser/prefs/pref_model_associator.cc +++ b/chrome/browser/prefs/pref_model_associator.cc @@ -12,6 +12,7 @@ #include "base/values.h" #include "chrome/browser/sync/api/sync_change.h" #include "chrome/browser/sync/protocol/preference_specifics.pb.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/json_value_serializer.h" #include "content/common/notification_service.h" @@ -273,7 +274,7 @@ void PrefModelAssociator::SendUpdateNotificationsIfNecessary( // notification to update the UI. if (0 == pref_name.compare(prefs::kShowBookmarkBar)) { NotificationService::current()->Notify( - NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, + chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, Source<PrefModelAssociator>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/prefs/pref_notifier_impl.cc b/chrome/browser/prefs/pref_notifier_impl.cc index 6d1dd2a..cdf67294 100644 --- a/chrome/browser/prefs/pref_notifier_impl.cc +++ b/chrome/browser/prefs/pref_notifier_impl.cc @@ -6,6 +6,7 @@ #include "base/stl_util-inl.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_service.h" @@ -78,7 +79,7 @@ void PrefNotifierImpl::OnInitializationCompleted(bool succeeded) { DCHECK(CalledOnValidThread()); NotificationService::current()->Notify( - NotificationType::PREF_INITIALIZATION_COMPLETED, + chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED, Source<PrefService>(pref_service_), Details<bool>(&succeeded)); } @@ -98,7 +99,7 @@ void PrefNotifierImpl::FireObservers(const std::string& path) { NotificationObserverList::Iterator it(*(observer_iterator->second)); NotificationObserver* observer; while ((observer = it.GetNext()) != NULL) { - observer->Observe(NotificationType::PREF_CHANGED, + observer->Observe(chrome::NOTIFICATION_PREF_CHANGED, Source<PrefService>(pref_service_), Details<const std::string>(&path)); } diff --git a/chrome/browser/prefs/pref_notifier_impl_unittest.cc b/chrome/browser/prefs/pref_notifier_impl_unittest.cc index c413e32..32d7f22 100644 --- a/chrome/browser/prefs/pref_notifier_impl_unittest.cc +++ b/chrome/browser/prefs/pref_notifier_impl_unittest.cc @@ -6,6 +6,7 @@ #include "chrome/browser/prefs/pref_observer_mock.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/pref_value_store.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/testing_pref_service.h" #include "content/common/notification_observer_mock.h" #include "content/common/notification_registrar.h" @@ -80,11 +81,10 @@ TEST_F(PrefNotifierTest, OnInitializationCompleted) { MockPrefNotifier notifier(&pref_service_); NotificationObserverMock observer; NotificationRegistrar registrar; - registrar.Add(&observer, NotificationType::PREF_INITIALIZATION_COMPLETED, + registrar.Add(&observer, chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED, Source<PrefService>(&pref_service_)); EXPECT_CALL(observer, Observe( - Field(&NotificationType::value, - NotificationType::PREF_INITIALIZATION_COMPLETED), + int(chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED), Source<PrefService>(&pref_service_), Property(&Details<bool>::ptr, testing::Pointee(true)))); notifier.OnInitializationCompleted(true); diff --git a/chrome/browser/prefs/pref_observer_mock.cc b/chrome/browser/prefs/pref_observer_mock.cc index a41ed5c..5d144b7 100644 --- a/chrome/browser/prefs/pref_observer_mock.cc +++ b/chrome/browser/prefs/pref_observer_mock.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "chrome/browser/prefs/pref_observer_mock.h" +#include "chrome/common/chrome_notification_types.h" PrefObserverMock::PrefObserverMock() {} @@ -11,7 +12,7 @@ PrefObserverMock::~PrefObserverMock() {} void PrefObserverMock::Expect(const PrefService* prefs, const std::string& pref_name, const Value* value) { - EXPECT_CALL(*this, Observe(NotificationType(NotificationType::PREF_CHANGED), + EXPECT_CALL(*this, Observe(int(chrome::NOTIFICATION_PREF_CHANGED), Source<PrefService>(prefs), Property(&Details<std::string>::ptr, Pointee(pref_name)))) diff --git a/chrome/browser/prefs/pref_observer_mock.h b/chrome/browser/prefs/pref_observer_mock.h index eac1c13..3ef7437 100644 --- a/chrome/browser/prefs/pref_observer_mock.h +++ b/chrome/browser/prefs/pref_observer_mock.h @@ -9,10 +9,10 @@ #include <string> #include "chrome/browser/prefs/pref_service.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_observer.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" using testing::Pointee; @@ -42,7 +42,7 @@ class PrefObserverMock : public NotificationObserver { PrefObserverMock(); virtual ~PrefObserverMock(); - MOCK_METHOD3(Observe, void(NotificationType type, + MOCK_METHOD3(Observe, void(int type, const NotificationSource& source, const NotificationDetails& details)); diff --git a/chrome/browser/prefs/pref_set_observer.cc b/chrome/browser/prefs/pref_set_observer.cc index 916769e..4ab741f 100644 --- a/chrome/browser/prefs/pref_set_observer.cc +++ b/chrome/browser/prefs/pref_set_observer.cc @@ -5,7 +5,7 @@ #include "chrome/browser/prefs/pref_set_observer.h" #include "chrome/common/pref_names.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" PrefSetObserver::PrefSetObserver(PrefService* pref_service, NotificationObserver* observer) @@ -69,7 +69,7 @@ PrefSetObserver* PrefSetObserver::CreateDefaultSearchPrefSetObserver( return pref_set; } -void PrefSetObserver::Observe(NotificationType type, +void PrefSetObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (observer_) diff --git a/chrome/browser/prefs/pref_set_observer.h b/chrome/browser/prefs/pref_set_observer.h index 40c38e5..2639462 100644 --- a/chrome/browser/prefs/pref_set_observer.h +++ b/chrome/browser/prefs/pref_set_observer.h @@ -44,7 +44,7 @@ class PrefSetObserver : public NotificationObserver { private: // Overridden from NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/prefs/pref_set_observer_unittest.cc b/chrome/browser/prefs/pref_set_observer_unittest.cc index 49fc507..eb68d3f 100644 --- a/chrome/browser/prefs/pref_set_observer_unittest.cc +++ b/chrome/browser/prefs/pref_set_observer_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "chrome/browser/prefs/pref_set_observer.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_pref_service.h" #include "content/common/notification_details.h" @@ -73,7 +74,7 @@ TEST_F(PrefSetObserverTest, Observe) { scoped_ptr<PrefSetObserver> pref_set(CreatePrefSetObserver(&observer)); EXPECT_CALL(observer, - Observe(NotificationType(NotificationType::PREF_CHANGED), + Observe(int(chrome::NOTIFICATION_PREF_CHANGED), Source<PrefService>(pref_service_.get()), PrefNameDetails(prefs::kHomePage))); pref_service_->SetUserPref(prefs::kHomePage, @@ -81,7 +82,7 @@ TEST_F(PrefSetObserverTest, Observe) { Mock::VerifyAndClearExpectations(&observer); EXPECT_CALL(observer, - Observe(NotificationType(NotificationType::PREF_CHANGED), + Observe(int(chrome::NOTIFICATION_PREF_CHANGED), Source<PrefService>(pref_service_.get()), PrefNameDetails(prefs::kHomePageIsNewTabPage))); pref_service_->SetUserPref(prefs::kHomePageIsNewTabPage, diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index d1bfc33..196eff4 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -22,6 +22,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.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/chrome_switches.h" #include "chrome/common/pref_names.h" @@ -185,7 +186,7 @@ class TestPrerenderContents : public PrerenderContents { // subsequently shown. notification_registrar().Add( this, - NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED, + content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, Source<RenderWidgetHost>(new_render_view_host)); new_render_view_host_ = new_render_view_host; @@ -193,11 +194,11 @@ class TestPrerenderContents : public PrerenderContents { PrerenderContents::OnRenderViewHostCreated(new_render_view_host); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE { - if (type.value == - NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED) { + if (type == + content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED) { EXPECT_EQ(new_render_view_host_, Source<RenderWidgetHost>(source).ptr()); bool is_visible = *Details<bool>(details).ptr(); @@ -1460,7 +1461,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderFavicon) { TestPrerenderContents* prerender_contents = GetPrerenderContents(); ASSERT_TRUE(prerender_contents != NULL); ui_test_utils::WindowedNotificationObserver favicon_update_watcher( - NotificationType::FAVICON_UPDATED, + chrome::NOTIFICATION_FAVICON_UPDATED, Source<TabContents>(prerender_contents->prerender_contents()-> tab_contents())); NavigateToDestURL(); diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index ca05dae..91b72e8 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -20,6 +20,7 @@ #include "chrome/browser/ui/browser_list.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/icon_messages.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" @@ -222,35 +223,36 @@ void PrerenderContents::StartPrerendering( prerender_manager_); // Close ourselves when the application is shutting down. - notification_registrar_.Add(this, NotificationType::APP_TERMINATING, + notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, NotificationService::AllSources()); // Register for our parent profile to shutdown, so we can shut ourselves down // as well (should only be called for OTR profiles, as we should receive // APP_TERMINATING before non-OTR profiles are destroyed). // TODO(tburkard): figure out if this is needed. - notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); // Register to inform new RenderViews that we're prerendering. notification_registrar_.Add( - this, NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, + this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, Source<TabContents>(new_contents)); // Register to be told when the RenderView is ready, so we can hide it. // It will automatically be set to visible when we resize it, otherwise. - notification_registrar_.Add(this, NotificationType::TAB_CONTENTS_CONNECTED, + notification_registrar_.Add(this, + content::NOTIFICATION_TAB_CONTENTS_CONNECTED, Source<TabContents>(new_contents)); // Register for redirect notifications sourced from |this|. notification_registrar_.Add( - this, NotificationType::RESOURCE_RECEIVED_REDIRECT, + this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, Source<RenderViewHostDelegate>(GetRenderViewHostDelegate())); // Register for new windows from any source. - notification_registrar_.Add(this, - NotificationType::CREATING_NEW_WINDOW_CANCELLED, - Source<TabContents>(new_contents)); + notification_registrar_.Add( + this, content::NOTIFICATION_CREATING_NEW_WINDOW_CANCELLED, + Source<TabContents>(new_contents)); DCHECK(load_start_time_.is_null()); load_start_time_ = base::TimeTicks::Now(); @@ -311,19 +313,19 @@ PrerenderContents::~PrerenderContents() { prerender_tracker_->RemovePrerenderURLsOnUIThread(alias_urls_); } -void PrerenderContents::Observe(NotificationType type, +void PrerenderContents::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PROFILE_DESTROYED: + switch (type) { + case chrome::NOTIFICATION_PROFILE_DESTROYED: Destroy(FINAL_STATUS_PROFILE_DESTROYED); return; - case NotificationType::APP_TERMINATING: + case content::NOTIFICATION_APP_TERMINATING: Destroy(FINAL_STATUS_APP_TERMINATING); return; - case NotificationType::RESOURCE_RECEIVED_REDIRECT: { + case content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT: { // RESOURCE_RECEIVED_REDIRECT can come for any resource on a page. // If it's a redirect on the top-level resource, the name needs // to be remembered for future matching, and if it redirects to @@ -342,7 +344,7 @@ void PrerenderContents::Observe(NotificationType type, break; } - case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: { + case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { if (prerender_contents_.get()) { DCHECK_EQ(Source<TabContents>(source).ptr(), prerender_contents_->tab_contents()); @@ -362,7 +364,7 @@ void PrerenderContents::Observe(NotificationType type, break; } - case NotificationType::TAB_CONTENTS_CONNECTED: { + case content::NOTIFICATION_TAB_CONTENTS_CONNECTED: { if (prerender_contents_.get()) { DCHECK_EQ(Source<TabContents>(source).ptr(), prerender_contents_->tab_contents()); @@ -374,7 +376,7 @@ void PrerenderContents::Observe(NotificationType type, return; } - case NotificationType::CREATING_NEW_WINDOW_CANCELLED: { + case content::NOTIFICATION_CREATING_NEW_WINDOW_CANCELLED: { if (prerender_contents_.get()) { CHECK(Source<TabContents>(source).ptr() == prerender_contents_->tab_contents()); diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h index b7f20f7..600fb5c 100644 --- a/chrome/browser/prerender/prerender_contents.h +++ b/chrome/browser/prerender/prerender_contents.h @@ -132,7 +132,7 @@ class PrerenderContents : public NotificationObserver, virtual void DidStopLoading() OVERRIDE; // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/printing/background_printing_manager.cc b/chrome/browser/printing/background_printing_manager.cc index 3a4b32e..1c4c8ff 100644 --- a/chrome/browser/printing/background_printing_manager.cc +++ b/chrome/browser/printing/background_printing_manager.cc @@ -10,6 +10,7 @@ #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -36,9 +37,9 @@ void BackgroundPrintingManager::OwnTabContents(TabContentsWrapper* contents) { printing_contents_.insert(contents); - registrar_.Add(this, NotificationType::PRINT_JOB_RELEASED, + registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(contents)); - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(contents->tab_contents())); // Detach |contents| from its tab strip. @@ -61,13 +62,13 @@ void BackgroundPrintingManager::OwnTabContents(TabContentsWrapper* contents) { initiator_tab->Activate(); } -void BackgroundPrintingManager::Observe(NotificationType type, +void BackgroundPrintingManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PRINT_JOB_RELEASED: { + switch (type) { + case chrome::NOTIFICATION_PRINT_JOB_RELEASED: { TabContentsWrapper* tab = Source<TabContentsWrapper>(source).ptr(); - registrar_.Remove(this, NotificationType::PRINT_JOB_RELEASED, + registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(tab)); // This might be happening in the middle of a RenderViewGone() loop. @@ -75,16 +76,16 @@ void BackgroundPrintingManager::Observe(NotificationType type, MessageLoop::current()->DeleteSoon(FROM_HERE, tab); break; } - case NotificationType::TAB_CONTENTS_DESTROYED: { + case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<TabContents>(source).ptr()); - if (registrar_.IsRegistered(this, NotificationType::PRINT_JOB_RELEASED, + if (registrar_.IsRegistered(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(tab))) { - registrar_.Remove(this, NotificationType::PRINT_JOB_RELEASED, + registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(tab)); } - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab->tab_contents())); printing_contents_.erase(tab); break; diff --git a/chrome/browser/printing/background_printing_manager.h b/chrome/browser/printing/background_printing_manager.h index fb77f0a..4d935fa 100644 --- a/chrome/browser/printing/background_printing_manager.h +++ b/chrome/browser/printing/background_printing_manager.h @@ -40,7 +40,7 @@ class BackgroundPrintingManager bool HasTabContents(TabContentsWrapper* entry); // NotificationObserver overrides: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 7e653e0..edd9881 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -27,9 +27,9 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/webui/web_ui.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "content/common/view_messages.h" #include "ui/base/l10n/l10n_util.h" #include "webkit/glue/webpreferences.h" @@ -270,15 +270,15 @@ void CloudPrintFlowHandler::RegisterMessages() { if (pending_entry) pending_entry->set_url(CloudPrintURL( web_ui_->GetProfile()).GetCloudPrintServiceDialogURL()); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(controller)); } } -void CloudPrintFlowHandler::Observe(NotificationType type, +void CloudPrintFlowHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::LOAD_STOP) { + if (type == content::NOTIFICATION_LOAD_STOP) { // Take the opportunity to set some (minimal) additional // script permissions required for the web UI. GURL url = web_ui_->tab_contents()->GetURL(); diff --git a/chrome/browser/printing/print_dialog_cloud_internal.h b/chrome/browser/printing/print_dialog_cloud_internal.h index 1ceb2fb..23f8e2b 100644 --- a/chrome/browser/printing/print_dialog_cloud_internal.h +++ b/chrome/browser/printing/print_dialog_cloud_internal.h @@ -101,7 +101,7 @@ class CloudPrintFlowHandler : public WebUIMessageHandler, virtual void RegisterMessages(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc index 688f5e4..86a832c 100644 --- a/chrome/browser/printing/print_dialog_cloud_unittest.cc +++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc @@ -20,9 +20,9 @@ #include "chrome/common/url_constants.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -88,7 +88,7 @@ class MockCloudPrintFlowHandler MOCK_METHOD0(DestructorCalled, void()); MOCK_METHOD0(RegisterMessages, void()); MOCK_METHOD3(Observe, - void(NotificationType type, + void(int type, const NotificationSource& source, const NotificationDetails& details)); MOCK_METHOD1(SetDialogDelegate, diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc index 898f8ae..c1e61e3 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc @@ -8,6 +8,7 @@ #include "base/threading/thread_restrictions.h" #include "base/timer.h" #include "chrome/browser/printing/print_job_worker.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "printing/printed_document.h" #include "printing/printed_page.h" @@ -59,16 +60,16 @@ void PrintJob::Initialize(PrintJobWorkerOwner* job, UpdatePrintedDocument(new_doc); // Don't forget to register to our own messages. - registrar_.Add(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(this)); } -void PrintJob::Observe(NotificationType type, +void PrintJob::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK_EQ(ui_message_loop_, MessageLoop::current()); - switch (type.value) { - case NotificationType::PRINT_JOB_EVENT: { + switch (type) { + case chrome::NOTIFICATION_PRINT_JOB_EVENT: { OnNotifyPrintJobEvent(*Details<JobEventDetails>(details).ptr()); break; } @@ -124,7 +125,7 @@ void PrintJob::StartPrinting() { scoped_refptr<JobEventDetails> details( new JobEventDetails(JobEventDetails::NEW_DOC, document_.get(), NULL)); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_EVENT, + chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(this), Details<JobEventDetails>(details.get())); } @@ -140,7 +141,7 @@ void PrintJob::Stop() { ControlledWorkerShutdown(); is_job_pending_ = false; - registrar_.Remove(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(this)); } // Flush the cached document. @@ -166,7 +167,7 @@ void PrintJob::Cancel() { scoped_refptr<JobEventDetails> details( new JobEventDetails(JobEventDetails::FAILED, NULL, NULL)); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_EVENT, + chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(this), Details<JobEventDetails>(details.get())); Stop(); @@ -273,7 +274,7 @@ void PrintJob::OnDocumentDone() { scoped_refptr<JobEventDetails> details( new JobEventDetails(JobEventDetails::JOB_DONE, document_.get(), NULL)); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_EVENT, + chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(this), Details<JobEventDetails>(details.get())); } diff --git a/chrome/browser/printing/print_job.h b/chrome/browser/printing/print_job.h index 023d5d5..e0d7e46 100644 --- a/chrome/browser/printing/print_job.h +++ b/chrome/browser/printing/print_job.h @@ -47,7 +47,7 @@ class PrintJob : public PrintJobWorkerOwner, int page_count); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/printing/print_job_manager.cc b/chrome/browser/printing/print_job_manager.cc index 59b9d04..c692d17 100644 --- a/chrome/browser/printing/print_job_manager.cc +++ b/chrome/browser/printing/print_job_manager.cc @@ -8,6 +8,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/printing/print_job.h" #include "chrome/browser/printing/printer_query.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_service.h" #include "printing/printed_document.h" @@ -16,7 +17,7 @@ namespace printing { PrintJobManager::PrintJobManager() { - registrar_.Add(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, NotificationService::AllSources()); } @@ -93,11 +94,11 @@ void PrintJobManager::RegisterPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kPrintingEnabled, true); } -void PrintJobManager::Observe(NotificationType type, +void PrintJobManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PRINT_JOB_EVENT: { + switch (type) { + case chrome::NOTIFICATION_PRINT_JOB_EVENT: { OnPrintJobEvent(Source<PrintJob>(source).ptr(), *Details<JobEventDetails>(details).ptr()); break; diff --git a/chrome/browser/printing/print_job_manager.h b/chrome/browser/printing/print_job_manager.h index c6089df..47b1052 100644 --- a/chrome/browser/printing/print_job_manager.h +++ b/chrome/browser/printing/print_job_manager.h @@ -52,7 +52,7 @@ class PrintJobManager : public NotificationObserver { static void RegisterPrefs(PrefService* prefs); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/printing/print_job_unittest.cc b/chrome/browser/printing/print_job_unittest.cc index 22ebced..4ca676c 100644 --- a/chrome/browser/printing/print_job_unittest.cc +++ b/chrome/browser/printing/print_job_unittest.cc @@ -6,6 +6,7 @@ #include "base/string16.h" #include "chrome/browser/printing/print_job.h" #include "chrome/browser/printing/print_job_worker.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" #include "googleurl/src/gurl.h" @@ -76,7 +77,7 @@ class TestPrintJob : public printing::PrintJob { class TestPrintNotifObserv : public NotificationObserver { public: // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { EXPECT_FALSE(true); @@ -94,7 +95,7 @@ TEST(PrintJobTest, SimplePrint) { NotificationRegistrar registrar_; TestPrintNotifObserv observ; - registrar_.Add(&observ, NotificationType::ALL, + registrar_.Add(&observ, content::NOTIFICATION_ALL, NotificationService::AllSources()); volatile bool check = false; scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check)); diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index 1d0fc4f..7a850c0 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -8,6 +8,7 @@ #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/printing/print_job.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" #include "printing/print_job_constants.h" @@ -38,7 +39,7 @@ class PrintJobWorker::NotificationTask : public Task { virtual void Run() { // Send the notification in the right thread. NotificationService::current()->Notify( - NotificationType::PRINT_JOB_EVENT, + chrome::NOTIFICATION_PRINT_JOB_EVENT, // We know that is is a PrintJob object in this circumstance. Source<PrintJob>(static_cast<PrintJob*>(print_job_.get())), Details<JobEventDetails>(details_)); diff --git a/chrome/browser/printing/print_preview_tab_controller.cc b/chrome/browser/printing/print_preview_tab_controller.cc index aef4dd1..b568d19 100644 --- a/chrome/browser/printing/print_preview_tab_controller.cc +++ b/chrome/browser/printing/print_preview_tab_controller.cc @@ -77,18 +77,18 @@ TabContents* PrintPreviewTabController::GetPrintPreviewForTab( return NULL; } -void PrintPreviewTabController::Observe(NotificationType type, +void PrintPreviewTabController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { TabContents* source_tab = NULL; content::LoadCommittedDetails* detail_info = NULL; - switch (type.value) { - case NotificationType::TAB_CONTENTS_DESTROYED: { + switch (type) { + case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: { source_tab = Source<TabContents>(source).ptr(); break; } - case NotificationType::NAV_ENTRY_COMMITTED: { + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { NavigationController* controller = Source<NavigationController>(source).ptr(); source_tab = controller->tab_contents(); @@ -234,16 +234,16 @@ TabContents* PrintPreviewTabController::CreatePrintPreviewTab( } void PrintPreviewTabController::AddObservers(TabContents* tab) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab)); - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&tab->controller())); } void PrintPreviewTabController::RemoveObservers(TabContents* tab) { - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab)); - registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&tab->controller())); } diff --git a/chrome/browser/printing/print_preview_tab_controller.h b/chrome/browser/printing/print_preview_tab_controller.h index 7c03016..6bfc8dc 100644 --- a/chrome/browser/printing/print_preview_tab_controller.h +++ b/chrome/browser/printing/print_preview_tab_controller.h @@ -53,7 +53,7 @@ class PrintPreviewTabController TabContents* GetInitiatorTab(TabContents* preview_tab); // Notification observer implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index 39c485c..adc94b9 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc @@ -14,6 +14,7 @@ #include "chrome/browser/printing/print_view_manager_observer.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/webui/print_preview_ui.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/print_messages.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_entry.h" @@ -223,7 +224,7 @@ void PrintViewManager::OnPrintingFailed(int cookie) { ReleasePrinterQuery(cookie); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_RELEASED, + chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContents>(tab_contents()), NotificationService::NoDetails()); } @@ -243,11 +244,11 @@ bool PrintViewManager::OnMessageReceived(const IPC::Message& message) { return handled; } -void PrintViewManager::Observe(NotificationType type, +void PrintViewManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PRINT_JOB_EVENT: { + switch (type) { + case chrome::NOTIFICATION_PRINT_JOB_EVENT: { OnNotifyPrintJobEvent(*Details<JobEventDetails>(details).ptr()); break; } @@ -265,7 +266,7 @@ void PrintViewManager::OnNotifyPrintJobEvent( TerminatePrintJob(true); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_RELEASED, + chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(tab_), NotificationService::NoDetails()); break; @@ -295,7 +296,7 @@ void PrintViewManager::OnNotifyPrintJobEvent( ReleasePrintJob(); NotificationService::current()->Notify( - NotificationType::PRINT_JOB_RELEASED, + chrome::NOTIFICATION_PRINT_JOB_RELEASED, Source<TabContentsWrapper>(tab_), NotificationService::NoDetails()); break; @@ -377,7 +378,7 @@ bool PrintViewManager::CreateNewPrintJob(PrintJobWorkerOwner* job) { print_job_ = new PrintJob(); print_job_->Initialize(job, this, number_pages_); - registrar_.Add(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(print_job_.get())); printing_succeeded_ = false; return true; @@ -437,7 +438,7 @@ void PrintViewManager::ReleasePrintJob() { PrintingDone(printing_succeeded_); - registrar_.Remove(this, NotificationType::PRINT_JOB_EVENT, + registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, Source<PrintJob>(print_job_.get())); print_job_->DisconnectSource(); // Don't close the worker thread. diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h index 6a1314f..698038b 100644 --- a/chrome/browser/printing/print_view_manager.h +++ b/chrome/browser/printing/print_view_manager.h @@ -61,7 +61,7 @@ class PrintViewManager : public NotificationObserver, virtual GURL RenderSourceUrl(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index b5f9a32..2e23117 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -35,6 +35,7 @@ #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/browser/ui/webui/extension_icon_source.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" @@ -252,9 +253,9 @@ class OffTheRecordProfileImpl : public Profile, } virtual ~OffTheRecordProfileImpl() { - NotificationService::current()->Notify(NotificationType::PROFILE_DESTROYED, - Source<Profile>(this), - NotificationService::NoDetails()); + NotificationService::current()->Notify( + chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(this), + NotificationService::NoDetails()); ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 4054c08..b6bef63 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -76,6 +76,7 @@ #include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" @@ -309,7 +310,7 @@ ProfileImpl::ProfileImpl(const FilePath& path, true)); // Wait for the notifcation that prefs has been loaded (successfully or // not). - registrar_.Add(this, NotificationType::PREF_INITIALIZATION_COMPLETED, + registrar_.Add(this, chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED, Source<PrefService>(prefs_.get())); } else { // Load prefs synchronously. @@ -350,7 +351,7 @@ void ProfileImpl::DoFinalInit() { #if !defined(OS_CHROMEOS) // Listen for bookmark model load, to bootstrap the sync service. // On CrOS sync service will be initialized after sign in. - registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, Source<Profile>(this)); #endif @@ -585,7 +586,7 @@ void ProfileImpl::set_last_selected_directory(const FilePath& path) { ProfileImpl::~ProfileImpl() { NotificationService::current()->Notify( - NotificationType::PROFILE_DESTROYED, + chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(this), NotificationService::NoDetails()); @@ -698,7 +699,7 @@ Profile* ProfileImpl::GetOffTheRecordProfile() { off_the_record_profile_.swap(p); NotificationService::current()->Notify( - NotificationType::OTR_PROFILE_CREATED, + chrome::NOTIFICATION_OTR_PROFILE_CREATED, Source<Profile>(off_the_record_profile_.get()), NotificationService::NoDetails()); } @@ -866,7 +867,7 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { // TODO(eroman): this isn't terribly useful anymore now that the // net::URLRequestContext is constructed by the IO thread... NotificationService::current()->Notify( - NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, + chrome::NOTIFICATION_DEFAULT_REQUEST_CONTEXT_AVAILABLE, NotificationService::AllSources(), NotificationService::NoDetails()); } @@ -973,7 +974,7 @@ HostZoomMap* ProfileImpl::GetHostZoomMap() { } } - registrar_.Add(this, NotificationType::ZOOM_LEVEL_CHANGED, + registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, Source<HostZoomMap>(host_zoom_map_)); } return host_zoom_map_.get(); @@ -1022,7 +1023,7 @@ HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) { // Send out the notification that the history service was created. NotificationService::current()-> - Notify(NotificationType::HISTORY_CREATED, Source<Profile>(this), + Notify(chrome::NOTIFICATION_HISTORY_CREATED, Source<Profile>(this), Details<HistoryService>(history_service_.get())); } return history_service_.get(); @@ -1354,20 +1355,21 @@ void ProfileImpl::MarkAsCleanShutdown() { } } -void ProfileImpl::Observe(NotificationType type, +void ProfileImpl::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PREF_INITIALIZATION_COMPLETED: { + switch (type) { + case chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED: { bool* succeeded = Details<bool>(details).ptr(); PrefService *prefs = Source<PrefService>(source).ptr(); DCHECK(prefs == prefs_.get()); - registrar_.Remove(this, NotificationType::PREF_INITIALIZATION_COMPLETED, + registrar_.Remove(this, + chrome::NOTIFICATION_PREF_INITIALIZATION_COMPLETED, Source<PrefService>(prefs)); OnPrefsLoaded(*succeeded); break; } - case NotificationType::PREF_CHANGED: { + case chrome::NOTIFICATION_PREF_CHANGED: { std::string* pref_name_in = Details<std::string>(details).ptr(); PrefService* prefs = Source<PrefService>(source).ptr(); DCHECK(pref_name_in && prefs); @@ -1406,12 +1408,12 @@ void ProfileImpl::Observe(NotificationType type, } break; } - case NotificationType::BOOKMARK_MODEL_LOADED: + case chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED: GetProfileSyncService(); // Causes lazy-load if sync is enabled. - registrar_.Remove(this, NotificationType::BOOKMARK_MODEL_LOADED, + registrar_.Remove(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, Source<Profile>(this)); break; - case NotificationType::ZOOM_LEVEL_CHANGED: { + case content::NOTIFICATION_ZOOM_LEVEL_CHANGED: { const std::string& host = *(Details<const std::string>(details).ptr()); if (!host.empty()) { double level = host_zoom_map_->GetZoomLevel(host); diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index 77551d3..52a85c3 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -139,7 +139,7 @@ class ProfileImpl : public Profile, virtual prerender::PrerenderManager* GetPrerenderManager(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc index f605c75..a3c9b31 100644 --- a/chrome/browser/profiles/profile_info_cache.cc +++ b/chrome/browser/profiles/profile_info_cache.cc @@ -14,6 +14,7 @@ #include "base/values.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -244,7 +245,7 @@ void ProfileInfoCache::SetInfoForProfileAtIndex(size_t index, cache->Set(sorted_keys_[index], info); NotificationService::current()->Notify( - NotificationType::PROFILE_CACHED_INFO_CHANGED, + chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, NotificationService::AllSources(), NotificationService::NoDetails()); } diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index ae51d76..fefb5cb 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -29,6 +29,7 @@ #include "chrome/browser/prerender/prerender_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -93,16 +94,16 @@ class ChromeCookieMonsterDelegate : public net::CookieMonster::Delegate { explicit ProfileGetter(Profile* profile) : profile_(profile) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); registrar_.Add(this, - NotificationType::PROFILE_DESTROYED, + chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); } // NotificationObserver implementation. - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (NotificationType::PROFILE_DESTROYED == type) { + if (chrome::NOTIFICATION_PROFILE_DESTROYED == type) { Profile* profile = Source<Profile>(source).ptr(); if (profile_ == profile) profile_ = NULL; @@ -134,7 +135,7 @@ class ChromeCookieMonsterDelegate : public net::CookieMonster::Delegate { if (profile_getter_->get()) { ChromeCookieDetails cookie_details(&cookie, removed, cause); NotificationService::current()->Notify( - NotificationType::COOKIE_CHANGED, + chrome::NOTIFICATION_COOKIE_CHANGED, Source<Profile>(profile_getter_->get()), Details<ChromeCookieDetails>(&cookie_details)); } diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index 7110e43..d4ce662 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -27,8 +27,8 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_thread.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "net/http/http_transaction_factory.h" #include "net/url_request/url_request_context.h" @@ -104,7 +104,7 @@ ProfileManager::ProfileManager() : logged_in_(false) { #if defined(OS_CHROMEOS) registrar_.Add( this, - NotificationType::LOGIN_USER_CHANGED, + chrome::LOGIN_USER_CHANGED, NotificationService::AllSources()); #endif } @@ -342,11 +342,11 @@ Profile* ProfileManager::GetProfileByPath(const FilePath& path) const { } void ProfileManager::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { #if defined(OS_CHROMEOS) - if (type == NotificationType::LOGIN_USER_CHANGED) { + if (type == chrome::LOGIN_USER_CHANGED) { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (!command_line.HasSwitch(switches::kTestType)) { // This will fail when running on non cros os. diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h index c369b44..926293b 100644 --- a/chrome/browser/profiles/profile_manager.h +++ b/chrome/browser/profiles/profile_manager.h @@ -108,7 +108,7 @@ class ProfileManager : public base::NonThreadSafe, std::vector<Profile*> GetLoadedProfiles() const; // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc index e23b30a..b409c43 100644 --- a/chrome/browser/profiles/profile_manager_unittest.cc +++ b/chrome/browser/profiles/profile_manager_unittest.cc @@ -113,7 +113,7 @@ TEST_F(ProfileManagerTest, LoggedInProfileDir) { EXPECT_EQ(expected_default.value(), profile_manager_->GetCurrentProfileDir().value()); - profile_manager_->Observe(NotificationType::LOGIN_USER_CHANGED, + profile_manager_->Observe(chrome::LOGIN_USER_CHANGED, NotificationService::AllSources(), NotificationService::NoDetails()); FilePath expected_logged_in(profile_dir); diff --git a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc index b9f0a60..081163f 100644 --- a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc +++ b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc @@ -11,6 +11,7 @@ #include "chrome/common/render_messages.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "content/common/url_constants.h" #include "content/common/view_messages.h" @@ -46,7 +47,7 @@ void ChromeRenderViewHostObserver::OnDomOperationResponse( const std::string& json_string, int automation_id) { DomOperationNotificationDetails details(json_string, automation_id); NotificationService::current()->Notify( - NotificationType::DOM_OPERATION_RESPONSE, + chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, Source<RenderViewHost>(render_view_host()), Details<DomOperationNotificationDetails>(&details)); } diff --git a/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc b/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc index 94f382f..08e2656 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc @@ -18,19 +18,19 @@ using WebKit::WebTouchEvent; namespace { -WebKit::WebTouchPoint::State TouchPointStateFromEvent( +WebKit::WebTouchPocontent::NOTIFICATION_State TouchPointStateFromEvent( const views::TouchEvent* event) { switch (event->type()) { case ui::ET_TOUCH_PRESSED: - return WebKit::WebTouchPoint::StatePressed; + return WebKit::WebTouchPocontent::NOTIFICATION_StatePressed; case ui::ET_TOUCH_RELEASED: - return WebKit::WebTouchPoint::StateReleased; + return WebKit::WebTouchPocontent::NOTIFICATION_StateReleased; case ui::ET_TOUCH_MOVED: - return WebKit::WebTouchPoint::StateMoved; + return WebKit::WebTouchPocontent::NOTIFICATION_StateMoved; case ui::ET_TOUCH_CANCELLED: - return WebKit::WebTouchPoint::StateCancelled; + return WebKit::WebTouchPocontent::NOTIFICATION_StateCancelled; default: - return WebKit::WebTouchPoint::StateUndefined; + return WebKit::WebTouchPocontent::NOTIFICATION_StateUndefined; } } @@ -138,7 +138,7 @@ ui::TouchStatus RenderWidgetHostViewViews::OnTouchEvent( // Update the location and state of the point. point->state = TouchPointStateFromEvent(&event); - if (point->state == WebKit::WebTouchPoint::StateMoved) { + if (point->state == WebKit::WebTouchPocontent::NOTIFICATION_StateMoved) { // It is possible for badly written touch drivers to emit Move events even // when the touch location hasn't changed. In such cases, consume the event // and pretend nothing happened. @@ -152,7 +152,7 @@ ui::TouchStatus RenderWidgetHostViewViews::OnTouchEvent( for (int i = 0; i < touch_event_.touchPointsLength; ++i) { WebKit::WebTouchPoint* iter = touch_event_.touchPoints + i; if (iter != point) { - iter->state = WebKit::WebTouchPoint::StateStationary; + iter->state = WebKit::WebTouchPocontent::NOTIFICATION_StateStationary; } } diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index ee63946..7934837 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -243,7 +243,7 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) text_input_type_(ui::TEXT_INPUT_TYPE_NONE) { render_widget_host_->SetView(this); registrar_.Add(this, - NotificationType::RENDERER_PROCESS_TERMINATED, + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); } @@ -1460,10 +1460,10 @@ void RenderWidgetHostViewWin::OnAccessibilityNotifications( browser_accessibility_manager_->OnAccessibilityNotifications(params); } -void RenderWidgetHostViewWin::Observe(NotificationType type, +void RenderWidgetHostViewWin::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); + DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); // Get the RenderProcessHost that posted this notification, and exit // if it's not the one associated with this host view. diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h index 70e126c..a079c55 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.h +++ b/chrome/browser/renderer_host/render_widget_host_view_win.h @@ -174,7 +174,7 @@ class RenderWidgetHostViewWin ) OVERRIDE; // Implementation of NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/renderer_host/web_cache_manager.cc b/chrome/browser/renderer_host/web_cache_manager.cc index 403b7e3..fa71150 100644 --- a/chrome/browser/renderer_host/web_cache_manager.cc +++ b/chrome/browser/renderer_host/web_cache_manager.cc @@ -15,6 +15,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "content/browser/renderer_host/browser_render_process_host.h" @@ -63,9 +64,9 @@ WebCacheManager* WebCacheManager::GetInstance() { WebCacheManager::WebCacheManager() : global_size_limit_(GetDefaultGlobalSizeLimit()), ALLOW_THIS_IN_INITIALIZER_LIST(revise_allocation_factory_(this)) { - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); } @@ -142,7 +143,7 @@ void WebCacheManager::ObserveStats(int renderer_id, // &stats_details is only valid during the notification. // See notification_types.h. NotificationService::current()->Notify( - NotificationType::WEB_CACHE_STATS_OBSERVED, + chrome::NOTIFICATION_WEB_CACHE_STATS_OBSERVED, Source<RenderProcessHost>(RenderProcessHost::FromID(renderer_id)), Details<WebCache::UsageStats>(&stats_details)); } @@ -158,16 +159,16 @@ void WebCacheManager::ClearCache() { ClearRendederCache(inactive_renderers_); } -void WebCacheManager::Observe(NotificationType type, +void WebCacheManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::RENDERER_PROCESS_CREATED: { + switch (type) { + case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); Add(process->id()); break; } - case NotificationType::RENDERER_PROCESS_TERMINATED: { + case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); Remove(process->id()); break; diff --git a/chrome/browser/renderer_host/web_cache_manager.h b/chrome/browser/renderer_host/web_cache_manager.h index 8c3d7b0..02c6958 100644 --- a/chrome/browser/renderer_host/web_cache_manager.h +++ b/chrome/browser/renderer_host/web_cache_manager.h @@ -71,7 +71,7 @@ class WebCacheManager : public NotificationObserver { void ClearCache(); // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/repost_form_warning_controller.cc b/chrome/browser/repost_form_warning_controller.cc index 087c391..f57cbdb 100644 --- a/chrome/browser/repost_form_warning_controller.cc +++ b/chrome/browser/repost_form_warning_controller.cc @@ -12,11 +12,11 @@ RepostFormWarningController::RepostFormWarningController( : tab_contents_(tab_contents), window_(NULL) { NavigationController* controller = &tab_contents->controller(); - registrar_.Add(this, NotificationType::LOAD_START, + registrar_.Add(this, content::NOTIFICATION_LOAD_START, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::TAB_CLOSING, + registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::REPOST_WARNING_SHOWN, + registrar_.Add(this, content::NOTIFICATION_REPOST_WARNING_SHOWN, Source<NavigationController>(controller)); } @@ -47,16 +47,16 @@ void RepostFormWarningController::Continue() { } } -void RepostFormWarningController::Observe(NotificationType type, +void RepostFormWarningController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Close the dialog if we load a page (because reloading might not apply to // the same page anymore) or if the tab is closed, because then we won't have // a navigation controller anymore. if (tab_contents_ && - (type == NotificationType::LOAD_START || - type == NotificationType::TAB_CLOSING || - type == NotificationType::REPOST_WARNING_SHOWN)) { + (type == content::NOTIFICATION_LOAD_START || + type == content::NOTIFICATION_TAB_CLOSING || + type == content::NOTIFICATION_REPOST_WARNING_SHOWN)) { DCHECK_EQ(Source<NavigationController>(source).ptr(), &tab_contents_->controller()); Cancel(); diff --git a/chrome/browser/repost_form_warning_controller.h b/chrome/browser/repost_form_warning_controller.h index ce8ee59..2c1bcff 100644 --- a/chrome/browser/repost_form_warning_controller.h +++ b/chrome/browser/repost_form_warning_controller.h @@ -32,7 +32,7 @@ class RepostFormWarningController : public NotificationObserver { private: // NotificationObserver implementation. // Watch for a new load or a closed tab and dismiss the dialog if they occur. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc index 080dda7..4ed9ba7a2 100644 --- a/chrome/browser/rlz/rlz.cc +++ b/chrome/browser/rlz/rlz.cc @@ -26,6 +26,7 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/env_vars.h" #include "chrome/installer/util/google_update_settings.h" @@ -71,18 +72,18 @@ class OmniBoxUsageObserver : public NotificationObserver { : first_run_(first_run), send_ping_immediately_(send_ping_immediately), google_default_search_(google_default_search) { - registrar_.Add(this, NotificationType::OMNIBOX_OPENED_URL, + registrar_.Add(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, NotificationService::AllSources()); // If instant is enabled we'll start searching as soon as the user starts // typing in the omnibox (which triggers INSTANT_CONTROLLER_UPDATED). - registrar_.Add(this, NotificationType::INSTANT_CONTROLLER_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED, NotificationService::AllSources()); omnibox_used_ = false; DCHECK(!instance_); instance_ = this; } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -231,7 +232,7 @@ class DelayedInitTask : public Task { bool DelayedInitTask::already_ran_ = false; -void OmniBoxUsageObserver::Observe(NotificationType type, +void OmniBoxUsageObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Needs to be evaluated. See http://crbug.com/62328. diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc index 7f91230..3f81a76 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host.cc @@ -27,8 +27,8 @@ #include "content/browser/renderer_host/resource_request_details.h" #include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "content/common/view_messages.h" #include "googleurl/src/gurl.h" @@ -275,7 +275,7 @@ ClientSideDetectionHost::ClientSideDetectionHost(TabContents* tab) DCHECK(tab); // Note: csd_service_ and sb_service_ might be NULL. sb_service_ = g_browser_process->safe_browsing_service(); - registrar_.Add(this, NotificationType::RESOURCE_RESPONSE_STARTED, + registrar_.Add(this, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED, Source<RenderViewHostDelegate>(tab)); } @@ -423,11 +423,11 @@ void ClientSideDetectionHost::FeatureExtractionDone( &ClientSideDetectionHost::MaybeShowPhishingWarning)); } -void ClientSideDetectionHost::Observe(NotificationType type, +void ClientSideDetectionHost::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK_EQ(type.value, NotificationType::RESOURCE_RESPONSE_STARTED); + DCHECK_EQ(type, content::NOTIFICATION_RESOURCE_RESPONSE_STARTED); const ResourceRequestDetails* req = Details<ResourceRequestDetails>( details).ptr(); if (req && browse_info_.get()) { diff --git a/chrome/browser/safe_browsing/client_side_detection_host.h b/chrome/browser/safe_browsing/client_side_detection_host.h index 91ee49e..6276bc8 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.h +++ b/chrome/browser/safe_browsing/client_side_detection_host.h @@ -18,7 +18,6 @@ class NotificationDetails; class NotificationSource; -class NotificationType; class TabContents; namespace safe_browsing { @@ -74,7 +73,7 @@ class ClientSideDetectionHost : public TabContentsObserver, // From NotificationObserver. Called when a notification comes in. This // method is called in the UI thread. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc index d8c3858..d122732 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service.cc @@ -66,7 +66,7 @@ ClientSideDetectionService::ClientSideDetectionService( net::URLRequestContextGetter* request_context_getter) : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), request_context_getter_(request_context_getter) { - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, NotificationService::AllSources()); } @@ -189,11 +189,11 @@ void ClientSideDetectionService::OnURLFetchComplete( } } -void ClientSideDetectionService::Observe(NotificationType type, +void ClientSideDetectionService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(type == NotificationType::RENDERER_PROCESS_CREATED); + DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_CREATED); if (!model_.get()) { // Model might not be ready or maybe there was an error. return; diff --git a/chrome/browser/safe_browsing/client_side_detection_service.h b/chrome/browser/safe_browsing/client_side_detection_service.h index a47e14b..f9d1c8bf 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service.h +++ b/chrome/browser/safe_browsing/client_side_detection_service.h @@ -74,7 +74,7 @@ class ClientSideDetectionService : public URLFetcher::Delegate, const std::string& data); // NotificationObserver overrides: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/safe_browsing/malware_details_history.cc b/chrome/browser/safe_browsing/malware_details_history.cc index 28d0a378..000a59b 100644 --- a/chrome/browser/safe_browsing/malware_details_history.cc +++ b/chrome/browser/safe_browsing/malware_details_history.cc @@ -8,6 +8,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/safe_browsing/malware_details.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_entry.h" @@ -15,7 +16,6 @@ #include "content/common/notification_details.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" MalwareDetailsRedirectsCollector::MalwareDetailsRedirectsCollector( Profile* profile) @@ -24,7 +24,7 @@ MalwareDetailsRedirectsCollector::MalwareDetailsRedirectsCollector( has_started_(false) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (profile) { - registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile)); } } @@ -123,11 +123,11 @@ MalwareDetailsRedirectsCollector::GetCollectedUrls() const { } void MalwareDetailsRedirectsCollector::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK_EQ(type.value, NotificationType::PROFILE_DESTROYED); + DCHECK_EQ(type, chrome::NOTIFICATION_PROFILE_DESTROYED); DVLOG(1) << "Profile gone."; profile_ = NULL; } diff --git a/chrome/browser/safe_browsing/malware_details_history.h b/chrome/browser/safe_browsing/malware_details_history.h index c00ae8a..05523af 100644 --- a/chrome/browser/safe_browsing/malware_details_history.h +++ b/chrome/browser/safe_browsing/malware_details_history.h @@ -81,7 +81,7 @@ class MalwareDetailsRedirectsCollector // is all done. void AllDone(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index f0ba971..8b2cf1c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc @@ -315,7 +315,7 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest, TabContents* contents = browser()->GetSelectedTabContents(); if (!InterstitialPage::GetInterstitialPage(contents)) ui_test_utils::WaitForNotificationFrom( - NotificationType::INTERSTITIAL_ATTACHED, + content::NOTIFICATION_INTERSTITIAL_ATTACHED, Source<TabContents>(contents)); } diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 31b2512..f549612 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -493,7 +493,7 @@ void SafeBrowsingService::OnIOInitialize( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); enabled_ = true; - registrar_.Add(this, NotificationType::PURGE_MEMORY, + registrar_.Add(this, content::NOTIFICATION_PURGE_MEMORY, NotificationService::AllSources()); MakeDatabaseAvailable(); @@ -1208,11 +1208,11 @@ void SafeBrowsingService::UpdateWhitelist(const UnsafeResource& resource) { white_listed_entries_.push_back(entry); } -void SafeBrowsingService::Observe(NotificationType type, +void SafeBrowsingService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - DCHECK(type == NotificationType::PURGE_MEMORY); + DCHECK(type == content::NOTIFICATION_PURGE_MEMORY); CloseDatabase(); } diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h index 0d29f46..9019937 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.h +++ b/chrome/browser/safe_browsing/safe_browsing_service.h @@ -414,7 +414,7 @@ class SafeBrowsingService void UpdateWhitelist(const UnsafeResource& resource); // NotificationObserver override - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/search_engines/search_provider_install_data.cc b/chrome/browser/search_engines/search_provider_install_data.cc index 46616c8..4f9994e 100644 --- a/chrome/browser/search_engines/search_provider_install_data.cc +++ b/chrome/browser/search_engines/search_provider_install_data.cc @@ -16,12 +16,12 @@ #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/util.h" #include "chrome/browser/webdata/web_data_service.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" typedef SearchHostToURLsMap::TemplateURLSet TemplateURLSet; @@ -103,11 +103,11 @@ class GoogleURLObserver : public NotificationObserver { public: GoogleURLObserver( GoogleURLChangeNotifier* change_notifier, - NotificationType ui_death_notification, + int ui_death_notification, const NotificationSource& ui_death_source); // Implementation of NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -122,19 +122,19 @@ class GoogleURLObserver : public NotificationObserver { GoogleURLObserver::GoogleURLObserver( GoogleURLChangeNotifier* change_notifier, - NotificationType ui_death_notification, + int ui_death_notification, const NotificationSource& ui_death_source) : change_notifier_(change_notifier) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED, NotificationService::AllSources()); registrar_.Add(this, ui_death_notification, ui_death_source); } -void GoogleURLObserver::Observe(NotificationType type, +void GoogleURLObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::GOOGLE_URL_UPDATED) { + if (type == chrome::NOTIFICATION_GOOGLE_URL_UPDATED) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, NewRunnableMethod(change_notifier_.get(), &GoogleURLChangeNotifier::OnChange, @@ -162,7 +162,7 @@ static bool IsSameOrigin(const GURL& requested_origin, SearchProviderInstallData::SearchProviderInstallData( WebDataService* web_service, - NotificationType ui_death_notification, + int ui_death_notification, const NotificationSource& ui_death_source) : web_service_(web_service), load_handle_(0), diff --git a/chrome/browser/search_engines/search_provider_install_data.h b/chrome/browser/search_engines/search_provider_install_data.h index 830c6b5..191615c 100644 --- a/chrome/browser/search_engines/search_provider_install_data.h +++ b/chrome/browser/search_engines/search_provider_install_data.h @@ -18,7 +18,6 @@ class GURL; class NotificationSource; -class NotificationType; class SearchHostToURLsMap; class Task; class TemplateURL; @@ -46,7 +45,7 @@ class SearchProviderInstallData : public WebDataServiceConsumer, // be kept up to date. (Note that this class may be deleted before or after // that notification occurs. It doesn't matter.) SearchProviderInstallData(WebDataService* web_service, - NotificationType ui_death_notification, + int ui_death_notification, const NotificationSource& ui_death_source); virtual ~SearchProviderInstallData(); diff --git a/chrome/browser/search_engines/search_provider_install_data_unittest.cc b/chrome/browser/search_engines/search_provider_install_data_unittest.cc index 476c7f5..aac9851 100644 --- a/chrome/browser/search_engines/search_provider_install_data_unittest.cc +++ b/chrome/browser/search_engines/search_provider_install_data_unittest.cc @@ -13,13 +13,13 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_test_util.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_pref_service.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gtest/include/gtest/gtest.h" // Create a TemplateURL. The caller owns the returned TemplateURL*. @@ -167,7 +167,7 @@ class SearchProviderInstallDataTest : public testing::Test { util_.StartIOThread(); install_data_ = new SearchProviderInstallData( util_.GetWebDataService(), - NotificationType::RENDERER_PROCESS_TERMINATED, + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, Source<SearchProviderInstallDataTest>(this)); } @@ -180,7 +180,7 @@ class SearchProviderInstallDataTest : public testing::Test { // Make sure that the install data class on the UI thread gets cleaned up. // It doesn't matter that this happens after install_data_ is deleted. NotificationService::current()->Notify( - NotificationType::RENDERER_PROCESS_TERMINATED, + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, Source<SearchProviderInstallDataTest>(this), NotificationService::NoDetails()); @@ -206,7 +206,7 @@ class SearchProviderInstallDataTest : public testing::Test { service->SetManagedPref( prefs::kDefaultSearchProviderPrepopulateID, new StringValue("")); util_.model()->Observe( - NotificationType::PREF_CHANGED, + chrome::NOTIFICATION_PREF_CHANGED, Source<PrefService>(util_.profile()->GetTestingPrefService()), Details<std::string>(NULL)); } diff --git a/chrome/browser/search_engines/search_provider_install_state_message_filter.cc b/chrome/browser/search_engines/search_provider_install_state_message_filter.cc index 3e712e0..c3c02ea 100644 --- a/chrome/browser/search_engines/search_provider_install_state_message_filter.cc +++ b/chrome/browser/search_engines/search_provider_install_state_message_filter.cc @@ -9,8 +9,8 @@ #include "chrome/common/render_messages.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" SearchProviderInstallStateMessageFilter:: @@ -20,7 +20,7 @@ SearchProviderInstallStateMessageFilter( : ALLOW_THIS_IN_INITIALIZER_LIST( reply_with_provider_install_state_factory_(this)), provider_data_(profile->GetWebDataService(Profile::EXPLICIT_ACCESS), - NotificationType::RENDERER_PROCESS_TERMINATED, + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, Source<RenderProcessHost>( RenderProcessHost::FromID(render_process_id))), is_off_the_record_(profile->IsOffTheRecord()) { diff --git a/chrome/browser/search_engines/template_url_fetcher.cc b/chrome/browser/search_engines/template_url_fetcher.cc index caf594e..718049b 100644 --- a/chrome/browser/search_engines/template_url_fetcher.cc +++ b/chrome/browser/search_engines/template_url_fetcher.cc @@ -14,10 +14,10 @@ #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/search_engines/template_url_parser.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "content/common/url_fetcher.h" #include "net/url_request/url_request_status.h" @@ -34,7 +34,7 @@ class TemplateURLFetcher::RequestDelegate : public URLFetcher::Delegate, ProviderType provider_type); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -97,7 +97,7 @@ TemplateURLFetcher::RequestDelegate::RequestDelegate( if (!model->loaded()) { // Start the model load and set-up waiting for it. registrar_.Add(this, - NotificationType::TEMPLATE_URL_SERVICE_LOADED, + chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, Source<TemplateURLService>(model)); model->Load(); } @@ -107,10 +107,10 @@ TemplateURLFetcher::RequestDelegate::RequestDelegate( } void TemplateURLFetcher::RequestDelegate::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TEMPLATE_URL_SERVICE_LOADED); + DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED); if (!template_url_.get()) return; diff --git a/chrome/browser/search_engines/template_url_scraper_unittest.cc b/chrome/browser/search_engines/template_url_scraper_unittest.cc index f6d5cc8..155b2fb 100644 --- a/chrome/browser/search_engines/template_url_scraper_unittest.cc +++ b/chrome/browser/search_engines/template_url_scraper_unittest.cc @@ -7,11 +7,11 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/search_engines/template_url_prepopulate_data.h" #include "chrome/browser/ui/browser.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "net/base/mock_host_resolver.h" #include "net/base/net_util.h" @@ -28,16 +28,16 @@ class TemplateURLScraperTest : public InProcessBrowserTest { class TemplateURLServiceLoader : public NotificationObserver { public: explicit TemplateURLServiceLoader(TemplateURLService* model) : model_(model) { - registrar_.Add(this, NotificationType::TEMPLATE_URL_SERVICE_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, Source<TemplateURLService>(model)); model_->Load(); ui_test_utils::RunMessageLoop(); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::TEMPLATE_URL_SERVICE_LOADED && + if (type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED && Source<TemplateURLService>(source).ptr() == model_) { MessageLoop::current()->Quit(); } diff --git a/chrome/browser/search_engines/template_url_service.cc b/chrome/browser/search_engines/template_url_service.cc index 1777ebd..3c0db83 100644 --- a/chrome/browser/search_engines/template_url_service.cc +++ b/chrome/browser/search_engines/template_url_service.cc @@ -28,6 +28,7 @@ #include "chrome/browser/search_engines/template_url_service_observer.h" #include "chrome/browser/search_engines/template_url_prepopulate_data.h" #include "chrome/browser/search_engines/util.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/env_vars.h" #include "chrome/common/extensions/extension.h" @@ -579,19 +580,19 @@ string16 TemplateURLService::GetKeywordShortName(const string16& keyword, return string16(); } -void TemplateURLService::Observe(NotificationType type, +void TemplateURLService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::HISTORY_URL_VISITED) { + if (type == chrome::NOTIFICATION_HISTORY_URL_VISITED) { Details<history::URLVisitedDetails> visit_details(details); if (!loaded()) visits_to_add_.push_back(*visit_details.ptr()); else UpdateKeywordSearchTermsForURL(*visit_details.ptr()); - } else if (type == NotificationType::GOOGLE_URL_UPDATED) { + } else if (type == chrome::NOTIFICATION_GOOGLE_URL_UPDATED) { if (loaded_) GoogleBaseURLChanged(); - } else if (type == NotificationType::PREF_CHANGED) { + } else if (type == chrome::NOTIFICATION_PREF_CHANGED) { const std::string* pref_name = Details<std::string>(details).ptr(); if (!pref_name || default_search_prefs_->IsObserved(*pref_name)) { // A preference related to default search engine has changed. @@ -655,13 +656,13 @@ void TemplateURLService::Init(const Initializer* initializers, // db, which will mean we no longer need this notification and the history // backend can handle automatically adding the search terms as the user // navigates. - registrar_.Add(this, NotificationType::HISTORY_URL_VISITED, + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URL_VISITED, Source<Profile>(profile_->GetOriginalProfile())); PrefService* prefs = GetPrefs(); default_search_prefs_.reset( PrefSetObserver::CreateDefaultSearchPrefSetObserver(prefs, this)); } - registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED, NotificationService::AllSources()); if (num_initializers > 0) { @@ -775,7 +776,7 @@ void TemplateURLService::ChangeToLoadedState() { void TemplateURLService::NotifyLoaded() { NotificationService::current()->Notify( - NotificationType::TEMPLATE_URL_SERVICE_LOADED, + chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, Source<TemplateURLService>(this), NotificationService::NoDetails()); @@ -1266,7 +1267,7 @@ void TemplateURLService::RemoveNoNotify(const TemplateURL* template_url) { Source<Profile> source(profile_); TemplateURLID id = template_url->id(); NotificationService::current()->Notify( - NotificationType::TEMPLATE_URL_REMOVED, + chrome::NOTIFICATION_TEMPLATE_URL_REMOVED, source, Details<TemplateURLID>(&id)); } diff --git a/chrome/browser/search_engines/template_url_service.h b/chrome/browser/search_engines/template_url_service.h index 10eeb10..602c465 100644 --- a/chrome/browser/search_engines/template_url_service.h +++ b/chrome/browser/search_engines/template_url_service.h @@ -229,7 +229,7 @@ class TemplateURLService : public WebDataServiceConsumer, // . NOTIFY_GOOGLE_URL_UPDATED: updates mapping for any keywords containing // a google base url replacement term. // . PREF_CHANGED: checks whether the default search engine has changed. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/search_engines/template_url_service_test_util.cc b/chrome/browser/search_engines/template_url_service_test_util.cc index ff18139..4e04877 100644 --- a/chrome/browser/search_engines/template_url_service_test_util.cc +++ b/chrome/browser/search_engines/template_url_service_test_util.cc @@ -11,9 +11,9 @@ #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/testing_profile.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -227,9 +227,10 @@ string16 TemplateURLServiceTestUtil::GetAndClearSearchTerm() { void TemplateURLServiceTestUtil::SetGoogleBaseURL( const std::string& base_url) const { TemplateURLRef::SetGoogleBaseURL(new std::string(base_url)); - NotificationService::current()->Notify(NotificationType::GOOGLE_URL_UPDATED, - NotificationService::AllSources(), - NotificationService::NoDetails()); + NotificationService::current()->Notify( + chrome::NOTIFICATION_GOOGLE_URL_UPDATED, + NotificationService::AllSources(), + NotificationService::NoDetails()); } WebDataService* TemplateURLServiceTestUtil::GetWebDataService() { diff --git a/chrome/browser/search_engines/template_url_service_unittest.cc b/chrome/browser/search_engines/template_url_service_unittest.cc index 5a68dc1..56044a0 100644 --- a/chrome/browser/search_engines/template_url_service_unittest.cc +++ b/chrome/browser/search_engines/template_url_service_unittest.cc @@ -19,6 +19,7 @@ #include "chrome/browser/search_engines/template_url_service_test_util.h" #include "chrome/browser/search_engines/template_url_prepopulate_data.h" #include "chrome/browser/webdata/web_database.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_pref_service.h" #include "chrome/test/testing_profile.h" @@ -145,7 +146,7 @@ class TemplateURLServiceTest : public testing::Test { // preferences have changed. void NotifyManagedPrefsHaveChanged() { model()->Observe( - NotificationType::PREF_CHANGED, + chrome::NOTIFICATION_PREF_CHANGED, Source<PrefService>(profile()->GetTestingPrefService()), Details<std::string>(NULL)); } diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index 4461af2..cfad325 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -13,6 +13,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/upgrade_detector.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/service_messages.h" #include "chrome/common/service_process_util.h" #include "content/browser/browser_thread.h" @@ -204,7 +205,7 @@ void ServiceProcessControl::OnChannelConnected(int32 peer_pid) { Send(new ServiceMsg_UpdateAvailable); } else { if (registrar_.IsEmpty()) - registrar_.Add(this, NotificationType::UPGRADE_RECOMMENDED, + registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, NotificationService::AllSources()); } RunConnectDoneTasks(); @@ -224,10 +225,10 @@ bool ServiceProcessControl::Send(IPC::Message* message) { } // NotificationObserver implementation. -void ServiceProcessControl::Observe(NotificationType type, +void ServiceProcessControl::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::UPGRADE_RECOMMENDED) { + if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { Send(new ServiceMsg_UpdateAvailable); } } diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h index c70a947..08aa470 100644 --- a/chrome/browser/service/service_process_control.h +++ b/chrome/browser/service/service_process_control.h @@ -76,7 +76,7 @@ class ServiceProcessControl : public IPC::Channel::Sender, virtual bool Send(IPC::Message* message); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sessions/restore_tab_helper.cc b/chrome/browser/sessions/restore_tab_helper.cc index 16a2c3c..c54cb96 100644 --- a/chrome/browser/sessions/restore_tab_helper.cc +++ b/chrome/browser/sessions/restore_tab_helper.cc @@ -7,8 +7,8 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/extensions/extension_messages.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" RestoreTabHelper::RestoreTabHelper(TabContentsWrapper* tab) : TabContentsObserver(tab->tab_contents()), @@ -21,7 +21,7 @@ RestoreTabHelper::~RestoreTabHelper() { void RestoreTabHelper::SetWindowID(const SessionID& id) { window_id_ = id; NotificationService::current()->Notify( - NotificationType::TAB_PARENTED, + content::NOTIFICATION_TAB_PARENTED, Source<TabContentsWrapper>(tab_), NotificationService::NoDetails()); diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index 6c6e1c9..9e1f740 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -26,6 +26,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/navigation_controller.h" @@ -85,7 +86,7 @@ class TabLoader : public NotificationObserver { // NotificationObserver method. Removes the specified tab and loads the next // tab. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -177,7 +178,7 @@ void TabLoader::TabIsLoading(NavigationController* controller) { } void TabLoader::StartLoading() { - registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DID_PAINT, + registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, NotificationService::AllSources()); #if defined(OS_CHROMEOS) if (chromeos::NetworkStateNotifier::is_connected()) { @@ -185,7 +186,7 @@ void TabLoader::StartLoading() { LoadNextTab(); } else { // Start listening to network state notification now. - registrar_.Add(this, NotificationType::NETWORK_STATE_CHANGED, + registrar_.Add(this, chrome::NETWORK_STATE_CHANGED, NotificationService::AllSources()); } #else @@ -227,12 +228,12 @@ void TabLoader::LoadNextTab() { } } -void TabLoader::Observe(NotificationType type, +void TabLoader::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { + switch (type) { #if defined(OS_CHROMEOS) - case NotificationType::NETWORK_STATE_CHANGED: { + case chrome::NETWORK_STATE_CHANGED: { chromeos::NetworkStateDetails* state_details = Details<chromeos::NetworkStateDetails>(details).ptr(); switch (state_details->state()) { @@ -256,7 +257,7 @@ void TabLoader::Observe(NotificationType type, break; } #endif - case NotificationType::LOAD_START: { + case content::NOTIFICATION_LOAD_START: { // Add this render_widget_host to the set of those we're waiting for // paints on. We want to only record stats for paints that occur after // a load has finished. @@ -266,7 +267,7 @@ void TabLoader::Observe(NotificationType type, render_widget_hosts_loading_.insert(render_widget_host); break; } - case NotificationType::TAB_CONTENTS_DESTROYED: { + case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: { TabContents* tab_contents = Source<TabContents>(source).ptr(); if (!got_first_paint_) { RenderWidgetHost* render_widget_host = @@ -276,13 +277,13 @@ void TabLoader::Observe(NotificationType type, HandleTabClosedOrLoaded(&tab_contents->controller()); break; } - case NotificationType::LOAD_STOP: { + case content::NOTIFICATION_LOAD_STOP: { NavigationController* tab = Source<NavigationController>(source).ptr(); render_widget_hosts_to_paint_.insert(GetRenderWidgetHost(tab)); HandleTabClosedOrLoaded(tab); break; } - case NotificationType::RENDER_WIDGET_HOST_DID_PAINT: { + case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: { if (!got_first_paint_) { RenderWidgetHost* render_widget_host = Source<RenderWidgetHost>(source).ptr(); @@ -323,7 +324,7 @@ void TabLoader::Observe(NotificationType type, break; } default: - NOTREACHED() << "Unknown notification received:" << type.value; + NOTREACHED() << "Unknown notification received:" << type; } // Delete ourselves when we're not waiting for any more notifications. if ((got_first_paint_ || render_widget_hosts_to_paint_.empty()) && @@ -332,11 +333,11 @@ void TabLoader::Observe(NotificationType type, } void TabLoader::RemoveTab(NavigationController* tab) { - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab->tab_contents())); - registrar_.Remove(this, NotificationType::LOAD_STOP, + registrar_.Remove(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(tab)); - registrar_.Remove(this, NotificationType::LOAD_START, + registrar_.Remove(this, content::NOTIFICATION_LOAD_START, Source<NavigationController>(tab)); TabsLoading::iterator i = tabs_loading_.find(tab); @@ -366,11 +367,11 @@ RenderWidgetHost* TabLoader::GetRenderWidgetHost(NavigationController* tab) { } void TabLoader::RegisterForNotifications(NavigationController* controller) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(controller->tab_contents())); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::LOAD_START, + registrar_.Add(this, content::NOTIFICATION_LOAD_START, Source<NavigationController>(controller)); ++tab_count_; } @@ -447,7 +448,7 @@ class SessionRestoreImpl : public NotificationObserver { } if (browser_) { - registrar_.Add(this, NotificationType::BROWSER_CLOSED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, Source<Browser>(browser_)); } @@ -499,11 +500,11 @@ class SessionRestoreImpl : public NotificationObserver { g_browser_process->ReleaseModule(); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::BROWSER_CLOSED: + switch (type) { + case chrome::NOTIFICATION_BROWSER_CLOSED: delete this; return; diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index b9431fd..feccc25 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -28,6 +28,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/navigation_entry.h" @@ -445,10 +446,11 @@ void SessionService::Save() { bool had_commands = !pending_commands().empty(); BaseSessionService::Save(); if (had_commands) { - RecordSessionUpdateHistogramData(NotificationType::SESSION_SERVICE_SAVED, + RecordSessionUpdateHistogramData( + chrome::NOTIFICATION_SESSION_SERVICE_SAVED, &last_updated_save_time_); NotificationService::current()->Notify( - NotificationType::SESSION_SERVICE_SAVED, + chrome::NOTIFICATION_SESSION_SERVICE_SAVED, Source<Profile>(profile()), NotificationService::NoDetails()); } @@ -456,21 +458,21 @@ void SessionService::Save() { void SessionService::Init() { // Register for the notifications we're interested in. - registrar_.Add(this, NotificationType::TAB_PARENTED, + registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::TAB_CLOSED, + registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::NAV_LIST_PRUNED, + registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::NAV_ENTRY_CHANGED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_CHANGED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::BROWSER_OPENED, - NotificationService::AllSources()); - registrar_.Add(this, - NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, NotificationService::AllSources()); + registrar_.Add( + this, chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, + NotificationService::AllSources()); } bool SessionService::RestoreIfNecessary(const std::vector<GURL>& urls_to_open, @@ -503,12 +505,12 @@ bool SessionService::RestoreIfNecessary(const std::vector<GURL>& urls_to_open, return false; } -void SessionService::Observe(NotificationType type, +void SessionService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // All of our messages have the NavigationController as the source. - switch (type.value) { - case NotificationType::BROWSER_OPENED: { + switch (type) { + case chrome::NOTIFICATION_BROWSER_OPENED: { Browser* browser = Source<Browser>(source).ptr(); if (browser->profile() != profile() || !should_track_changes_for_browser_type(browser->type())) { @@ -520,7 +522,7 @@ void SessionService::Observe(NotificationType type, break; } - case NotificationType::TAB_PARENTED: { + case content::NOTIFICATION_TAB_PARENTED: { TabContentsWrapper* tab = Source<TabContentsWrapper>(source).ptr(); SetTabWindow(tab->restore_tab_helper()->window_id(), tab->restore_tab_helper()->session_id()); @@ -533,7 +535,7 @@ void SessionService::Observe(NotificationType type, break; } - case NotificationType::TAB_CLOSED: { + case content::NOTIFICATION_TAB_CLOSED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<NavigationController>(source).ptr()->tab_contents()); @@ -542,12 +544,12 @@ void SessionService::Observe(NotificationType type, TabClosed(tab->restore_tab_helper()->window_id(), tab->restore_tab_helper()->session_id(), tab->tab_contents()->closed_by_user_gesture()); - RecordSessionUpdateHistogramData(NotificationType::TAB_CLOSED, + RecordSessionUpdateHistogramData(content::NOTIFICATION_TAB_CLOSED, &last_updated_tab_closed_time_); break; } - case NotificationType::NAV_LIST_PRUNED: { + case content::NOTIFICATION_NAV_LIST_PRUNED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<NavigationController>(source).ptr()->tab_contents()); @@ -565,12 +567,12 @@ void SessionService::Observe(NotificationType type, tab->restore_tab_helper()->session_id(), tab->controller().entry_count()); } - RecordSessionUpdateHistogramData(NotificationType::NAV_LIST_PRUNED, + RecordSessionUpdateHistogramData(content::NOTIFICATION_NAV_LIST_PRUNED, &last_updated_nav_list_pruned_time_); break; } - case NotificationType::NAV_ENTRY_CHANGED: { + case content::NOTIFICATION_NAV_ENTRY_CHANGED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<NavigationController>(source).ptr()->tab_contents()); @@ -584,7 +586,7 @@ void SessionService::Observe(NotificationType type, break; } - case NotificationType::NAV_ENTRY_COMMITTED: { + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<NavigationController>(source).ptr()->tab_contents()); @@ -602,13 +604,14 @@ void SessionService::Observe(NotificationType type, Details<content::LoadCommittedDetails> changed(details); if (changed->type == NavigationType::NEW_PAGE || changed->type == NavigationType::EXISTING_PAGE) { - RecordSessionUpdateHistogramData(NotificationType::NAV_ENTRY_COMMITTED, + RecordSessionUpdateHistogramData( + content::NOTIFICATION_NAV_ENTRY_COMMITTED, &last_updated_nav_entry_commit_time_); } break; } - case NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: { + case chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: { ExtensionTabHelper* extension_tab_helper = Source<ExtensionTabHelper>(source).ptr(); if (extension_tab_helper->extension_app()) { @@ -1351,7 +1354,7 @@ Browser::Type SessionService::BrowserTypeForWindowType(WindowType type) { } } -void SessionService::RecordSessionUpdateHistogramData(NotificationType type, +void SessionService::RecordSessionUpdateHistogramData(int type, base::TimeTicks* last_updated_time) { if (!last_updated_time->is_null()) { base::TimeDelta delta = base::TimeTicks::Now() - *last_updated_time; @@ -1361,20 +1364,20 @@ void SessionService::RecordSessionUpdateHistogramData(NotificationType type, if (delta >= save_delay_in_mins_) { use_long_period = true; } - switch (type.value) { - case NotificationType::SESSION_SERVICE_SAVED : + switch (type) { + case chrome::NOTIFICATION_SESSION_SERVICE_SAVED : RecordUpdatedSaveTime(delta, use_long_period); RecordUpdatedSessionNavigationOrTab(delta, use_long_period); break; - case NotificationType::TAB_CLOSED: + case content::NOTIFICATION_TAB_CLOSED: RecordUpdatedTabClosed(delta, use_long_period); RecordUpdatedSessionNavigationOrTab(delta, use_long_period); break; - case NotificationType::NAV_LIST_PRUNED: + case content::NOTIFICATION_NAV_LIST_PRUNED: RecordUpdatedNavListPruned(delta, use_long_period); RecordUpdatedSessionNavigationOrTab(delta, use_long_period); break; - case NotificationType::NAV_ENTRY_COMMITTED: + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: RecordUpdatedNavEntryCommit(delta, use_long_period); RecordUpdatedSessionNavigationOrTab(delta, use_long_period); break; diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h index 4ddaf24..71dd177 100644 --- a/chrome/browser/sessions/session_service.h +++ b/chrome/browser/sessions/session_service.h @@ -199,7 +199,7 @@ class SessionService : public BaseSessionService, bool RestoreIfNecessary(const std::vector<GURL>& urls_to_open, Browser* browser); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -381,7 +381,7 @@ class SessionService : public BaseSessionService, // currently called when Save() is called to compare how often the // session data is currently saved verses when we may want to save it. // It records the data in UMA stats. - void RecordSessionUpdateHistogramData(NotificationType type, + void RecordSessionUpdateHistogramData(int type, base::TimeTicks* last_updated_time); // Helper methods to record the histogram data diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc index 572c84d..4005728 100644 --- a/chrome/browser/sessions/session_service_unittest.cc +++ b/chrome/browser/sessions/session_service_unittest.cc @@ -16,6 +16,7 @@ #include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/session_service_test_helper.h" #include "chrome/browser/sessions/session_types.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/browser_with_test_window_test.h" #include "chrome/test/testing_profile.h" @@ -23,7 +24,6 @@ #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "testing/gtest/include/gtest/gtest.h" class SessionServiceTest : public BrowserWithTestWindowTest, @@ -49,10 +49,10 @@ class SessionServiceTest : public BrowserWithTestWindowTest, } // Upon notification, increment the sync_save_count variable - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - ASSERT_EQ(type.value, NotificationType::SESSION_SERVICE_SAVED); + ASSERT_EQ(type, chrome::NOTIFICATION_SESSION_SERVICE_SAVED); sync_save_count_++; } @@ -635,7 +635,7 @@ TEST_F(SessionServiceTest, GetCurrentSession) { // Test that the notification for SESSION_SERVICE_SAVED is working properly. TEST_F(SessionServiceTest, SavedSessionNotification) { NotificationRegistrar registrar_; - registrar_.Add(this, NotificationType::SESSION_SERVICE_SAVED, + registrar_.Add(this, chrome::NOTIFICATION_SESSION_SERVICE_SAVED, NotificationService::AllSources()); service()->Save(); EXPECT_EQ(sync_save_count_, 1); diff --git a/chrome/browser/sidebar/sidebar_manager.cc b/chrome/browser/sidebar/sidebar_manager.cc index 82f5bdf..0398ba5 100644 --- a/chrome/browser/sidebar/sidebar_manager.cc +++ b/chrome/browser/sidebar/sidebar_manager.cc @@ -11,6 +11,7 @@ #include "chrome/browser/extensions/extension_sidebar_api.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sidebar/sidebar_container.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" @@ -219,10 +220,10 @@ SidebarManager::~SidebarManager() { DCHECK(sidebar_host_to_tab_.empty()); } -void SidebarManager::Observe(NotificationType type, +void SidebarManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::TAB_CONTENTS_DESTROYED) { + if (type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED) { HideAllSidebars(Source<TabContents>(source).ptr()); } else { NOTREACHED() << "Got a notification we didn't register for!"; @@ -231,7 +232,7 @@ void SidebarManager::Observe(NotificationType type, void SidebarManager::UpdateSidebar(SidebarContainer* host) { NotificationService::current()->Notify( - NotificationType::SIDEBAR_CHANGED, + chrome::NOTIFICATION_SIDEBAR_CHANGED, Source<SidebarManager>(this), Details<SidebarContainer>(host)); } @@ -273,7 +274,7 @@ void SidebarManager::RegisterSidebarContainerFor( // If it's a first sidebar for this tab, register destroy notification. if (tab_to_sidebar_host_.find(tab) == tab_to_sidebar_host_.end()) { registrar_.Add(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab)); } @@ -292,7 +293,7 @@ void SidebarManager::UnregisterSidebarContainerFor( // If there's no more sidebars linked to this tab, unsubscribe. if (tab_to_sidebar_host_.find(tab) == tab_to_sidebar_host_.end()) { registrar_.Remove(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab)); } diff --git a/chrome/browser/sidebar/sidebar_manager.h b/chrome/browser/sidebar/sidebar_manager.h index 13040ce..8bcc846 100644 --- a/chrome/browser/sidebar/sidebar_manager.h +++ b/chrome/browser/sidebar/sidebar_manager.h @@ -99,7 +99,7 @@ class SidebarManager : public NotificationObserver, virtual ~SidebarManager(); // Overridden from NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/speech/speech_input_bubble_controller.cc b/chrome/browser/speech/speech_input_bubble_controller.cc index 8cdae9f..748fdf1 100644 --- a/chrome/browser/speech/speech_input_bubble_controller.cc +++ b/chrome/browser/speech/speech_input_bubble_controller.cc @@ -7,9 +7,9 @@ #include "chrome/browser/tab_contents/tab_util.h" #include "content/browser/browser_thread.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "ui/gfx/rect.h" namespace speech_input { @@ -110,18 +110,18 @@ void SpeechInputBubbleController::UpdateTabContentsSubscription( } if (action == BUBBLE_ADDED) { - registrar_->Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_->Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents)); } else { - registrar_->Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_->Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents)); } } -void SpeechInputBubbleController::Observe(NotificationType type, +void SpeechInputBubbleController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::TAB_CONTENTS_DESTROYED) { + if (type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED) { // Cancel all bubbles and active recognition sessions for this tab. TabContents* tab_contents = Source<TabContents>(source).ptr(); BubbleCallerIdMap::iterator iter = bubbles_.begin(); diff --git a/chrome/browser/speech/speech_input_bubble_controller.h b/chrome/browser/speech/speech_input_bubble_controller.h index c09f184..164807d 100644 --- a/chrome/browser/speech/speech_input_bubble_controller.h +++ b/chrome/browser/speech/speech_input_bubble_controller.h @@ -81,7 +81,7 @@ class SpeechInputBubbleController virtual void InfoBubbleFocusChanged(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/spellcheck_host_impl.cc b/chrome/browser/spellcheck_host_impl.cc index f69c11d..e0f9fd2 100644 --- a/chrome/browser/spellcheck_host_impl.cc +++ b/chrome/browser/spellcheck_host_impl.cc @@ -99,7 +99,7 @@ SpellCheckHostImpl::SpellCheckHostImpl( custom_dictionary_file_ = personal_file_directory.Append(chrome::kCustomDictionaryFileName); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, NotificationService::AllSources()); } @@ -333,10 +333,10 @@ void SpellCheckHostImpl::OnURLFetchComplete(const URLFetcher* source, NewRunnableMethod(this, &SpellCheckHostImpl::SaveDictionaryData)); } -void SpellCheckHostImpl::Observe(NotificationType type, +void SpellCheckHostImpl::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::RENDERER_PROCESS_CREATED); + DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_CREATED); RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); InitForRenderer(process); } diff --git a/chrome/browser/spellcheck_host_impl.h b/chrome/browser/spellcheck_host_impl.h index 260b1cb..94ce5f0 100644 --- a/chrome/browser/spellcheck_host_impl.h +++ b/chrome/browser/spellcheck_host_impl.h @@ -102,7 +102,7 @@ class SpellCheckHostImpl : public SpellCheckHost, const std::string& data); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index f76524d..2f65292 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -115,7 +115,7 @@ void SSLBlockingPage::UpdateEntry(NavigationEntry* entry) { entry->ssl().set_cert_status(ssl_info.cert_status); entry->ssl().set_security_bits(ssl_info.security_bits); NotificationService::current()->Notify( - NotificationType::SSL_VISIBLE_STATE_CHANGED, + content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, Source<NavigationController>(&tab()->controller()), NotificationService::NoDetails()); } diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 9e14834..220ed12 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -351,7 +351,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoBackViaButton) { // Wait until we hear the load failure, and make sure we haven't swapped out // the previous page. Prevents regression of http://crbug.com/82667. ui_test_utils::WaitForNotification( - NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR); + content::NOTIFICATION_FAIL_PROVISIONAL_LOAD_WITH_ERROR); EXPECT_FALSE(tab->render_view_host()->is_swapped_out()); // We should be back at the original good page. diff --git a/chrome/browser/sync/backend_migrator.cc b/chrome/browser/sync/backend_migrator.cc index 1bbda87..4d8550f 100644 --- a/chrome/browser/sync/backend_migrator.cc +++ b/chrome/browser/sync/backend_migrator.cc @@ -11,6 +11,7 @@ #include "chrome/browser/sync/engine/configure_reason.h" #include "chrome/browser/sync/glue/data_type_manager.h" #include "chrome/browser/sync/sessions/session_state.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -26,7 +27,7 @@ BackendMigrator::BackendMigrator(ProfileSyncService* service, : state_(IDLE), service_(service), manager_(manager), restart_migration_(false), method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { - registrar_.Add(this, NotificationType::SYNC_CONFIGURE_DONE, + registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, Source<DataTypeManager>(manager_)); service_->AddObserver(this); } @@ -113,10 +114,10 @@ void BackendMigrator::OnStateChanged() { manager_->Configure(full_set, sync_api::CONFIGURE_REASON_MIGRATION); } -void BackendMigrator::Observe(NotificationType type, +void BackendMigrator::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(NotificationType::SYNC_CONFIGURE_DONE, type.value); + DCHECK_EQ(chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, type); if (state_ == IDLE) return; diff --git a/chrome/browser/sync/backend_migrator.h b/chrome/browser/sync/backend_migrator.h index 2f2a175..d3314aa 100644 --- a/chrome/browser/sync/backend_migrator.h +++ b/chrome/browser/sync/backend_migrator.h @@ -43,7 +43,7 @@ class BackendMigrator : public NotificationObserver, virtual void OnStateChanged(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/backend_migrator_unittest.cc b/chrome/browser/sync/backend_migrator_unittest.cc index 2939141..cdc2643 100644 --- a/chrome/browser/sync/backend_migrator_unittest.cc +++ b/chrome/browser/sync/backend_migrator_unittest.cc @@ -7,6 +7,7 @@ #include "chrome/browser/sync/glue/data_type_manager_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/browser/sync/sessions/session_state.h" +#include "chrome/common/chrome_notification_types.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -63,7 +64,7 @@ class BackendMigratorTest : public testing::Test { DataTypeManager::ConfigureResultWithErrorLocation result_with_location( result, FROM_HERE, types); NotificationService::current()->Notify( - NotificationType::SYNC_CONFIGURE_DONE, + chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, Source<DataTypeManager>(&manager_), Details<DataTypeManager::ConfigureResultWithErrorLocation>( &result_with_location)); diff --git a/chrome/browser/sync/glue/app_change_processor.cc b/chrome/browser/sync/glue/app_change_processor.cc index b786aab..31e2624 100644 --- a/chrome/browser/sync/glue/app_change_processor.cc +++ b/chrome/browser/sync/glue/app_change_processor.cc @@ -14,6 +14,7 @@ #include "chrome/browser/sync/glue/extension_sync.h" #include "chrome/browser/sync/glue/extension_util.h" #include "chrome/browser/sync/protocol/extension_specifics.pb.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" @@ -39,24 +40,24 @@ AppChangeProcessor::~AppChangeProcessor() { // the browser or the syncapi are done in order; this is tricky since // some events (e.g., extension installation) are done asynchronously. -void AppChangeProcessor::Observe(NotificationType type, +void AppChangeProcessor::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(running()); DCHECK(profile_); - if ((type != NotificationType::EXTENSION_LOADED) && - (type != NotificationType::EXTENSION_UPDATE_DISABLED) && - (type != NotificationType::EXTENSION_UNLOADED)) { + if ((type != chrome::NOTIFICATION_EXTENSION_LOADED) && + (type != chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED) && + (type != chrome::NOTIFICATION_EXTENSION_UNLOADED)) { LOG(DFATAL) << "Received unexpected notification of type " - << type.value; + << type; return; } // Filter out unhandled extensions first. DCHECK_EQ(Source<Profile>(source).ptr(), profile_); const Extension& extension = - (type == NotificationType::EXTENSION_UNLOADED) ? + (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) ? *Details<UnloadedExtensionInfo>(details)->extension : *Details<const Extension>(details).ptr(); if (!traits_.is_valid_and_syncable(extension)) { @@ -66,7 +67,7 @@ void AppChangeProcessor::Observe(NotificationType type, const std::string& id = extension.id(); // Then handle extension uninstalls. - if (type == NotificationType::EXTENSION_UNLOADED) { + if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { const UnloadedExtensionInfo& info = *Details<UnloadedExtensionInfo>(details).ptr(); if (info.reason == UnloadedExtensionInfo::UNINSTALL) { @@ -78,7 +79,7 @@ void AppChangeProcessor::Observe(NotificationType type, } VLOG(1) << "Updating server data for extension " << id - << " (notification type = " << type.value << ")"; + << " (notification type = " << type << ")"; std::string error; if (!UpdateServerData(traits_, extension, *extension_service_, share_handle(), &error)) { @@ -163,16 +164,16 @@ void AppChangeProcessor::StartObserving() { DCHECK(profile_); notification_registrar_.Add( - this, NotificationType::EXTENSION_LOADED, + this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(profile_)); // Despite the name, this notification is exactly like // EXTENSION_LOADED but with an initial state of DISABLED. notification_registrar_.Add( - this, NotificationType::EXTENSION_UPDATE_DISABLED, + this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, Source<Profile>(profile_)); notification_registrar_.Add( - this, NotificationType::EXTENSION_UNLOADED, + this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile_)); } diff --git a/chrome/browser/sync/glue/app_change_processor.h b/chrome/browser/sync/glue/app_change_processor.h index 80511eb..7c2ce3e 100644 --- a/chrome/browser/sync/glue/app_change_processor.h +++ b/chrome/browser/sync/glue/app_change_processor.h @@ -10,9 +10,9 @@ #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/change_processor.h" #include "chrome/browser/sync/glue/extension_sync_traits.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" class ExtensionServiceInterface; @@ -33,7 +33,7 @@ class AppChangeProcessor : public ChangeProcessor, // NotificationObserver implementation. // BrowserExtensionProvider -> sync_api model change application. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/glue/autofill_change_processor.cc b/chrome/browser/sync/glue/autofill_change_processor.cc index 62b2de1..ae18d13 100644 --- a/chrome/browser/sync/glue/autofill_change_processor.cc +++ b/chrome/browser/sync/glue/autofill_change_processor.cc @@ -19,6 +19,7 @@ #include "chrome/browser/webdata/autofill_change.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/browser/webdata/web_database.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/guid.h" #include "content/common/notification_service.h" @@ -55,7 +56,7 @@ AutofillChangeProcessor::AutofillChangeProcessor( AutofillChangeProcessor::~AutofillChangeProcessor() {} -void AutofillChangeProcessor::Observe(NotificationType type, +void AutofillChangeProcessor::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Ensure this notification came from our web database. @@ -77,7 +78,7 @@ void AutofillChangeProcessor::Observe(NotificationType type, return; } - DCHECK(type.value == NotificationType::AUTOFILL_ENTRIES_CHANGED); + DCHECK(type == chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED); AutofillChangeList* changes = Details<AutofillChangeList>(details).ptr(); ObserveAutofillEntriesChanged(changes, &trans, autofill_root); @@ -419,7 +420,8 @@ void AutofillChangeProcessor::StopImpl() { void AutofillChangeProcessor::StartObserving() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); - notification_registrar_.Add(this, NotificationType::AUTOFILL_ENTRIES_CHANGED, + notification_registrar_.Add(this, + chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, NotificationService::AllSources()); } diff --git a/chrome/browser/sync/glue/autofill_change_processor.h b/chrome/browser/sync/glue/autofill_change_processor.h index 914feca..1ea0e1a 100644 --- a/chrome/browser/sync/glue/autofill_change_processor.h +++ b/chrome/browser/sync/glue/autofill_change_processor.h @@ -44,7 +44,7 @@ class AutofillChangeProcessor : public ChangeProcessor, // NotificationObserver implementation. // WebDataService -> sync_api model change application. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.cc b/chrome/browser/sync/glue/autofill_data_type_controller.cc index 794c3d0..ba6a161 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller.cc @@ -10,10 +10,10 @@ #include "chrome/browser/sync/profile_sync_factory.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/webdata/web_data_service.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" namespace browser_sync { @@ -45,7 +45,7 @@ bool AutofillDataTypeController::StartModels() { if (web_data_service_.get() && web_data_service_->IsDatabaseLoaded()) { return true; } else { - notification_registrar_.Add(this, NotificationType::WEB_DATABASE_LOADED, + notification_registrar_.Add(this, chrome::NOTIFICATION_WEB_DATABASE_LOADED, NotificationService::AllSources()); return false; } @@ -62,12 +62,12 @@ void AutofillDataTypeController::OnPersonalDataChanged() { StartDoneImpl(ASSOCIATION_FAILED, NOT_RUNNING, FROM_HERE); } } else { - notification_registrar_.Add(this, NotificationType::WEB_DATABASE_LOADED, + notification_registrar_.Add(this, chrome::NOTIFICATION_WEB_DATABASE_LOADED, NotificationService::AllSources()); } } -void AutofillDataTypeController::Observe(NotificationType type, +void AutofillDataTypeController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.h b/chrome/browser/sync/glue/autofill_data_type_controller.h index 536ac39..e42ab0d 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.h +++ b/chrome/browser/sync/glue/autofill_data_type_controller.h @@ -16,7 +16,6 @@ #include "content/common/notification_registrar.h" class NotificationDetails; -class NotificationType; class NotificationSource; namespace browser_sync { @@ -35,7 +34,7 @@ class AutofillDataTypeController : public NonFrontendDataTypeController, virtual browser_sync::ModelSafeGroup model_safe_group() const; // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc index a4e854e..51446bb 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc @@ -19,8 +19,8 @@ #include "chrome/browser/webdata/web_data_service.h" #include "chrome/test/profile_mock.h" #include "content/browser/browser_thread.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" using base::WaitableEvent; diff --git a/chrome/browser/sync/glue/autofill_profile_change_processor.cc b/chrome/browser/sync/glue/autofill_profile_change_processor.cc index ac6099c..8083188 100644 --- a/chrome/browser/sync/glue/autofill_profile_change_processor.cc +++ b/chrome/browser/sync/glue/autofill_profile_change_processor.cc @@ -19,10 +19,10 @@ #include "chrome/browser/sync/unrecoverable_error_handler.h" #include "chrome/browser/webdata/autofill_change.h" #include "chrome/browser/webdata/web_database.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/guid.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace browser_sync { @@ -92,10 +92,10 @@ void AutofillProfileChangeProcessor::ApplyChangesFromSyncModel( } } -void AutofillProfileChangeProcessor::Observe(NotificationType type, +void AutofillProfileChangeProcessor::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(type.value, NotificationType::AUTOFILL_PROFILE_CHANGED); + DCHECK_EQ(type, chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED); WebDataService* wds = Source<WebDataService>(source).ptr(); if (!wds || wds->GetDatabase() != web_database_) @@ -298,7 +298,7 @@ void AutofillProfileChangeProcessor::AddAutofillProfileSyncNode( void AutofillProfileChangeProcessor::StartObserving() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); notification_registrar_.Add(this, - NotificationType::AUTOFILL_PROFILE_CHANGED, + chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, NotificationService::AllSources()); } diff --git a/chrome/browser/sync/glue/autofill_profile_change_processor.h b/chrome/browser/sync/glue/autofill_profile_change_processor.h index 0a15bc8..c9fd9fe 100644 --- a/chrome/browser/sync/glue/autofill_profile_change_processor.h +++ b/chrome/browser/sync/glue/autofill_profile_change_processor.h @@ -16,10 +16,10 @@ #include "chrome/browser/sync/unrecoverable_error_handler.h" #include "chrome/browser/webdata/autofill_change.h" #include "chrome/browser/webdata/web_database.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace browser_sync { @@ -43,7 +43,7 @@ class AutofillProfileChangeProcessor : public ChangeProcessor, virtual void CommitChangesFromSyncModel(); // Virtual method implemented for the observer class. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller.cc b/chrome/browser/sync/glue/bookmark_data_type_controller.cc index 7819468..b7022b2 100644 --- a/chrome/browser/sync/glue/bookmark_data_type_controller.cc +++ b/chrome/browser/sync/glue/bookmark_data_type_controller.cc @@ -9,10 +9,10 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_factory.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" namespace browser_sync { @@ -37,7 +37,7 @@ bool BookmarkDataTypeController::StartModels() { } // Add an observer and continue when the bookmarks model is loaded. - registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, Source<Profile>(sync_service_->profile())); return false; // Don't continue Start. } @@ -47,11 +47,11 @@ void BookmarkDataTypeController::CleanUpState() { registrar_.RemoveAll(); } -void BookmarkDataTypeController::Observe(NotificationType type, +void BookmarkDataTypeController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK_EQ(NotificationType::BOOKMARK_MODEL_LOADED, type.value); + DCHECK_EQ(chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, type); registrar_.RemoveAll(); DCHECK_EQ(state_, MODEL_STARTING); state_ = ASSOCIATING; diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller.h b/chrome/browser/sync/glue/bookmark_data_type_controller.h index 2655056..b35c93e 100644 --- a/chrome/browser/sync/glue/bookmark_data_type_controller.h +++ b/chrome/browser/sync/glue/bookmark_data_type_controller.h @@ -13,7 +13,6 @@ #include "content/common/notification_registrar.h" class NotificationDetails; -class NotificationType; class NotificationSource; namespace browser_sync { @@ -32,7 +31,7 @@ class BookmarkDataTypeController : public FrontendDataTypeController, virtual syncable::ModelType type() const; // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc index af20af5..235c014 100644 --- a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc @@ -15,11 +15,11 @@ #include "chrome/browser/sync/glue/model_associator_mock.h" #include "chrome/browser/sync/profile_sync_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/profile_mock.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" using browser_sync::BookmarkDataTypeController; @@ -118,7 +118,7 @@ TEST_F(BookmarkDataTypeControllerTest, StartBookmarkModelNotReady) { // Send the notification that the bookmark model has started. NotificationService::current()->Notify( - NotificationType::BOOKMARK_MODEL_LOADED, + chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, Source<Profile>(&profile_), NotificationService::NoDetails()); EXPECT_EQ(DataTypeController::RUNNING, bookmark_dtc_->state()); diff --git a/chrome/browser/sync/glue/data_type_manager_impl.cc b/chrome/browser/sync/glue/data_type_manager_impl.cc index 5626a39..3cbb85f 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl.cc +++ b/chrome/browser/sync/glue/data_type_manager_impl.cc @@ -13,6 +13,7 @@ #include "base/metrics/histogram.h" #include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/sync_backend_host.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" @@ -377,7 +378,7 @@ void DataTypeManagerImpl::FinishStopAndNotify(ConfigureResult result, void DataTypeManagerImpl::NotifyStart() { NotificationService::current()->Notify( - NotificationType::SYNC_CONFIGURE_START, + chrome::NOTIFICATION_SYNC_CONFIGURE_START, Source<DataTypeManager>(this), NotificationService::NoDetails()); } @@ -415,7 +416,7 @@ void DataTypeManagerImpl::NotifyDone(ConfigureResult result, break; } NotificationService::current()->Notify( - NotificationType::SYNC_CONFIGURE_DONE, + chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, Source<DataTypeManager>(this), Details<ConfigureResultWithErrorLocation>(&result_with_location)); } @@ -434,7 +435,7 @@ void DataTypeManagerImpl::SetBlockedAndNotify() { VLOG(1) << "Accumulated spent configuring: " << configure_time_delta_.InSecondsF() << "s"; NotificationService::current()->Notify( - NotificationType::SYNC_CONFIGURE_BLOCKED, + chrome::NOTIFICATION_SYNC_CONFIGURE_BLOCKED, Source<DataTypeManager>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc index 1f5e3ef..1a2ba36 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc +++ b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc @@ -16,12 +16,12 @@ #include "chrome/browser/sync/glue/sync_backend_host_mock.h" #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/sync/syncable/model_type.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_observer_mock.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -73,10 +73,10 @@ class DataTypeManagerImplTest : public testing::Test { protected: virtual void SetUp() { registrar_.Add(&observer_, - NotificationType::SYNC_CONFIGURE_START, + chrome::NOTIFICATION_SYNC_CONFIGURE_START, NotificationService::AllSources()); registrar_.Add(&observer_, - NotificationType::SYNC_CONFIGURE_DONE, + chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, NotificationService::AllSources()); } @@ -145,7 +145,7 @@ class DataTypeManagerImplTest : public testing::Test { void SetConfigureStartExpectation() { EXPECT_CALL( observer_, - Observe(NotificationType(NotificationType::SYNC_CONFIGURE_START), + Observe(int(chrome::NOTIFICATION_SYNC_CONFIGURE_START), _, _)); } @@ -153,7 +153,7 @@ class DataTypeManagerImplTest : public testing::Test { void SetConfigureDoneExpectation(DataTypeManager::ConfigureResult result) { EXPECT_CALL( observer_, - Observe(NotificationType(NotificationType::SYNC_CONFIGURE_DONE), _, + Observe(int(chrome::NOTIFICATION_SYNC_CONFIGURE_DONE), _, ::testing::ResultOf(&GetResult, result))); } diff --git a/chrome/browser/sync/glue/data_type_manager_mock.cc b/chrome/browser/sync/glue/data_type_manager_mock.cc index 1f75b84..2a21712 100644 --- a/chrome/browser/sync/glue/data_type_manager_mock.cc +++ b/chrome/browser/sync/glue/data_type_manager_mock.cc @@ -4,6 +4,7 @@ #include "base/tracked.h" #include "chrome/browser/sync/glue/data_type_manager_mock.h" +#include "chrome/common/chrome_notification_types.h" namespace browser_sync { @@ -16,9 +17,9 @@ DataTypeManagerMock::DataTypeManagerMock() ON_CALL(*this, Configure(testing::_, testing::_)). WillByDefault(testing::DoAll( NotifyFromDataTypeManager(this, - NotificationType::SYNC_CONFIGURE_START), + chrome::NOTIFICATION_SYNC_CONFIGURE_START), NotifyFromDataTypeManagerWithResult - (this, NotificationType::SYNC_CONFIGURE_DONE, &result_))); + (this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, &result_))); // By default, calling ConfigureWithoutNigori will send a SYNC_CONFIGURE_START // and SYNC_CONFIGURE_DONE notification with a DataTypeManager::OK @@ -26,9 +27,9 @@ DataTypeManagerMock::DataTypeManagerMock() ON_CALL(*this, ConfigureWithoutNigori(testing::_, testing::_)). WillByDefault(testing::DoAll( NotifyFromDataTypeManager(this, - NotificationType::SYNC_CONFIGURE_START), + chrome::NOTIFICATION_SYNC_CONFIGURE_START), NotifyFromDataTypeManagerWithResult - (this, NotificationType::SYNC_CONFIGURE_DONE, &result_))); + (this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, &result_))); } DataTypeManagerMock::~DataTypeManagerMock() {} diff --git a/chrome/browser/sync/glue/data_type_manager_mock.h b/chrome/browser/sync/glue/data_type_manager_mock.h index 0645164..be45d9f 100644 --- a/chrome/browser/sync/glue/data_type_manager_mock.h +++ b/chrome/browser/sync/glue/data_type_manager_mock.h @@ -8,9 +8,9 @@ #include "chrome/browser/sync/glue/data_type_manager.h" #include "chrome/browser/sync/profile_sync_test_util.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" ACTION_P3(NotifyFromDataTypeManagerWithResult, dtm, type, result) { diff --git a/chrome/browser/sync/glue/extension_change_processor.cc b/chrome/browser/sync/glue/extension_change_processor.cc index 736f34a..9d6ed26 100644 --- a/chrome/browser/sync/glue/extension_change_processor.cc +++ b/chrome/browser/sync/glue/extension_change_processor.cc @@ -14,6 +14,7 @@ #include "chrome/browser/sync/glue/extension_sync.h" #include "chrome/browser/sync/glue/extension_util.h" #include "chrome/browser/sync/protocol/extension_specifics.pb.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" @@ -39,24 +40,24 @@ ExtensionChangeProcessor::~ExtensionChangeProcessor() { // the browser or the syncapi are done in order; this is tricky since // some events (e.g., extension installation) are done asynchronously. -void ExtensionChangeProcessor::Observe(NotificationType type, +void ExtensionChangeProcessor::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(running()); DCHECK(profile_); - if ((type != NotificationType::EXTENSION_LOADED) && - (type != NotificationType::EXTENSION_UPDATE_DISABLED) && - (type != NotificationType::EXTENSION_UNLOADED)) { + if ((type != chrome::NOTIFICATION_EXTENSION_LOADED) && + (type != chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED) && + (type != chrome::NOTIFICATION_EXTENSION_UNLOADED)) { LOG(DFATAL) << "Received unexpected notification of type " - << type.value; + << type; return; } // Filter out unhandled extensions first. DCHECK_EQ(Source<Profile>(source).ptr(), profile_); const Extension& extension = - (type == NotificationType::EXTENSION_UNLOADED) ? + (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) ? *Details<UnloadedExtensionInfo>(details)->extension : *Details<const Extension>(details).ptr(); if (!traits_.is_valid_and_syncable(extension)) { @@ -66,7 +67,7 @@ void ExtensionChangeProcessor::Observe(NotificationType type, const std::string& id = extension.id(); // Then handle extension uninstalls. - if (type == NotificationType::EXTENSION_UNLOADED) { + if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { const UnloadedExtensionInfo& info = *Details<UnloadedExtensionInfo>(details).ptr(); if (info.reason == UnloadedExtensionInfo::UNINSTALL) { @@ -78,7 +79,7 @@ void ExtensionChangeProcessor::Observe(NotificationType type, } VLOG(1) << "Updating server data for extension " << id - << " (notification type = " << type.value << ")"; + << " (notification type = " << type << ")"; std::string error; if (!UpdateServerData(traits_, extension, *extension_service_, share_handle(), &error)) { @@ -163,16 +164,16 @@ void ExtensionChangeProcessor::StartObserving() { DCHECK(profile_); notification_registrar_.Add( - this, NotificationType::EXTENSION_LOADED, + this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(profile_)); // Despite the name, this notification is exactly like // EXTENSION_LOADED but with an initial state of DISABLED. notification_registrar_.Add( - this, NotificationType::EXTENSION_UPDATE_DISABLED, + this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, Source<Profile>(profile_)); notification_registrar_.Add( - this, NotificationType::EXTENSION_UNLOADED, + this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile_)); } diff --git a/chrome/browser/sync/glue/extension_change_processor.h b/chrome/browser/sync/glue/extension_change_processor.h index 7f1d916..f2493be 100644 --- a/chrome/browser/sync/glue/extension_change_processor.h +++ b/chrome/browser/sync/glue/extension_change_processor.h @@ -10,9 +10,9 @@ #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/change_processor.h" #include "chrome/browser/sync/glue/extension_sync_traits.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" class ExtensionServiceInterface; @@ -33,7 +33,7 @@ class ExtensionChangeProcessor : public ChangeProcessor, // NotificationObserver implementation. // BrowserExtensionProvider -> sync_api model change application. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/glue/password_change_processor.cc b/chrome/browser/sync/glue/password_change_processor.cc index 67d9187..d2f4d13 100644 --- a/chrome/browser/sync/glue/password_change_processor.cc +++ b/chrome/browser/sync/glue/password_change_processor.cc @@ -15,9 +15,10 @@ #include "chrome/browser/sync/glue/password_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/protocol/password_specifics.pb.h" +#include "chrome/common/chrome_notification_types.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "webkit/glue/password_form.h" namespace browser_sync { @@ -45,11 +46,11 @@ PasswordChangeProcessor::~PasswordChangeProcessor() { DCHECK(expected_loop_ == MessageLoop::current()); } -void PasswordChangeProcessor::Observe(NotificationType type, +void PasswordChangeProcessor::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(expected_loop_ == MessageLoop::current()); - DCHECK(NotificationType::LOGINS_CHANGED == type); + DCHECK(chrome::NOTIFICATION_LOGINS_CHANGED == type); if (!observing_) return; @@ -222,14 +223,14 @@ void PasswordChangeProcessor::StopImpl() { void PasswordChangeProcessor::StartObserving() { DCHECK(expected_loop_ == MessageLoop::current()); notification_registrar_.Add(this, - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(password_store_)); } void PasswordChangeProcessor::StopObserving() { DCHECK(expected_loop_ == MessageLoop::current()); notification_registrar_.Remove(this, - NotificationType::LOGINS_CHANGED, + chrome::NOTIFICATION_LOGINS_CHANGED, Source<PasswordStore>(password_store_)); } diff --git a/chrome/browser/sync/glue/password_change_processor.h b/chrome/browser/sync/glue/password_change_processor.h index 155a1b3..fdfd009 100644 --- a/chrome/browser/sync/glue/password_change_processor.h +++ b/chrome/browser/sync/glue/password_change_processor.h @@ -12,9 +12,9 @@ #include "base/compiler_specific.h" #include "chrome/browser/sync/glue/password_model_associator.h" #include "chrome/browser/sync/glue/sync_backend_host.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" class PasswordStore; class MessageLoop; @@ -38,7 +38,7 @@ class PasswordChangeProcessor : public ChangeProcessor, // NotificationObserver implementation. // Passwords -> sync_api model change application. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/sync/glue/session_change_processor.cc b/chrome/browser/sync/glue/session_change_processor.cc index 2b33c7b..b2d0bd4 100644 --- a/chrome/browser/sync/glue/session_change_processor.cc +++ b/chrome/browser/sync/glue/session_change_processor.cc @@ -16,6 +16,7 @@ #include "chrome/browser/sync/glue/session_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_details.h" @@ -53,7 +54,7 @@ SessionChangeProcessor::~SessionChangeProcessor() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -void SessionChangeProcessor::Observe(NotificationType type, +void SessionChangeProcessor::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -63,8 +64,8 @@ void SessionChangeProcessor::Observe(NotificationType type, // Track which windows and/or tabs are modified. std::vector<TabContentsWrapper*> modified_tabs; bool windows_changed = false; - switch (type.value) { - case NotificationType::BROWSER_OPENED: { + switch (type) { + case chrome::NOTIFICATION_BROWSER_OPENED: { Browser* browser = Source<Browser>(source).ptr(); if (browser->profile() != profile_) { return; @@ -74,7 +75,7 @@ void SessionChangeProcessor::Observe(NotificationType type, break; } - case NotificationType::TAB_PARENTED: { + case content::NOTIFICATION_TAB_PARENTED: { TabContentsWrapper* tab = Source<TabContentsWrapper>(source).ptr(); if (tab->profile() != profile_) { return; @@ -84,7 +85,7 @@ void SessionChangeProcessor::Observe(NotificationType type, break; } - case NotificationType::TAB_CLOSED: { + case content::NOTIFICATION_TAB_CLOSED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<NavigationController>(source).ptr()->tab_contents()); @@ -96,7 +97,7 @@ void SessionChangeProcessor::Observe(NotificationType type, break; } - case NotificationType::NAV_LIST_PRUNED: { + case content::NOTIFICATION_NAV_LIST_PRUNED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<NavigationController>(source).ptr()->tab_contents()); @@ -107,7 +108,7 @@ void SessionChangeProcessor::Observe(NotificationType type, break; } - case NotificationType::NAV_ENTRY_CHANGED: { + case content::NOTIFICATION_NAV_ENTRY_CHANGED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<NavigationController>(source).ptr()->tab_contents()); @@ -118,7 +119,7 @@ void SessionChangeProcessor::Observe(NotificationType type, break; } - case NotificationType::NAV_ENTRY_COMMITTED: { + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( Source<NavigationController>(source).ptr()->tab_contents()); @@ -129,7 +130,7 @@ void SessionChangeProcessor::Observe(NotificationType type, break; } - case NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: { + case chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: { ExtensionTabHelper* extension_tab_helper = Source<ExtensionTabHelper>(source).ptr(); if (extension_tab_helper->tab_contents()->profile() != profile_) { @@ -142,7 +143,7 @@ void SessionChangeProcessor::Observe(NotificationType type, } default: LOG(ERROR) << "Received unexpected notification of type " - << type.value; + << type; break; } @@ -220,7 +221,7 @@ void SessionChangeProcessor::ApplyChangesFromSyncModel( // Notify foreign session handlers that there are new sessions. NotificationService::current()->Notify( - NotificationType::FOREIGN_SESSION_UPDATED, + chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, NotificationService::AllSources(), NotificationService::NoDetails()); @@ -244,20 +245,20 @@ void SessionChangeProcessor::StopImpl() { void SessionChangeProcessor::StartObserving() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(profile_); - notification_registrar_.Add(this, NotificationType::TAB_PARENTED, + notification_registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED, NotificationService::AllSources()); - notification_registrar_.Add(this, NotificationType::TAB_CLOSED, + notification_registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, NotificationService::AllSources()); - notification_registrar_.Add(this, NotificationType::NAV_LIST_PRUNED, + notification_registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED, NotificationService::AllSources()); - notification_registrar_.Add(this, NotificationType::NAV_ENTRY_CHANGED, + notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_CHANGED, NotificationService::AllSources()); - notification_registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); - notification_registrar_.Add(this, NotificationType::BROWSER_OPENED, + notification_registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, NotificationService::AllSources()); notification_registrar_.Add(this, - NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, + chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, NotificationService::AllSources()); } diff --git a/chrome/browser/sync/glue/session_change_processor.h b/chrome/browser/sync/glue/session_change_processor.h index 6213443..62fa5c8 100644 --- a/chrome/browser/sync/glue/session_change_processor.h +++ b/chrome/browser/sync/glue/session_change_processor.h @@ -11,9 +11,9 @@ #include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/change_processor.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" class NotificationDetails; class NotificationSource; @@ -43,7 +43,7 @@ class SessionChangeProcessor : public ChangeProcessor, // NotificationObserver implementation. // BrowserSessionProvider -> sync_api model change application. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc index 7d4eeb0..17126a5 100644 --- a/chrome/browser/sync/glue/session_model_associator.cc +++ b/chrome/browser/sync/glue/session_model_associator.cc @@ -19,6 +19,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" #include "content/browser/tab_contents/navigation_controller.h" @@ -426,7 +427,7 @@ bool SessionModelAssociator::DisassociateModels() { // There is no local model stored with which to disassociate, just notify // foreign session handlers. NotificationService::current()->Notify( - NotificationType::FOREIGN_SESSION_DISABLED, + chrome::NOTIFICATION_FOREIGN_SESSION_DISABLED, NotificationService::AllSources(), NotificationService::NoDetails()); return true; diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 4c860dc..1074328 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -33,13 +33,13 @@ #include "chrome/browser/sync/syncable/directory_manager.h" // Cryptographer. #include "chrome/browser/sync/syncable/model_type.h" #include "chrome/browser/sync/syncable/nigori_util.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "webkit/glue/webkit_glue.h" @@ -537,7 +537,7 @@ void SyncBackendHost::Core::NotifyUpdatedToken(const std::string& token) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); TokenAvailableDetails details(GaiaConstants::kSyncService, token); NotificationService::current()->Notify( - NotificationType::TOKEN_UPDATED, + chrome::NOTIFICATION_TOKEN_UPDATED, NotificationService::AllSources(), Details<const TokenAvailableDetails>(&details)); } diff --git a/chrome/browser/sync/glue/sync_backend_host_mock.h b/chrome/browser/sync/glue/sync_backend_host_mock.h index 882265c..ad063e0 100644 --- a/chrome/browser/sync/glue/sync_backend_host_mock.h +++ b/chrome/browser/sync/glue/sync_backend_host_mock.h @@ -11,7 +11,7 @@ #include "base/task.h" #include "chrome/browser/sync/glue/sync_backend_host.h" #include "chrome/browser/sync/profile_sync_test_util.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #include "testing/gmock/include/gmock/gmock.h" namespace browser_sync { diff --git a/chrome/browser/sync/glue/theme_change_processor.cc b/chrome/browser/sync/glue/theme_change_processor.cc index ace9931..8ffd402 100644 --- a/chrome/browser/sync/glue/theme_change_processor.cc +++ b/chrome/browser/sync/glue/theme_change_processor.cc @@ -12,6 +12,7 @@ #include "chrome/browser/sync/protocol/theme_specifics.pb.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -27,12 +28,12 @@ ThemeChangeProcessor::ThemeChangeProcessor( ThemeChangeProcessor::~ThemeChangeProcessor() {} -void ThemeChangeProcessor::Observe(NotificationType type, +void ThemeChangeProcessor::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(running()); DCHECK(profile_); - DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); sync_api::WriteTransaction trans(FROM_HERE, share_handle()); sync_api::WriteNode node(&trans); @@ -121,7 +122,7 @@ void ThemeChangeProcessor::StartObserving() { DCHECK(profile_); VLOG(1) << "Observing BROWSER_THEME_CHANGED"; notification_registrar_.Add( - this, NotificationType::BROWSER_THEME_CHANGED, + this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>( ThemeServiceFactory::GetForProfile(profile_))); } diff --git a/chrome/browser/sync/glue/theme_change_processor.h b/chrome/browser/sync/glue/theme_change_processor.h index 7a94c92..72c7473 100644 --- a/chrome/browser/sync/glue/theme_change_processor.h +++ b/chrome/browser/sync/glue/theme_change_processor.h @@ -9,9 +9,9 @@ #include "base/basictypes.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/change_processor.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" class NotificationDetails; class NotificationSource; @@ -33,7 +33,7 @@ class ThemeChangeProcessor : public ChangeProcessor, // NotificationObserver implementation. // ThemeService -> sync_api model change application. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/glue/typed_url_change_processor.cc b/chrome/browser/sync/glue/typed_url_change_processor.cc index 2b79fd0..2c10771 100644 --- a/chrome/browser/sync/glue/typed_url_change_processor.cc +++ b/chrome/browser/sync/glue/typed_url_change_processor.cc @@ -13,8 +13,8 @@ #include "chrome/browser/sync/glue/typed_url_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace browser_sync { @@ -50,7 +50,7 @@ TypedUrlChangeProcessor::~TypedUrlChangeProcessor() { DCHECK(expected_loop_ == MessageLoop::current()); } -void TypedUrlChangeProcessor::Observe(NotificationType type, +void TypedUrlChangeProcessor::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(expected_loop_ == MessageLoop::current()); @@ -59,14 +59,14 @@ void TypedUrlChangeProcessor::Observe(NotificationType type, VLOG(1) << "Observed typed_url change."; DCHECK(running()); - DCHECK(NotificationType::HISTORY_TYPED_URLS_MODIFIED == type || - NotificationType::HISTORY_URLS_DELETED == type || - NotificationType::HISTORY_URL_VISITED == type); - if (type == NotificationType::HISTORY_TYPED_URLS_MODIFIED) { + DCHECK(chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED == type || + chrome::NOTIFICATION_HISTORY_URLS_DELETED == type || + chrome::NOTIFICATION_HISTORY_URL_VISITED == type); + if (type == chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED) { HandleURLsModified(Details<history::URLsModifiedDetails>(details).ptr()); - } else if (type == NotificationType::HISTORY_URLS_DELETED) { + } else if (type == chrome::NOTIFICATION_HISTORY_URLS_DELETED) { HandleURLsDeleted(Details<history::URLsDeletedDetails>(details).ptr()); - } else if (type == NotificationType::HISTORY_URL_VISITED) { + } else if (type == chrome::NOTIFICATION_HISTORY_URL_VISITED) { HandleURLsVisited(Details<history::URLVisitedDetails>(details).ptr()); } } @@ -347,24 +347,24 @@ void TypedUrlChangeProcessor::StopImpl() { void TypedUrlChangeProcessor::StartObserving() { DCHECK(expected_loop_ == MessageLoop::current()); notification_registrar_.Add(this, - NotificationType::HISTORY_TYPED_URLS_MODIFIED, + chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, NotificationService::AllSources()); - notification_registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, + notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, NotificationService::AllSources()); - notification_registrar_.Add(this, NotificationType::HISTORY_URL_VISITED, + notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URL_VISITED, NotificationService::AllSources()); } void TypedUrlChangeProcessor::StopObserving() { DCHECK(expected_loop_ == MessageLoop::current()); + notification_registrar_.Remove( + this, chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, + NotificationService::AllSources()); notification_registrar_.Remove(this, - NotificationType::HISTORY_TYPED_URLS_MODIFIED, + chrome::NOTIFICATION_HISTORY_URLS_DELETED, NotificationService::AllSources()); notification_registrar_.Remove(this, - NotificationType::HISTORY_URLS_DELETED, - NotificationService::AllSources()); - notification_registrar_.Remove(this, - NotificationType::HISTORY_URL_VISITED, + chrome::NOTIFICATION_HISTORY_URL_VISITED, NotificationService::AllSources()); } diff --git a/chrome/browser/sync/glue/typed_url_change_processor.h b/chrome/browser/sync/glue/typed_url_change_processor.h index a2153f6..cc62a48 100644 --- a/chrome/browser/sync/glue/typed_url_change_processor.h +++ b/chrome/browser/sync/glue/typed_url_change_processor.h @@ -13,9 +13,9 @@ #include "base/time.h" #include "chrome/browser/sync/glue/sync_backend_host.h" #include "chrome/browser/sync/glue/typed_url_model_associator.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" class MessageLoop; class NotificationService; @@ -45,7 +45,7 @@ class TypedUrlChangeProcessor : public ChangeProcessor, // NotificationObserver implementation. // History -> sync_api model change application. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/glue/typed_url_data_type_controller.cc b/chrome/browser/sync/glue/typed_url_data_type_controller.cc index ee5e249..9e4bd71 100644 --- a/chrome/browser/sync/glue/typed_url_data_type_controller.cc +++ b/chrome/browser/sync/glue/typed_url_data_type_controller.cc @@ -10,6 +10,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_factory.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" @@ -71,7 +72,7 @@ bool TypedUrlDataTypeController::StartModels() { history_service_ = history; return true; } else { - notification_registrar_.Add(this, NotificationType::HISTORY_LOADED, + notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_LOADED, NotificationService::AllSources()); return false; } @@ -99,13 +100,13 @@ void TypedUrlDataTypeController::CreateSyncComponents() { set_change_processor(sync_components.change_processor); } -void TypedUrlDataTypeController::Observe(NotificationType type, +void TypedUrlDataTypeController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_EQ(state(), MODEL_STARTING); notification_registrar_.Remove(this, - NotificationType::HISTORY_LOADED, + chrome::NOTIFICATION_HISTORY_LOADED, NotificationService::AllSources()); history_service_ = profile()->GetHistoryServiceWithoutCreating(); DCHECK(history_service_.get()); diff --git a/chrome/browser/sync/glue/typed_url_data_type_controller.h b/chrome/browser/sync/glue/typed_url_data_type_controller.h index 18f0a04..9720614 100644 --- a/chrome/browser/sync/glue/typed_url_data_type_controller.h +++ b/chrome/browser/sync/glue/typed_url_data_type_controller.h @@ -11,9 +11,9 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/sync/glue/non_frontend_data_type_controller.h" #include "content/browser/cancelable_request.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" class NotificationSource; class NotificationDetails; @@ -41,7 +41,7 @@ class TypedUrlDataTypeController : public NonFrontendDataTypeController, virtual browser_sync::ModelSafeGroup model_safe_group() const; // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/notifier/invalidation_util.cc b/chrome/browser/sync/notifier/invalidation_util.cc index e4e0ea5..360d153 100644 --- a/chrome/browser/sync/notifier/invalidation_util.cc +++ b/chrome/browser/sync/notifier/invalidation_util.cc @@ -17,7 +17,7 @@ void RunAndDeleteClosure(invalidation::Closure* task) { bool RealModelTypeToObjectId(syncable::ModelType model_type, invalidation::ObjectId* object_id) { std::string notification_type; - if (!syncable::RealModelTypeToNotificationType( + if (!syncable::RealModelTypeToint( model_type, ¬ification_type)) { return false; } @@ -29,7 +29,7 @@ bool RealModelTypeToObjectId(syncable::ModelType model_type, bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id, syncable::ModelType* model_type) { return - syncable::NotificationTypeToRealModelType( + syncable::intToRealModelType( object_id.name(), model_type); } diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index e124c59..2debdea 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -38,6 +38,7 @@ #include "chrome/browser/sync/signin_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/net/gaia/gaia_constants.h" @@ -46,7 +47,6 @@ #include "chrome/common/url_constants.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "net/base/cookie_monster.h" #include "ui/base/l10n/l10n_util.h" @@ -175,20 +175,20 @@ void ProfileSyncService::Initialize() { void ProfileSyncService::RegisterAuthNotifications() { registrar_.Add(this, - NotificationType::TOKEN_AVAILABLE, + chrome::NOTIFICATION_TOKEN_AVAILABLE, Source<TokenService>(profile_->GetTokenService())); registrar_.Add(this, - NotificationType::TOKEN_LOADING_FINISHED, + chrome::NOTIFICATION_TOKEN_LOADING_FINISHED, Source<TokenService>(profile_->GetTokenService())); registrar_.Add(this, - NotificationType::GOOGLE_SIGNIN_SUCCESSFUL, + chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, Source<Profile>(profile_)); registrar_.Add(this, - NotificationType::GOOGLE_SIGNIN_FAILED, + chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, Source<Profile>(profile_)); if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableSyncOAuth)) { registrar_.Add(this, - NotificationType::COOKIE_CHANGED, + chrome::NOTIFICATION_COOKIE_CHANGED, Source<Profile>(profile_)); } } @@ -409,10 +409,10 @@ void ProfileSyncService::Shutdown(bool sync_disabled) { } registrar_.Remove(this, - NotificationType::SYNC_CONFIGURE_START, + chrome::NOTIFICATION_SYNC_CONFIGURE_START, Source<DataTypeManager>(data_type_manager_.get())); registrar_.Remove(this, - NotificationType::SYNC_CONFIGURE_DONE, + chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, Source<DataTypeManager>(data_type_manager_.get())); data_type_manager_.reset(); } @@ -1093,10 +1093,10 @@ void ProfileSyncService::ConfigureDataTypeManager() { factory_->CreateDataTypeManager(backend_.get(), data_type_controllers_)); registrar_.Add(this, - NotificationType::SYNC_CONFIGURE_START, + chrome::NOTIFICATION_SYNC_CONFIGURE_START, Source<DataTypeManager>(data_type_manager_.get())); registrar_.Add(this, - NotificationType::SYNC_CONFIGURE_DONE, + chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, Source<DataTypeManager>(data_type_manager_.get())); // We create the migrator at the same time. @@ -1238,16 +1238,16 @@ void ProfileSyncService::GetEncryptedDataTypes( } } -void ProfileSyncService::Observe(NotificationType type, +void ProfileSyncService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::SYNC_CONFIGURE_START: { + switch (type) { + case chrome::NOTIFICATION_SYNC_CONFIGURE_START: { NotifyObservers(); // TODO(sync): Maybe toast? break; } - case NotificationType::SYNC_CONFIGURE_DONE: { + case chrome::NOTIFICATION_SYNC_CONFIGURE_DONE: { DataTypeManager::ConfigureResultWithErrorLocation* result_with_location = Details<DataTypeManager::ConfigureResultWithErrorLocation>( details).ptr(); @@ -1300,7 +1300,7 @@ void ProfileSyncService::Observe(NotificationType type, } break; } - case NotificationType::PREF_CHANGED: { + case chrome::NOTIFICATION_PREF_CHANGED: { std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kSyncManaged) { NotifyObservers(); @@ -1312,7 +1312,7 @@ void ProfileSyncService::Observe(NotificationType type, } break; } - case NotificationType::GOOGLE_SIGNIN_SUCCESSFUL: { + case chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL: { const GoogleServiceSigninSuccessDetails* successful = (Details<const GoogleServiceSigninSuccessDetails>(details).ptr()); // We pass 'false' to SetPassphrase to denote that this is an implicit @@ -1323,13 +1323,13 @@ void ProfileSyncService::Observe(NotificationType type, SetPassphrase(successful->password, false, true); break; } - case NotificationType::GOOGLE_SIGNIN_FAILED: { + case chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED: { GoogleServiceAuthError error = *(Details<const GoogleServiceAuthError>(details).ptr()); UpdateAuthErrorState(error); break; } - case NotificationType::TOKEN_AVAILABLE: { + case chrome::NOTIFICATION_TOKEN_AVAILABLE: { if (AreCredentialsAvailable()) { if (backend_initialized_) { backend_->UpdateCredentials(GetCredentials()); @@ -1340,7 +1340,7 @@ void ProfileSyncService::Observe(NotificationType type, } break; } - case NotificationType::TOKEN_LOADING_FINISHED: { + case chrome::NOTIFICATION_TOKEN_LOADING_FINISHED: { // If not in Chrome OS, and we have a username without tokens, // the user will need to signin again, so sign out. if (cros_user_.empty() && @@ -1350,7 +1350,7 @@ void ProfileSyncService::Observe(NotificationType type, } break; } - case NotificationType::COOKIE_CHANGED: { + case chrome::NOTIFICATION_COOKIE_CHANGED: { OnCookieChanged(Source<Profile>(source).ptr(), Details<ChromeCookieDetails>(details).ptr()); break; diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index c25acb8..8e8c658 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -27,9 +27,9 @@ #include "chrome/browser/sync/syncable/model_type.h" #include "chrome/browser/sync/unrecoverable_error_handler.h" #include "chrome/common/net/gaia/google_service_auth_error.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" class NotificationDetails; @@ -398,7 +398,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend, browser_sync::ChangeProcessor* change_processor); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index eecc767..f00e7ba 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -41,11 +41,11 @@ #include "chrome/browser/webdata/autofill_entry.h" #include "chrome/browser/webdata/autofill_table.h" #include "chrome/browser/webdata/web_database.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/test/sync/engine/test_id_factory.h" #include "content/browser/browser_thread.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" using base::Time; @@ -871,7 +871,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddEntry) { AutofillChangeList changes; changes.push_back(AutofillChange(AutofillChange::ADD, added_entry.key())); scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); - notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, + notifier->Notify(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillChangeList>(&changes)); @@ -900,7 +900,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfile) { AutofillProfileChange change(AutofillProfileChange::ADD, added_profile.guid(), &added_profile); scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); - notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED, + notifier->Notify(chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillProfileChange>(&change)); @@ -934,7 +934,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateEntry) { changes.push_back(AutofillChange(AutofillChange::UPDATE, updated_entry.key())); scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); - notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, + notifier->Notify(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillChangeList>(&changes)); @@ -964,7 +964,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveEntry) { changes.push_back(AutofillChange(AutofillChange::REMOVE, original_entry.key())); scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); - notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, + notifier->Notify(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillChangeList>(&changes)); @@ -1002,7 +1002,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) { AutofillProfileChange change(AutofillProfileChange::REMOVE, sync_profile.guid(), NULL); scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); - notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED, + notifier->Notify(chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillProfileChange>(&change)); @@ -1029,7 +1029,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeError) { changes.push_back(AutofillChange(AutofillChange::ADD, evil_entry.key())); scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); - notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, + notifier->Notify(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillChangeList>(&changes)); @@ -1041,7 +1041,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeError) { EXPECT_TRUE(service_->unrecoverable_error_detected()); // Ensure future autofill notifications don't crash. - notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, + notifier->Notify(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillChangeList>(&changes)); } diff --git a/chrome/browser/sync/profile_sync_service_password_unittest.cc b/chrome/browser/sync/profile_sync_service_password_unittest.cc index 0433b67..01bb428 100644 --- a/chrome/browser/sync/profile_sync_service_password_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_password_unittest.cc @@ -27,6 +27,7 @@ #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/syncable/syncable.h" #include "chrome/browser/sync/test_profile_sync_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/pref_names.h" #include "chrome/test/sync/engine/test_id_factory.h" @@ -34,7 +35,6 @@ #include "content/browser/browser_thread.h" #include "content/common/notification_observer_mock.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" #include "webkit/glue/password_form.h" @@ -161,10 +161,10 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest { notification_service_ = new ThreadNotificationService(&db_thread_); notification_service_->Init(); registrar_.Add(&observer_, - NotificationType::SYNC_CONFIGURE_DONE, + chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, NotificationService::AllSources()); registrar_.Add(&observer_, - NotificationType::SYNC_CONFIGURE_BLOCKED, + chrome::NOTIFICATION_SYNC_CONFIGURE_BLOCKED, NotificationService::AllSources()); } @@ -222,11 +222,11 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest { EXPECT_CALL(observer_, Observe( - NotificationType(NotificationType::SYNC_CONFIGURE_DONE),_,_)); + int(chrome::NOTIFICATION_SYNC_CONFIGURE_DONE),_,_)); EXPECT_CALL(observer_, Observe( - NotificationType( - NotificationType::SYNC_CONFIGURE_BLOCKED),_,_)) + int( + chrome::NOTIFICATION_SYNC_CONFIGURE_BLOCKED),_,_)) .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); service_->RegisterDataTypeController(data_type_controller); diff --git a/chrome/browser/sync/profile_sync_service_session_unittest.cc b/chrome/browser/sync/profile_sync_service_session_unittest.cc index 590b2ad..e470daf 100644 --- a/chrome/browser/sync/profile_sync_service_session_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_session_unittest.cc @@ -28,6 +28,7 @@ #include "chrome/browser/sync/syncable/model_type.h" #include "chrome/browser/sync/syncable/syncable.h" #include "chrome/browser/sync/test_profile_sync_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/test/browser_with_test_window_test.h" #include "chrome/test/profile_mock.h" @@ -78,15 +79,15 @@ class ProfileSyncServiceSessionTest helper_.set_service(session_service); service()->SetWindowType(window_id_, Browser::TYPE_TABBED); service()->SetWindowBounds(window_id_, window_bounds_, false); - registrar_.Add(this, NotificationType::FOREIGN_SESSION_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, NotificationService::AllSources()); } - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::FOREIGN_SESSION_UPDATED: + switch (type) { + case chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED: notified_of_update_ = true; break; default: diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index dc1db0c..beb9673 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -13,12 +13,12 @@ #include "chrome/browser/sync/profile_sync_factory_mock.h" #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/sync/test_profile_sync_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/net/gaia/gaia_auth_consumer.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" using browser_sync::DataTypeManager; @@ -251,9 +251,9 @@ TEST_F(ProfileSyncServiceStartupTest, SKIP_MACOSX(StartFailure)) { configure_result, FROM_HERE, syncable::ModelTypeSet()); EXPECT_CALL(*data_type_manager, Configure(_, _)). WillRepeatedly(DoAll(NotifyFromDataTypeManager(data_type_manager, - NotificationType::SYNC_CONFIGURE_START), + chrome::NOTIFICATION_SYNC_CONFIGURE_START), NotifyFromDataTypeManagerWithResult(data_type_manager, - NotificationType::SYNC_CONFIGURE_DONE, + chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, &result))); EXPECT_CALL(*data_type_manager, state()). WillOnce(Return(DataTypeManager::STOPPED)); diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc index f065743..bb2a4f9 100644 --- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc @@ -28,6 +28,7 @@ #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/test_profile_sync_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/test/profile_mock.h" #include "chrome/test/sync/engine/test_id_factory.h" @@ -434,7 +435,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeAdd) { history::URLsModifiedDetails details; details.changed_urls.push_back(added_entry); scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); - notifier->Notify(NotificationType::HISTORY_TYPED_URLS_MODIFIED, + notifier->Notify(chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, Details<history::URLsModifiedDetails>(&details)); std::vector<history::URLRow> new_sync_entries; @@ -470,7 +471,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeUpdate) { history::URLsModifiedDetails details; details.changed_urls.push_back(updated_entry); scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); - notifier->Notify(NotificationType::HISTORY_TYPED_URLS_MODIFIED, + notifier->Notify(chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, Details<history::URLsModifiedDetails>(&details)); std::vector<history::URLRow> new_sync_entries; @@ -497,7 +498,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeAddFromVisit) { details.row = added_entry; details.transition = PageTransition::TYPED; scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); - notifier->Notify(NotificationType::HISTORY_URL_VISITED, + notifier->Notify(chrome::NOTIFICATION_HISTORY_URL_VISITED, Details<history::URLVisitedDetails>(&details)); std::vector<history::URLRow> new_sync_entries; @@ -534,7 +535,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeUpdateFromVisit) { details.row = updated_entry; details.transition = PageTransition::TYPED; scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); - notifier->Notify(NotificationType::HISTORY_URL_VISITED, + notifier->Notify(chrome::NOTIFICATION_HISTORY_URL_VISITED, Details<history::URLVisitedDetails>(&details)); std::vector<history::URLRow> new_sync_entries; @@ -573,7 +574,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserIgnoreChangeUpdateFromVisit) { // Should ignore this change because it's not TYPED. details.transition = PageTransition::RELOAD; scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); - notifier->Notify(NotificationType::HISTORY_URL_VISITED, + notifier->Notify(chrome::NOTIFICATION_HISTORY_URL_VISITED, Details<history::URLVisitedDetails>(&details)); GetTypedUrlsFromSyncDB(&new_sync_entries); @@ -589,7 +590,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserIgnoreChangeUpdateFromVisit) { &updated_visits)); details.row = twelve_visits; details.transition = PageTransition::TYPED; - notifier->Notify(NotificationType::HISTORY_URL_VISITED, + notifier->Notify(chrome::NOTIFICATION_HISTORY_URL_VISITED, Details<history::URLVisitedDetails>(&details)); GetTypedUrlsFromSyncDB(&new_sync_entries); // Should be no changes to the sync DB from this notification. @@ -603,7 +604,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserIgnoreChangeUpdateFromVisit) { &updated_visits)); details.row = twenty_visits; details.transition = PageTransition::TYPED; - notifier->Notify(NotificationType::HISTORY_URL_VISITED, + notifier->Notify(chrome::NOTIFICATION_HISTORY_URL_VISITED, Details<history::URLVisitedDetails>(&details)); GetTypedUrlsFromSyncDB(&new_sync_entries); ASSERT_EQ(1U, new_sync_entries.size()); @@ -636,7 +637,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeRemove) { changes.all_history = false; changes.urls.insert(GURL("http://mine.com")); scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); - notifier->Notify(NotificationType::HISTORY_URLS_DELETED, + notifier->Notify(chrome::NOTIFICATION_HISTORY_URLS_DELETED, Details<history::URLsDeletedDetails>(&changes)); std::vector<history::URLRow> new_sync_entries; @@ -670,7 +671,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeRemoveAll) { history::URLsDeletedDetails changes; changes.all_history = true; scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); - notifier->Notify(NotificationType::HISTORY_URLS_DELETED, + notifier->Notify(chrome::NOTIFICATION_HISTORY_URLS_DELETED, Details<history::URLsDeletedDetails>(&changes)); std::vector<history::URLRow> new_sync_entries; diff --git a/chrome/browser/sync/profile_sync_test_util.cc b/chrome/browser/sync/profile_sync_test_util.cc index a533fd4..26c89a4 100644 --- a/chrome/browser/sync/profile_sync_test_util.cc +++ b/chrome/browser/sync/profile_sync_test_util.cc @@ -49,12 +49,12 @@ ThreadNotifier::ThreadNotifier(base::Thread* notify_thread) : done_event_(false, false), notify_thread_(notify_thread) {} -void ThreadNotifier::Notify(NotificationType type, +void ThreadNotifier::Notify(int type, const NotificationDetails& details) { Notify(type, NotificationService::AllSources(), details); } -void ThreadNotifier::Notify(NotificationType type, +void ThreadNotifier::Notify(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -70,7 +70,7 @@ void ThreadNotifier::Notify(NotificationType type, ThreadNotifier::~ThreadNotifier() {} -void ThreadNotifier::NotifyTask(NotificationType type, +void ThreadNotifier::NotifyTask(int type, const NotificationSource& source, const NotificationDetails& details) { NotificationService::current()->Notify(type, source, details); diff --git a/chrome/browser/sync/profile_sync_test_util.h b/chrome/browser/sync/profile_sync_test_util.h index 9adfe3c..561f124 100644 --- a/chrome/browser/sync/profile_sync_test_util.h +++ b/chrome/browser/sync/profile_sync_test_util.h @@ -14,9 +14,9 @@ #include "base/synchronization/waitable_event.h" #include "chrome/browser/sync/profile_sync_service_observer.h" #include "content/browser/browser_thread.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" namespace base { @@ -67,9 +67,9 @@ class ThreadNotifier : // NOLINT public: explicit ThreadNotifier(base::Thread* notify_thread); - void Notify(NotificationType type, const NotificationDetails& details); + void Notify(int type, const NotificationDetails& details); - void Notify(NotificationType type, + void Notify(int type, const NotificationSource& source, const NotificationDetails& details); @@ -77,7 +77,7 @@ class ThreadNotifier : // NOLINT friend class base::RefCountedThreadSafe<ThreadNotifier>; virtual ~ThreadNotifier(); - void NotifyTask(NotificationType type, + void NotifyTask(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/signin_manager.cc b/chrome/browser/sync/signin_manager.cc index 58e516a..1ecd9cd 100644 --- a/chrome/browser/sync/signin_manager.cc +++ b/chrome/browser/sync/signin_manager.cc @@ -10,6 +10,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/pref_names.h" #include "chrome/common/chrome_switches.h" @@ -42,10 +43,10 @@ void SigninManager::Initialize(Profile* profile) { void SigninManager::CleanupNotificationRegistration() { #if !defined(OS_CHROMEOS) if (registrar_.IsRegistered(this, - NotificationType::TOKEN_AVAILABLE, + chrome::NOTIFICATION_TOKEN_AVAILABLE, NotificationService::AllSources())) { registrar_.Remove(this, - NotificationType::TOKEN_AVAILABLE, + chrome::NOTIFICATION_TOKEN_AVAILABLE, NotificationService::AllSources()); } #endif @@ -92,7 +93,7 @@ void SigninManager::StartSignIn(const std::string& username, if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableAutoLogin)) { registrar_.Add(this, - NotificationType::TOKEN_AVAILABLE, + chrome::NOTIFICATION_TOKEN_AVAILABLE, NotificationService::AllSources()); } #endif @@ -147,7 +148,7 @@ void SigninManager::OnGetUserInfoSuccess(const std::string& key, GoogleServiceSigninSuccessDetails details(username_, password_); NotificationService::current()->Notify( - NotificationType::GOOGLE_SIGNIN_SUCCESSFUL, + chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, Source<Profile>(profile_), Details<const GoogleServiceSigninSuccessDetails>(&details)); @@ -180,7 +181,7 @@ void SigninManager::OnTokenAuthFailure(const GoogleServiceAuthError& error) { void SigninManager::OnClientLoginFailure(const GoogleServiceAuthError& error) { NotificationService::current()->Notify( - NotificationType::GOOGLE_SIGNIN_FAILED, + chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, Source<Profile>(profile_), Details<const GoogleServiceAuthError>(&error)); @@ -198,11 +199,11 @@ void SigninManager::OnClientLoginFailure(const GoogleServiceAuthError& error) { SignOut(); } -void SigninManager::Observe(NotificationType type, +void SigninManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { #if !defined(OS_CHROMEOS) - DCHECK(type == NotificationType::TOKEN_AVAILABLE); + DCHECK(type == chrome::NOTIFICATION_TOKEN_AVAILABLE); TokenService::TokenAvailableDetails* tok_details = Details<TokenService::TokenAvailableDetails>(details).ptr(); diff --git a/chrome/browser/sync/signin_manager.h b/chrome/browser/sync/signin_manager.h index 76a8e78..4632eaf 100644 --- a/chrome/browser/sync/signin_manager.h +++ b/chrome/browser/sync/signin_manager.h @@ -82,7 +82,7 @@ class SigninManager : public GaiaAuthConsumer , public NotificationObserver { OVERRIDE; // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/sync/signin_manager_unittest.cc b/chrome/browser/sync/signin_manager_unittest.cc index d9fadb3..7d1325a 100644 --- a/chrome/browser/sync/signin_manager_unittest.cc +++ b/chrome/browser/sync/signin_manager_unittest.cc @@ -8,6 +8,7 @@ #include "chrome/browser/net/gaia/token_service_unittest.h" #include "chrome/browser/password_manager/encryptor.h" #include "chrome/browser/webdata/web_data_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/net/gaia/gaia_urls.h" #include "chrome/test/signaling_task.h" #include "chrome/test/testing_profile.h" @@ -22,9 +23,10 @@ class SigninManagerTest : public TokenServiceTestHarness { virtual void SetUp() { TokenServiceTestHarness::SetUp(); manager_.reset(new SigninManager()); - google_login_success_.ListenFor(NotificationType::GOOGLE_SIGNIN_SUCCESSFUL, - Source<Profile>(profile_.get())); - google_login_failure_.ListenFor(NotificationType::GOOGLE_SIGNIN_FAILED, + google_login_success_.ListenFor( + chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, + Source<Profile>(profile_.get())); + google_login_failure_.ListenFor(chrome::NOTIFICATION_GOOGLE_SIGNIN_FAILED, Source<Profile>(profile_.get())); URLFetcher::set_factory(&factory_); diff --git a/chrome/browser/sync/syncable/model_type.cc b/chrome/browser/sync/syncable/model_type.cc index ced99b3..868b43c 100644 --- a/chrome/browser/sync/syncable/model_type.cc +++ b/chrome/browser/sync/syncable/model_type.cc @@ -440,58 +440,58 @@ void PostTimeToTypeHistogram(ModelType model_type, base::TimeDelta time) { // TODO(akalin): Figure out a better way to do these mappings. namespace { -const char kBookmarkNotificationType[] = "BOOKMARK"; -const char kPreferenceNotificationType[] = "PREFERENCE"; -const char kPasswordNotificationType[] = "PASSWORD"; -const char kAutofillNotificationType[] = "AUTOFILL"; -const char kThemeNotificationType[] = "THEME"; -const char kTypedUrlNotificationType[] = "TYPED_URL"; -const char kExtensionNotificationType[] = "EXTENSION"; -const char kNigoriNotificationType[] = "NIGORI"; -const char kAppNotificationType[] = "APP"; -const char kSearchEngineNotificationType[] = "SEARCH_ENGINE"; -const char kSessionNotificationType[] = "SESSION"; -const char kAutofillProfileNotificationType[] = "AUTOFILL_PROFILE"; +const char kBookmarkint[] = "BOOKMARK"; +const char kPreferenceint[] = "PREFERENCE"; +const char kPasswordint[] = "PASSWORD"; +const char kAutofillint[] = "AUTOFILL"; +const char kThemeint[] = "THEME"; +const char kTypedUrlint[] = "TYPED_URL"; +const char kExtensionint[] = "EXTENSION"; +const char kNigoriint[] = "NIGORI"; +const char kAppint[] = "APP"; +const char kSearchEngineint[] = "SEARCH_ENGINE"; +const char kSessionint[] = "SESSION"; +const char kAutofillProfileint[] = "AUTOFILL_PROFILE"; } // namespace -bool RealModelTypeToNotificationType(ModelType model_type, +bool RealModelTypeToint(ModelType model_type, std::string* notification_type) { switch (model_type) { case BOOKMARKS: - *notification_type = kBookmarkNotificationType; + *notification_type = kBookmarkint; return true; case PREFERENCES: - *notification_type = kPreferenceNotificationType; + *notification_type = kPreferenceint; return true; case PASSWORDS: - *notification_type = kPasswordNotificationType; + *notification_type = kPasswordint; return true; case AUTOFILL: - *notification_type = kAutofillNotificationType; + *notification_type = kAutofillint; return true; case THEMES: - *notification_type = kThemeNotificationType; + *notification_type = kThemeint; return true; case TYPED_URLS: - *notification_type = kTypedUrlNotificationType; + *notification_type = kTypedUrlint; return true; case EXTENSIONS: - *notification_type = kExtensionNotificationType; + *notification_type = kExtensionint; return true; case NIGORI: - *notification_type = kNigoriNotificationType; + *notification_type = kNigoriint; return true; case APPS: - *notification_type = kAppNotificationType; + *notification_type = kAppint; return true; case SEARCH_ENGINES: - *notification_type = kSearchEngineNotificationType; + *notification_type = kSearchEngineint; return true; case SESSIONS: - *notification_type = kSessionNotificationType; + *notification_type = kSessionint; return true; case AUTOFILL_PROFILE: - *notification_type = kAutofillProfileNotificationType; + *notification_type = kAutofillProfileint; return true; default: break; @@ -500,42 +500,42 @@ bool RealModelTypeToNotificationType(ModelType model_type, return false; } -bool NotificationTypeToRealModelType(const std::string& notification_type, +bool intToRealModelType(const std::string& notification_type, ModelType* model_type) { - if (notification_type == kBookmarkNotificationType) { + if (notification_type == kBookmarkint) { *model_type = BOOKMARKS; return true; - } else if (notification_type == kPreferenceNotificationType) { + } else if (notification_type == kPreferenceint) { *model_type = PREFERENCES; return true; - } else if (notification_type == kPasswordNotificationType) { + } else if (notification_type == kPasswordint) { *model_type = PASSWORDS; return true; - } else if (notification_type == kAutofillNotificationType) { + } else if (notification_type == kAutofillint) { *model_type = AUTOFILL; return true; - } else if (notification_type == kThemeNotificationType) { + } else if (notification_type == kThemeint) { *model_type = THEMES; return true; - } else if (notification_type == kTypedUrlNotificationType) { + } else if (notification_type == kTypedUrlint) { *model_type = TYPED_URLS; return true; - } else if (notification_type == kExtensionNotificationType) { + } else if (notification_type == kExtensionint) { *model_type = EXTENSIONS; return true; - } else if (notification_type == kNigoriNotificationType) { + } else if (notification_type == kNigoriint) { *model_type = NIGORI; return true; - } else if (notification_type == kAppNotificationType) { + } else if (notification_type == kAppint) { *model_type = APPS; return true; - } else if (notification_type == kSearchEngineNotificationType) { + } else if (notification_type == kSearchEngineint) { *model_type = SEARCH_ENGINES; return true; - } else if (notification_type == kSessionNotificationType) { + } else if (notification_type == kSessionint) { *model_type = SESSIONS; return true; - } else if (notification_type == kAutofillProfileNotificationType) { + } else if (notification_type == kAutofillProfileint) { *model_type = AUTOFILL_PROFILE; return true; } diff --git a/chrome/browser/sync/syncable/model_type.h b/chrome/browser/sync/syncable/model_type.h index 16c4db7..ed84384 100644 --- a/chrome/browser/sync/syncable/model_type.h +++ b/chrome/browser/sync/syncable/model_type.h @@ -151,13 +151,13 @@ void PostTimeToTypeHistogram(ModelType model_type, base::TimeDelta time); // subscribing to server-issued notifications). Returns true iff // |model_type| was a real model type and |notification_type| was // filled in. -bool RealModelTypeToNotificationType(ModelType model_type, +bool RealModelTypeToint(ModelType model_type, std::string* notification_type); // Converts a notification type to a real model type. Returns true // iff |notification_type| was the notification type of a real model // type and |model_type| was filled in. -bool NotificationTypeToRealModelType(const std::string& notification_type, +bool intToRealModelType(const std::string& notification_type, ModelType* model_type); } // namespace syncable diff --git a/chrome/browser/sync/test_profile_sync_service.cc b/chrome/browser/sync/test_profile_sync_service.cc index 6aef798..1436a21 100644 --- a/chrome/browser/sync/test_profile_sync_service.cc +++ b/chrome/browser/sync/test_profile_sync_service.cc @@ -12,6 +12,7 @@ #include "chrome/browser/sync/sessions/session_state.h" #include "chrome/browser/sync/syncable/directory_manager.h" #include "chrome/browser/sync/syncable/syncable.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/sync/test_http_bridge_factory.h" using browser_sync::ModelSafeRoutingInfo; @@ -245,11 +246,11 @@ void TestProfileSyncService::OnBackendInitialized() { } } -void TestProfileSyncService::Observe(NotificationType type, +void TestProfileSyncService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { ProfileSyncService::Observe(type, source, details); - if (type == NotificationType::SYNC_CONFIGURE_DONE && + if (type == chrome::NOTIFICATION_SYNC_CONFIGURE_DONE && !synchronous_sync_configuration_) { MessageLoop::current()->Quit(); } diff --git a/chrome/browser/sync/test_profile_sync_service.h b/chrome/browser/sync/test_profile_sync_service.h index d9bba61..86ca121 100644 --- a/chrome/browser/sync/test_profile_sync_service.h +++ b/chrome/browser/sync/test_profile_sync_service.h @@ -99,7 +99,7 @@ class TestProfileSyncService : public ProfileSyncService { virtual void OnBackendInitialized(); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/sync/util/extensions_activity_monitor.cc b/chrome/browser/sync/util/extensions_activity_monitor.cc index 60f6d1a..d00a0b4 100644 --- a/chrome/browser/sync/util/extensions_activity_monitor.cc +++ b/chrome/browser/sync/util/extensions_activity_monitor.cc @@ -6,6 +6,7 @@ #include "base/task.h" #include "chrome/browser/extensions/extension_bookmarks_module.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" @@ -31,7 +32,8 @@ class RegistrationTask : public Task { // the fly so there is no reliable object to point to (same problem if we // wanted to use the string name). Thus, we use all sources and filter in // Observe. - registrar_->Add(monitor_, NotificationType::EXTENSION_BOOKMARKS_API_INVOKED, + registrar_->Add(monitor_, + chrome::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, NotificationService::AllSources()); } @@ -78,7 +80,7 @@ void ExtensionsActivityMonitor::PutRecords(const Records& records) { } } -void ExtensionsActivityMonitor::Observe(NotificationType type, +void ExtensionsActivityMonitor::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { base::AutoLock lock(records_lock_); diff --git a/chrome/browser/sync/util/extensions_activity_monitor.h b/chrome/browser/sync/util/extensions_activity_monitor.h index 6d085e6..9166b70 100644 --- a/chrome/browser/sync/util/extensions_activity_monitor.h +++ b/chrome/browser/sync/util/extensions_activity_monitor.h @@ -57,7 +57,7 @@ class ExtensionsActivityMonitor : public NotificationObserver { void PutRecords(const Records& records); // NotificationObserver implementation. Called on |ui_loop_|. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: diff --git a/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc b/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc index b7e8e7c2..3631a77 100644 --- a/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc +++ b/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc @@ -9,6 +9,7 @@ #include "base/synchronization/waitable_event.h" #include "base/values.h" #include "chrome/browser/extensions/extension_bookmarks_module.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "content/browser/browser_thread.h" @@ -46,7 +47,7 @@ class BookmarkAPIEventTask : public Task { virtual void Run() { for (size_t i = 0; i < repeats_; i++) { NotificationService::current()->Notify( - NotificationType::EXTENSION_BOOKMARKS_API_INVOKED, + chrome::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, Source<Extension>(extension_.get()), Details<const BookmarksFunction>(function_.get())); } diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc index b7fa507..9d568e2 100644 --- a/chrome/browser/tab_contents/background_contents.cc +++ b/chrome/browser/tab_contents/background_contents.cc @@ -9,6 +9,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_preferences_util.h" #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/url_constants.h" #include "content/browser/browsing_instance.h" @@ -31,13 +32,13 @@ BackgroundContents::BackgroundContents(SiteInstance* site_instance, render_view_host_ = new RenderViewHost(site_instance, this, routing_id, NULL); // Close ourselves when the application is shutting down. - registrar_.Add(this, NotificationType::APP_TERMINATING, + registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, NotificationService::AllSources()); // Register for our parent profile to shutdown, so we can shut ourselves down // as well (should only be called for OTR profiles, as we should receive // APP_TERMINATING before non-OTR profiles are destroyed). - registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile)); } @@ -52,7 +53,7 @@ BackgroundContents::~BackgroundContents() { return; Profile* profile = render_view_host_->process()->profile(); NotificationService::current()->Notify( - NotificationType::BACKGROUND_CONTENTS_DELETED, + chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, Source<Profile>(profile), Details<BackgroundContents>(this)); render_view_host_->Shutdown(); // deletes render_view_host @@ -92,7 +93,7 @@ void BackgroundContents::DidNavigate( Profile* profile = render_view_host->process()->profile(); NotificationService::current()->Notify( - NotificationType::BACKGROUND_CONTENTS_NAVIGATED, + chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, Source<Profile>(profile), Details<BackgroundContents>(this)); } @@ -120,14 +121,14 @@ bool BackgroundContents::PreHandleKeyboardEvent( return false; } -void BackgroundContents::Observe(NotificationType type, +void BackgroundContents::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent // background pages are closed when the last referencing frame is closed. - switch (type.value) { - case NotificationType::PROFILE_DESTROYED: - case NotificationType::APP_TERMINATING: { + switch (type) { + case chrome::NOTIFICATION_PROFILE_DESTROYED: + case content::NOTIFICATION_APP_TERMINATING: { delete this; break; } @@ -164,7 +165,7 @@ void BackgroundContents::ClearInspectorSettings() { void BackgroundContents::Close(RenderViewHost* render_view_host) { Profile* profile = render_view_host->process()->profile(); NotificationService::current()->Notify( - NotificationType::BACKGROUND_CONTENTS_CLOSED, + chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, Source<Profile>(profile), Details<BackgroundContents>(this)); delete this; @@ -175,7 +176,7 @@ void BackgroundContents::RenderViewGone(RenderViewHost* rvh, int error_code) { Profile* profile = rvh->process()->profile(); NotificationService::current()->Notify( - NotificationType::BACKGROUND_CONTENTS_TERMINATED, + chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED, Source<Profile>(profile), Details<BackgroundContents>(this)); diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h index 6552632..361c7da 100644 --- a/chrome/browser/tab_contents/background_contents.h +++ b/chrome/browser/tab_contents/background_contents.h @@ -120,7 +120,7 @@ class BackgroundContents : public RenderViewHostDelegate, virtual void UpdatePreferredSize(const gfx::Size& new_size) {} // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/tab_contents/chrome_interstitial_page.cc b/chrome/browser/tab_contents/chrome_interstitial_page.cc index 3c2b456..2de7627 100644 --- a/chrome/browser/tab_contents/chrome_interstitial_page.cc +++ b/chrome/browser/tab_contents/chrome_interstitial_page.cc @@ -6,6 +6,7 @@ #include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/renderer_preferences_util.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" @@ -26,14 +27,15 @@ ChromeInterstitialPage::~ChromeInterstitialPage() { void ChromeInterstitialPage::Show() { InterstitialPage::Show(); - notification_registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, + notification_registrar_.Add( + this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, Source<RenderViewHost>(render_view_host())); } -void ChromeInterstitialPage::Observe(NotificationType type, +void ChromeInterstitialPage::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (NotificationType::DOM_OPERATION_RESPONSE == type.value) { + if (chrome::NOTIFICATION_DOM_OPERATION_RESPONSE == type) { if (enabled()) { Details<DomOperationNotificationDetails> dom_op_details(details); CommandReceived(dom_op_details->json()); diff --git a/chrome/browser/tab_contents/chrome_interstitial_page.h b/chrome/browser/tab_contents/chrome_interstitial_page.h index 44eeb93..6c712f6 100644 --- a/chrome/browser/tab_contents/chrome_interstitial_page.h +++ b/chrome/browser/tab_contents/chrome_interstitial_page.h @@ -29,7 +29,7 @@ class ChromeInterstitialPage : public InterstitialPage { protected: // NotificationObserver method: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/tab_contents/infobar_container.cc b/chrome/browser/tab_contents/infobar_container.cc index c16f95d..63b7a61 100644 --- a/chrome/browser/tab_contents/infobar_container.cc +++ b/chrome/browser/tab_contents/infobar_container.cc @@ -12,6 +12,7 @@ #include "chrome/browser/tab_contents/infobar.h" #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" #include "ui/base/animation/slide_animation.h" @@ -43,11 +44,11 @@ void InfoBarContainer::ChangeTabContents(TabContentsWrapper* contents) { tab_contents_ = contents; if (tab_contents_) { Source<TabContentsWrapper> tc_source(tab_contents_); - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_ADDED, + registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, tc_source); - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, + registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, tc_source); - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, + registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, tc_source); for (size_t i = 0; i < tab_contents_->infobar_count(); ++i) { @@ -120,24 +121,24 @@ void InfoBarContainer::RemoveAllInfoBarsForDestruction() { ChangeTabContents(NULL); } -void InfoBarContainer::Observe(NotificationType type, +void InfoBarContainer::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::TAB_CONTENTS_INFOBAR_ADDED: + switch (type) { + case chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED: AddInfoBar( Details<InfoBarAddedDetails>(details)->CreateInfoBar(tab_contents_), infobars_.size(), true, WANT_CALLBACK); break; - case NotificationType::TAB_CONTENTS_INFOBAR_REMOVED: { + case chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED: { InfoBarRemovedDetails* removed_details = Details<InfoBarRemovedDetails>(details).ptr(); RemoveInfoBar(removed_details->first, removed_details->second); break; } - case NotificationType::TAB_CONTENTS_INFOBAR_REPLACED: { + case chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED: { InfoBarReplacedDetails* replaced_details = Details<InfoBarReplacedDetails>(details).ptr(); AddInfoBar(replaced_details->second->CreateInfoBar(tab_contents_), diff --git a/chrome/browser/tab_contents/infobar_container.h b/chrome/browser/tab_contents/infobar_container.h index 0944d81..a9bee62 100644 --- a/chrome/browser/tab_contents/infobar_container.h +++ b/chrome/browser/tab_contents/infobar_container.h @@ -96,7 +96,7 @@ class InfoBarContainer : public NotificationObserver { typedef std::vector<InfoBar*> InfoBars; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/tab_contents/popup_menu_helper_mac.h b/chrome/browser/tab_contents/popup_menu_helper_mac.h index 192db4b..b5c7fcf 100644 --- a/chrome/browser/tab_contents/popup_menu_helper_mac.h +++ b/chrome/browser/tab_contents/popup_menu_helper_mac.h @@ -32,7 +32,7 @@ class PopupMenuHelper : public NotificationObserver { private: // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/tab_contents/popup_menu_helper_mac.mm b/chrome/browser/tab_contents/popup_menu_helper_mac.mm index ef0b4f9..328e9c5 100644 --- a/chrome/browser/tab_contents/popup_menu_helper_mac.mm +++ b/chrome/browser/tab_contents/popup_menu_helper_mac.mm @@ -18,7 +18,7 @@ PopupMenuHelper::PopupMenuHelper(RenderViewHost* render_view_host) : render_view_host_(render_view_host) { notification_registrar_.Add( - this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, + this, content::RENDER_WIDGET_HOST_DESTROYED, Source<RenderWidgetHost>(render_view_host)); } @@ -76,10 +76,10 @@ void PopupMenuHelper::ShowPopupMenu( } void PopupMenuHelper::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::RENDER_WIDGET_HOST_DESTROYED); + DCHECK(type == content::RENDER_WIDGET_HOST_DESTROYED); RenderViewHost* rvh = Source<RenderViewHost>(source).ptr(); DCHECK_EQ(render_view_host_, rvh); render_view_host_ = NULL; diff --git a/chrome/browser/tab_contents/tab_contents_ssl_helper.cc b/chrome/browser/tab_contents/tab_contents_ssl_helper.cc index 35263d1..3fd8f74 100644 --- a/chrome/browser/tab_contents/tab_contents_ssl_helper.cc +++ b/chrome/browser/tab_contents/tab_contents_ssl_helper.cc @@ -14,6 +14,7 @@ #include "chrome/browser/tab_contents/infobar.h" #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/ssl/ssl_client_auth_handler.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -114,7 +115,7 @@ class TabContentsSSLHelper::SSLAddCertData : public NotificationObserver { private: // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -130,8 +131,10 @@ TabContentsSSLHelper::SSLAddCertData::SSLAddCertData( : tab_contents_(tab_contents), infobar_delegate_(NULL) { Source<TabContentsWrapper> source(tab_contents_); - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, source); - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, source); + registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, + source); + registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, + source); } TabContentsSSLHelper::SSLAddCertData::~SSLAddCertData() { @@ -153,13 +156,13 @@ void TabContentsSSLHelper::SSLAddCertData::ShowErrorInfoBar( } void TabContentsSSLHelper::SSLAddCertData::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type.value == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED || - type.value == NotificationType::TAB_CONTENTS_INFOBAR_REPLACED); + DCHECK(type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED || + type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED); if (infobar_delegate_ == - ((type.value == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED) ? + ((type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED) ? Details<InfoBarRemovedDetails>(details)->first : Details<InfoBarReplacedDetails>(details)->first)) infobar_delegate_ = NULL; diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc index 58bbbf6..312f820 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc @@ -29,8 +29,8 @@ #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" @@ -99,7 +99,7 @@ TabContentsViewGtk::TabContentsViewGtk(TabContents* tab_contents) gtk_container_add(GTK_CONTAINER(floating_.get()), expanded_); gtk_widget_show(expanded_); gtk_widget_show(floating_.get()); - registrar_.Add(this, NotificationType::TAB_CONTENTS_CONNECTED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED, Source<TabContents>(tab_contents)); drag_source_.reset(new TabContentsDragSource(this)); } @@ -282,11 +282,11 @@ void TabContentsViewGtk::TakeFocus(bool reverse) { } } -void TabContentsViewGtk::Observe(NotificationType type, +void TabContentsViewGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::TAB_CONTENTS_CONNECTED: { + switch (type) { + case content::NOTIFICATION_TAB_CONTENTS_CONNECTED: { // No need to remove the SadTabGtk's widget from the container since // the new RenderWidgetHostViewGtk instance already removed all the // vbox's children. diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.h b/chrome/browser/tab_contents/tab_contents_view_gtk.h index dff469b..33da82f 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.h +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.h @@ -80,7 +80,7 @@ class TabContentsViewGtk : public TabContentsView, // NotificationObserver implementation --------------------------------------- - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.h b/chrome/browser/tab_contents/tab_contents_view_mac.h index 1573b5f..6714cf7 100644 --- a/chrome/browser/tab_contents/tab_contents_view_mac.h +++ b/chrome/browser/tab_contents/tab_contents_view_mac.h @@ -100,7 +100,7 @@ class TabContentsViewMac : public TabContentsView, // NotificationObserver implementation --------------------------------------- - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm index d583621..a71ec40 100644 --- a/chrome/browser/tab_contents/tab_contents_view_mac.mm +++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm @@ -25,9 +25,9 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" #import "content/common/chrome_application_mac.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "content/common/view_messages.h" #include "skia/ext/skia_utils_mac.h" #import "third_party/mozilla/NSPasteboard+Utils.h" @@ -69,7 +69,7 @@ TabContentsView* TabContentsView::Create(TabContents* tab_contents) { TabContentsViewMac::TabContentsViewMac(TabContents* tab_contents) : TabContentsView(tab_contents), preferred_width_(0) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_CONNECTED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED, Source<TabContents>(tab_contents)); } @@ -358,11 +358,11 @@ void TabContentsViewMac::CloseTab() { tab_contents()->Close(tab_contents()->render_view_host()); } -void TabContentsViewMac::Observe(NotificationType type, +void TabContentsViewMac::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::TAB_CONTENTS_CONNECTED: { + switch (type) { + case content::NOTIFICATION_TAB_CONTENTS_CONNECTED: { sad_tab_.reset(); break; } diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc index 6234b27..02f6dd6 100644 --- a/chrome/browser/tab_contents/thumbnail_generator.cc +++ b/chrome/browser/tab_contents/thumbnail_generator.cc @@ -146,9 +146,9 @@ void ThumbnailGenerator::StartThumbnailing(TabContents* tab_contents) { // subclass, RenderViewHost when it is in a tab. We don't make thumbnails // for RenderViewHosts that aren't in tabs, or RenderWidgetHosts that // aren't views like select popups. - registrar_.Add(this, NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, + registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, Source<TabContents>(tab_contents)); - registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED, Source<TabContents>(tab_contents)); } } @@ -159,26 +159,26 @@ void ThumbnailGenerator::MonitorRenderer(RenderWidgetHost* renderer, bool currently_monitored = registrar_.IsRegistered( this, - NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, renderer_source); if (monitor != currently_monitored) { if (monitor) { registrar_.Add( this, - NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, renderer_source); registrar_.Add( this, - NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED, + content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, renderer_source); } else { registrar_.Remove( this, - NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, renderer_source); registrar_.Remove( this, - NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED, + content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, renderer_source); } } @@ -307,23 +307,23 @@ void ThumbnailGenerator::WidgetDidReceivePaintAtSizeAck( } } -void ThumbnailGenerator::Observe(NotificationType type, +void ThumbnailGenerator::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: { + switch (type) { + case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { // Install our observer for all new RVHs. RenderViewHost* renderer = Details<RenderViewHost>(details).ptr(); MonitorRenderer(renderer, true); break; } - case NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED: + case content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED: if (!*Details<bool>(details).ptr()) WidgetHidden(Source<RenderWidgetHost>(source).ptr()); break; - case NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK: { + case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK: { RenderWidgetHost::PaintAtSizeAckDetails* size_ack_details = Details<RenderWidgetHost::PaintAtSizeAckDetails>(details).ptr(); WidgetDidReceivePaintAtSizeAck( @@ -333,12 +333,12 @@ void ThumbnailGenerator::Observe(NotificationType type, break; } - case NotificationType::TAB_CONTENTS_DISCONNECTED: + case content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED: TabContentsDisconnected(Source<TabContents>(source).ptr()); break; default: - NOTREACHED() << "Unexpected notification type: " << type.value; + NOTREACHED() << "Unexpected notification type: " << type; } } diff --git a/chrome/browser/tab_contents/thumbnail_generator.h b/chrome/browser/tab_contents/thumbnail_generator.h index 23a9361..0c0e588 100644 --- a/chrome/browser/tab_contents/thumbnail_generator.h +++ b/chrome/browser/tab_contents/thumbnail_generator.h @@ -134,7 +134,7 @@ class ThumbnailGenerator : public NotificationObserver, const gfx::Size& size); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc index 774a77a..308a001 100644 --- a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc +++ b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc @@ -68,7 +68,7 @@ class ThumbnailGeneratorTest : public testing::Test { // a little scary in that we don't have a RenderView, but the only listener // will want a RenderWidget, so it works out OK. NotificationService::current()->Notify( - NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, + chrome::RENDER_VIEW_HOST_CREATED_FOR_TAB, Source<RenderViewHostManager>(NULL), Details<RenderViewHost>(reinterpret_cast<RenderViewHost*>( widget_.get()))); diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index 55bcf33..dd83969 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -7,6 +7,7 @@ #include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/tab_contents/chrome_interstitial_page.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" @@ -95,7 +96,7 @@ class TestInterstitialPage : public ChromeInterstitialPage { void TestDomOperationResponse(const std::string& json_string) { DomOperationNotificationDetails details(json_string, 1); - Observe(NotificationType::DOM_OPERATION_RESPONSE, + Observe(chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, Source<RenderViewHost>(render_view_host()), Details<DomOperationNotificationDetails>(&details)); } diff --git a/chrome/browser/tab_contents/web_drag_source_win.cc b/chrome/browser/tab_contents/web_drag_source_win.cc index 9d35b45..d050f21 100644 --- a/chrome/browser/tab_contents/web_drag_source_win.cc +++ b/chrome/browser/tab_contents/web_drag_source_win.cc @@ -9,8 +9,8 @@ #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" using WebKit::WebDragOperationNone; @@ -36,9 +36,9 @@ WebDragSource::WebDragSource(gfx::NativeWindow source_wnd, source_wnd_(source_wnd), render_view_host_(tab_contents->render_view_host()), effect_(DROPEFFECT_NONE) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_SWAPPED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_SWAPPED, Source<TabContents>(tab_contents)); - registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED, Source<TabContents>(tab_contents)); } @@ -107,14 +107,14 @@ void WebDragSource::OnDragSourceMove() { screen.x(), screen.y()); } -void WebDragSource::Observe(NotificationType type, +void WebDragSource::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (NotificationType::TAB_CONTENTS_SWAPPED == type) { + if (content::NOTIFICATION_TAB_CONTENTS_SWAPPED == type) { // When the tab contents get swapped, our render view host goes away. // That's OK, we can continue the drag, we just can't send messages back to // our drag source. render_view_host_ = NULL; - } else if (NotificationType::TAB_CONTENTS_DISCONNECTED == type) { + } else if (content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED == type) { // This could be possible when we close the tab and the source is still // being used in DoDragDrop at the time that the virtual file is being // downloaded. diff --git a/chrome/browser/tab_contents/web_drag_source_win.h b/chrome/browser/tab_contents/web_drag_source_win.h index 471c8b9..0c6ebe07 100644 --- a/chrome/browser/tab_contents/web_drag_source_win.h +++ b/chrome/browser/tab_contents/web_drag_source_win.h @@ -28,7 +28,7 @@ class WebDragSource : public ui::DragSource, virtual ~WebDragSource(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/tabs/pinned_tab_service.cc b/chrome/browser/tabs/pinned_tab_service.cc index ac61609..d09f579 100644 --- a/chrome/browser/tabs/pinned_tab_service.cc +++ b/chrome/browser/tabs/pinned_tab_service.cc @@ -8,8 +8,8 @@ #include "chrome/browser/tabs/pinned_tab_codec.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" static bool IsLastNormalBrowser(Browser* browser) { for (BrowserList::const_iterator i = BrowserList::begin(); @@ -26,22 +26,22 @@ PinnedTabService::PinnedTabService(Profile* profile) : profile_(profile), got_exiting_(false), has_normal_browser_(false) { - registrar_.Add(this, NotificationType::BROWSER_OPENED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::BROWSER_CLOSING, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::APP_EXITING, + registrar_.Add(this, content::NOTIFICATION_APP_EXITING, NotificationService::AllSources()); } -void PinnedTabService::Observe(NotificationType type, +void PinnedTabService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (got_exiting_) return; - switch (type.value) { - case NotificationType::BROWSER_OPENED: { + switch (type) { + case chrome::NOTIFICATION_BROWSER_OPENED: { Browser* browser = Source<Browser>(source).ptr(); if (!has_normal_browser_ && browser->is_type_tabbed() && browser->profile() == profile_) { @@ -50,7 +50,7 @@ void PinnedTabService::Observe(NotificationType type, break; } - case NotificationType::BROWSER_CLOSING: { + case chrome::NOTIFICATION_BROWSER_CLOSING: { Browser* browser = Source<Browser>(source).ptr(); if (has_normal_browser_ && browser->profile() == profile_) { if (*(Details<bool>(details)).ptr()) { @@ -63,7 +63,7 @@ void PinnedTabService::Observe(NotificationType type, break; } - case NotificationType::APP_EXITING: { + case content::NOTIFICATION_APP_EXITING: { if (has_normal_browser_) GotExit(); break; diff --git a/chrome/browser/tabs/pinned_tab_service.h b/chrome/browser/tabs/pinned_tab_service.h index be802e9..41e997e 100644 --- a/chrome/browser/tabs/pinned_tab_service.h +++ b/chrome/browser/tabs/pinned_tab_service.h @@ -25,7 +25,7 @@ class PinnedTabService : public NotificationObserver, void GotExit(); // NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/tabs/tab_finder.cc b/chrome/browser/tabs/tab_finder.cc index 8e10d11..2f06211 100644 --- a/chrome/browser/tabs/tab_finder.cc +++ b/chrome/browser/tabs/tab_finder.cc @@ -16,9 +16,9 @@ #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_observer.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "content/common/page_transition_types.h" #include "content/common/view_messages.h" @@ -109,10 +109,10 @@ TabContents* TabFinder::FindTab(Browser* browser, return NULL; } -void TabFinder::Observe(NotificationType type, +void TabFinder::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(type.value, NotificationType::TAB_PARENTED); + DCHECK_EQ(type, content::NOTIFICATION_TAB_PARENTED); // The tab was added to a browser. Query for its state now. TabContentsWrapper* tab = Source<TabContentsWrapper>(source).ptr(); @@ -120,7 +120,7 @@ void TabFinder::Observe(NotificationType type, } TabFinder::TabFinder() { - registrar_.Add(this, NotificationType::TAB_PARENTED, + registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED, NotificationService::AllSources()); } diff --git a/chrome/browser/tabs/tab_finder.h b/chrome/browser/tabs/tab_finder.h index ca70702..7314edb 100644 --- a/chrome/browser/tabs/tab_finder.h +++ b/chrome/browser/tabs/tab_finder.h @@ -46,7 +46,7 @@ class TabFinder : public NotificationObserver { Browser** existing_browser); // NotificationObserver overrides: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 13c1b2e..29d459c 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -22,6 +22,7 @@ #include "chrome/browser/tabs/tab_strip_model_delegate.h" #include "chrome/browser/tabs/tab_strip_model_order_controller.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_process_host.h" @@ -66,10 +67,10 @@ TabStripModel::TabStripModel(TabStripModelDelegate* delegate, Profile* profile) order_controller_(NULL) { DCHECK(delegate_); registrar_.Add(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::EXTENSION_UNLOADED, + chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile_)); order_controller_ = new TabStripModelOrderController(this); } @@ -987,11 +988,11 @@ bool TabStripModel::WillContextMenuPin(int index) { /////////////////////////////////////////////////////////////////////////////// // TabStripModel, NotificationObserver implementation: -void TabStripModel::Observe(NotificationType type, +void TabStripModel::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::TAB_CONTENTS_DESTROYED: { + switch (type) { + case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: { // Sometimes, on qemu, it seems like a TabContents object can be destroyed // while we still have a reference to it. We need to break this reference // here so we don't crash later. @@ -1004,7 +1005,7 @@ void TabStripModel::Observe(NotificationType type, break; } - case NotificationType::EXTENSION_UNLOADED: { + case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* extension = Details<UnloadedExtensionInfo>(details)->extension; // Iterate backwards as we may remove items while iterating. diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h index 21270cd..6fb7d64 100644 --- a/chrome/browser/tabs/tab_strip_model.h +++ b/chrome/browser/tabs/tab_strip_model.h @@ -461,7 +461,7 @@ class TabStripModel : public NotificationObserver { bool WillContextMenuPin(int index); // Overridden from notificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc index fa49550..72234dd 100644 --- a/chrome/browser/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/tabs/tab_strip_model_unittest.cc @@ -52,11 +52,11 @@ class DeleteTabContentsOnDestroyedObserver : public NotificationObserver { : source_(source), tab_to_delete_(tab_to_delete) { registrar_.Add(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(source->tab_contents())); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { TabContentsWrapper* tab_to_delete = tab_to_delete_; diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc index 74a3cdd..0e7b9eb 100644 --- a/chrome/browser/task_manager/task_manager_browsertest.cc +++ b/chrome/browser/task_manager/task_manager_browsertest.cc @@ -22,6 +22,7 @@ #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" @@ -83,14 +84,14 @@ class ResourceChangeObserver : public TaskManagerModelObserver { class BackgroundContentsListener : public NotificationObserver { public: explicit BackgroundContentsListener(Profile* profile) { - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_NAVIGATED, + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, Source<Profile>(profile)); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Quit once the BackgroundContents has been loaded. - if (type.value == NotificationType::BACKGROUND_CONTENTS_NAVIGATED) + if (type == chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED) MessageLoopForUI::current()->Quit(); } private: diff --git a/chrome/browser/task_manager/task_manager_notification_resource_provider.cc b/chrome/browser/task_manager/task_manager_notification_resource_provider.cc index 457d8a2..d3dca39 100644 --- a/chrome/browser/task_manager/task_manager_notification_resource_provider.cc +++ b/chrome/browser/task_manager/task_manager_notification_resource_provider.cc @@ -10,6 +10,7 @@ #include "chrome/browser/notifications/balloon_collection.h" #include "chrome/browser/notifications/balloon_host.h" #include "chrome/browser/notifications/notification_ui_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/common/notification_service.h" @@ -103,9 +104,9 @@ void TaskManagerNotificationResourceProvider::StartUpdating() { } // Register for notifications about extension process changes. - registrar_.Add(this, NotificationType::NOTIFY_BALLOON_CONNECTED, + registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::NOTIFY_BALLOON_DISCONNECTED, + registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, NotificationService::AllSources()); } @@ -114,9 +115,9 @@ void TaskManagerNotificationResourceProvider::StopUpdating() { updating_ = false; // Unregister for notifications about extension process changes. - registrar_.Remove(this, NotificationType::NOTIFY_BALLOON_CONNECTED, + registrar_.Remove(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::NOTIFY_BALLOON_DISCONNECTED, + registrar_.Remove(this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, NotificationService::AllSources()); // Delete all the resources. @@ -125,14 +126,14 @@ void TaskManagerNotificationResourceProvider::StopUpdating() { } void TaskManagerNotificationResourceProvider::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::NOTIFY_BALLOON_CONNECTED: + switch (type) { + case chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED: AddToTaskManager(Source<BalloonHost>(source).ptr()); break; - case NotificationType::NOTIFY_BALLOON_DISCONNECTED: + case chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED: RemoveFromTaskManager(Source<BalloonHost>(source).ptr()); break; default: diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index a47b503..e122ce3 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -27,6 +27,7 @@ #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/render_messages.h" @@ -325,17 +326,17 @@ void TaskManagerTabContentsResourceProvider::StartUpdating() { Add(*iterator); // Then we register for notifications to get new tabs. - registrar_.Add(this, NotificationType::TAB_CONTENTS_CONNECTED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::TAB_CONTENTS_SWAPPED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_SWAPPED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED, NotificationService::AllSources()); // TAB_CONTENTS_DISCONNECTED should be enough to know when to remove a // resource. This is an attempt at mitigating a crasher that seem to // indicate a resource is still referencing a deleted TabContents // (http://crbug.com/7321). - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, NotificationService::AllSources()); } @@ -344,13 +345,13 @@ void TaskManagerTabContentsResourceProvider::StopUpdating() { updating_ = false; // Then we unregister for notifications to get new tabs. - registrar_.Remove(this, NotificationType::TAB_CONTENTS_CONNECTED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::TAB_CONTENTS_SWAPPED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_SWAPPED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DISCONNECTED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, NotificationService::AllSources()); // Delete all the resources. @@ -413,7 +414,7 @@ void TaskManagerTabContentsResourceProvider::Remove( delete resource; } -void TaskManagerTabContentsResourceProvider::Observe(NotificationType type, +void TaskManagerTabContentsResourceProvider::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { TabContentsWrapper* tab_contents = @@ -422,21 +423,21 @@ void TaskManagerTabContentsResourceProvider::Observe(NotificationType type, // A background page does not have a TabContentsWrapper. if (!tab_contents) return; - switch (type.value) { - case NotificationType::TAB_CONTENTS_CONNECTED: + switch (type) { + case content::NOTIFICATION_TAB_CONTENTS_CONNECTED: Add(tab_contents); break; - case NotificationType::TAB_CONTENTS_SWAPPED: + case content::NOTIFICATION_TAB_CONTENTS_SWAPPED: Remove(tab_contents); Add(tab_contents); break; - case NotificationType::TAB_CONTENTS_DESTROYED: + case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: // If this DCHECK is triggered, it could explain http://crbug.com/7321 . DCHECK(resources_.find(tab_contents) == resources_.end()) << "TAB_CONTENTS_DESTROYED with no associated " "TAB_CONTENTS_DISCONNECTED"; // Fall through. - case NotificationType::TAB_CONTENTS_DISCONNECTED: + case content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED: Remove(tab_contents); break; default: @@ -565,11 +566,11 @@ void TaskManagerBackgroundContentsResourceProvider::StartUpdating() { } // Then we register for notifications to get new BackgroundContents. - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_OPENED, + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_NAVIGATED, + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::BACKGROUND_CONTENTS_DELETED, + registrar_.Add(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, NotificationService::AllSources()); } @@ -578,11 +579,11 @@ void TaskManagerBackgroundContentsResourceProvider::StopUpdating() { updating_ = false; // Unregister for notifications - registrar_.Remove(this, NotificationType::BACKGROUND_CONTENTS_OPENED, + registrar_.Remove(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::BACKGROUND_CONTENTS_NAVIGATED, + registrar_.Remove(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::BACKGROUND_CONTENTS_DELETED, + registrar_.Remove(this, chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, NotificationService::AllSources()); // Delete all the resources. @@ -634,11 +635,11 @@ void TaskManagerBackgroundContentsResourceProvider::Remove( } void TaskManagerBackgroundContentsResourceProvider::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::BACKGROUND_CONTENTS_OPENED: { + switch (type) { + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED: { // Get the name from the parent application. If no parent application is // found, just pass an empty string - BackgroundContentsResource::GetTitle // will display the URL instead in this case. This should never happen @@ -663,7 +664,7 @@ void TaskManagerBackgroundContentsResourceProvider::Observe( task_manager_->ModelChanged(); break; } - case NotificationType::BACKGROUND_CONTENTS_NAVIGATED: { + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED: { BackgroundContents* contents = Details<BackgroundContents>(details).ptr(); // Should never get a NAVIGATED before OPENED. DCHECK(resources_.find(contents) != resources_.end()); @@ -674,7 +675,7 @@ void TaskManagerBackgroundContentsResourceProvider::Observe( Add(contents, application_name); break; } - case NotificationType::BACKGROUND_CONTENTS_DELETED: + case chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED: Remove(Details<BackgroundContents>(details).ptr()); // Closing a BackgroundContents needs to force the display to refresh // (applications may now be considered "foreground" that weren't before). @@ -849,9 +850,9 @@ void TaskManagerChildProcessResourceProvider::StartUpdating() { updating_ = true; // Register for notifications to get new child processes. - registrar_.Add(this, NotificationType::CHILD_PROCESS_HOST_CONNECTED, + registrar_.Add(this, content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::CHILD_PROCESS_HOST_DISCONNECTED, + registrar_.Add(this, content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED, NotificationService::AllSources()); // Get the existing child processes. @@ -867,10 +868,10 @@ void TaskManagerChildProcessResourceProvider::StopUpdating() { updating_ = false; // Unregister for notifications to get new plugin processes. - registrar_.Remove(this, NotificationType::CHILD_PROCESS_HOST_CONNECTED, + registrar_.Remove(this, content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED, NotificationService::AllSources()); registrar_.Remove(this, - NotificationType::CHILD_PROCESS_HOST_DISCONNECTED, + content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED, NotificationService::AllSources()); // Delete all the resources. @@ -882,14 +883,14 @@ void TaskManagerChildProcessResourceProvider::StopUpdating() { } void TaskManagerChildProcessResourceProvider::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::CHILD_PROCESS_HOST_CONNECTED: + switch (type) { + case content::NOTIFICATION_CHILD_PROCESS_HOST_CONNECTED: Add(*Details<ChildProcessInfo>(details).ptr()); break; - case NotificationType::CHILD_PROCESS_HOST_DISCONNECTED: + case content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED: Remove(*Details<ChildProcessInfo>(details).ptr()); break; default: @@ -1092,11 +1093,11 @@ void TaskManagerExtensionProcessResourceProvider::StartUpdating() { } // Register for notifications about extension process changes. - registrar_.Add(this, NotificationType::EXTENSION_PROCESS_CREATED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_PROCESS_TERMINATED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_HOST_DESTROYED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, NotificationService::AllSources()); } @@ -1105,11 +1106,11 @@ void TaskManagerExtensionProcessResourceProvider::StopUpdating() { updating_ = false; // Unregister for notifications about extension process changes. - registrar_.Remove(this, NotificationType::EXTENSION_PROCESS_CREATED, + registrar_.Remove(this, chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::EXTENSION_PROCESS_TERMINATED, + registrar_.Remove(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::EXTENSION_HOST_DESTROYED, + registrar_.Remove(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, NotificationService::AllSources()); // Delete all the resources. @@ -1120,15 +1121,15 @@ void TaskManagerExtensionProcessResourceProvider::StopUpdating() { } void TaskManagerExtensionProcessResourceProvider::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_PROCESS_CREATED: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_PROCESS_CREATED: AddToTaskManager(Details<ExtensionHost>(details).ptr()); break; - case NotificationType::EXTENSION_PROCESS_TERMINATED: - case NotificationType::EXTENSION_HOST_DESTROYED: + case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: + case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: RemoveFromTaskManager(Details<ExtensionHost>(details).ptr()); break; default: diff --git a/chrome/browser/task_manager/task_manager_resource_providers.h b/chrome/browser/task_manager/task_manager_resource_providers.h index a14498e..31f5737 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.h +++ b/chrome/browser/task_manager/task_manager_resource_providers.h @@ -122,7 +122,7 @@ class TaskManagerTabContentsResourceProvider virtual void StopUpdating(); // NotificationObserver method: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -191,7 +191,7 @@ class TaskManagerBackgroundContentsResourceProvider virtual void StopUpdating(); // NotificationObserver method: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -268,7 +268,7 @@ class TaskManagerChildProcessResourceProvider virtual void StopUpdating(); // NotificationObserver method: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -357,7 +357,7 @@ class TaskManagerExtensionProcessResourceProvider virtual void StopUpdating(); // NotificationObserver method: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -427,7 +427,7 @@ class TaskManagerNotificationResourceProvider virtual void StopUpdating(); // NotificationObserver interface - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index 6c301d3..6769b2e 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -11,10 +11,10 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/themes/browser_theme_pack.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/user_metrics.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "grit/ui_resources.h" @@ -215,7 +215,7 @@ void ThemeService::Init(Profile* profile) { // installed but not loaded (which may confuse listeners to // BROWSER_THEME_CHANGED). registrar_.Add(this, - NotificationType::EXTENSION_LOADED, + chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(profile_)); LoadThemePrefs(); @@ -602,7 +602,7 @@ void ThemeService::NotifyThemeChanged() { VLOG(1) << "Sending BROWSER_THEME_CHANGED"; // Redraw! NotificationService* service = NotificationService::current(); - service->Notify(NotificationType::BROWSER_THEME_CHANGED, + service->Notify(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(this), NotificationService::NoDetails()); #if defined(OS_MACOSX) @@ -616,10 +616,10 @@ void ThemeService::FreePlatformCaches() { } #endif -void ThemeService::Observe(NotificationType type, +void ThemeService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::EXTENSION_LOADED); + DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED); const Extension* extension = Details<const Extension>(details).ptr(); if (!extension->is_theme()) { return; diff --git a/chrome/browser/themes/theme_service.h b/chrome/browser/themes/theme_service.h index de9f59e..4b8a3ca 100644 --- a/chrome/browser/themes/theme_service.h +++ b/chrome/browser/themes/theme_service.h @@ -249,7 +249,7 @@ class ThemeService : public base::NonThreadSafe, Profile* profile() { return profile_; } // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index 5557378..0888ba5 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -26,6 +26,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" @@ -36,10 +37,10 @@ #include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/browser_resources.h" #include "net/base/escape.h" #include "net/url_request/url_request_status.h" @@ -247,11 +248,11 @@ bool TranslateManager::IsSupportedLanguage(const std::string& page_language) { return supported_languages_.Pointer()->count(page_language) != 0; } -void TranslateManager::Observe(NotificationType type, +void TranslateManager::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::NAV_ENTRY_COMMITTED: { + switch (type) { + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { NavigationController* controller = Source<NavigationController>(source).ptr(); content::LoadCommittedDetails* load_details = @@ -294,7 +295,7 @@ void TranslateManager::Observe(NotificationType type, helper->language_state().original_language())); break; } - case NotificationType::TAB_LANGUAGE_DETERMINED: { + case chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED: { TabContents* tab = Source<TabContents>(source).ptr(); // We may get this notifications multiple times. Make sure to translate // only once. @@ -314,7 +315,7 @@ void TranslateManager::Observe(NotificationType type, } break; } - case NotificationType::PAGE_TRANSLATED: { + case chrome::NOTIFICATION_PAGE_TRANSLATED: { // Only add translate infobar if it doesn't exist; if it already exists, // just update the state, the actual infobar would have received the same // notification and update the visual display accordingly. @@ -324,9 +325,10 @@ void TranslateManager::Observe(NotificationType type, PageTranslated(tab, page_translated_details); break; } - case NotificationType::PROFILE_DESTROYED: { + case chrome::NOTIFICATION_PROFILE_DESTROYED: { Profile* profile = Source<Profile>(source).ptr(); - notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Remove(this, + chrome::NOTIFICATION_PROFILE_DESTROYED, source); size_t count = accept_languages_.erase(profile->GetPrefs()); // We should know about this profile since we are listening for @@ -335,7 +337,7 @@ void TranslateManager::Observe(NotificationType type, pref_change_registrar_.Remove(prefs::kAcceptLanguages, this); break; } - case NotificationType::PREF_CHANGED: { + case chrome::NOTIFICATION_PREF_CHANGED: { DCHECK(*Details<std::string>(details).ptr() == prefs::kAcceptLanguages); PrefService* prefs = Source<PrefService>(source).ptr(); InitAcceptLanguages(prefs); @@ -425,11 +427,12 @@ bool TranslateManager::IsShowingTranslateInfobar(TabContents* tab) { TranslateManager::TranslateManager() : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), translate_script_expiration_delay_(kTranslateScriptExpirationDelayMS) { - notification_registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); - notification_registrar_.Add(this, NotificationType::TAB_LANGUAGE_DETERMINED, + notification_registrar_.Add(this, + chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, NotificationService::AllSources()); - notification_registrar_.Add(this, NotificationType::PAGE_TRANSLATED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PAGE_TRANSLATED, NotificationService::AllSources()); } @@ -660,7 +663,7 @@ bool TranslateManager::IsAcceptLanguage(TabContents* tab, InitAcceptLanguages(pref_service); // Listen for this profile going away, in which case we would need to clear // the accepted languages for the profile. - notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(tab->profile())); // Also start listening for changes in the accept languages. pref_change_registrar_.Add(prefs::kAcceptLanguages, this); diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h index e6a8f16..ab710f2 100644 --- a/chrome/browser/translate/translate_manager.h +++ b/chrome/browser/translate/translate_manager.h @@ -70,7 +70,7 @@ class TranslateManager : public NotificationObserver, void ClearTranslateScript() { translate_script_.clear(); } // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index 9f43086..5e9cf9e 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc @@ -19,6 +19,7 @@ #include "chrome/browser/translate/translate_prefs.h" #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "chrome/test/testing_browser_process.h" @@ -31,7 +32,6 @@ #include "content/common/notification_details.h" #include "content/common/notification_observer_mock.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" #include "content/common/test_url_fetcher_factory.h" #include "content/common/view_messages.h" #include "grit/generated_resources.h" @@ -138,10 +138,10 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness, return true; } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, type.value); + DCHECK_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, type); removed_infobars_.insert(Details<InfoBarRemovedDetails>(details)->first); } @@ -164,7 +164,7 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness, TabContentsWrapperTestHarness::SetUp(); notification_registrar_.Add(this, - NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, + chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, Source<TabContentsWrapper>(contents_wrapper())); } @@ -172,7 +172,7 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness, process()->sink().ClearMessages(); notification_registrar_.Remove(this, - NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, + chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, Source<TabContentsWrapper>(contents_wrapper())); TabContentsWrapperTestHarness::TearDown(); @@ -223,7 +223,7 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness, void SetPrefObserverExpectation(const char* path) { EXPECT_CALL( pref_observer_, - Observe(NotificationType(NotificationType::PREF_CHANGED), + Observe(int(chrome::NOTIFICATION_PREF_CHANGED), _, Property(&Details<std::string>::ptr, Pointee(path)))); } @@ -247,14 +247,14 @@ class TranslateManagerTest : public TabContentsWrapperTestHarness, class NavEntryCommittedObserver : public NotificationObserver { public: explicit NavEntryCommittedObserver(TabContents* tab_contents) { - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&tab_contents->controller())); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::NAV_ENTRY_COMMITTED); + DCHECK(type == content::NOTIFICATION_NAV_ENTRY_COMMITTED); details_ = *(Details<content::LoadCommittedDetails>(details).ptr()); } diff --git a/chrome/browser/translate/translate_tab_helper.cc b/chrome/browser/translate/translate_tab_helper.cc index dd162b4..efd82c3 100644 --- a/chrome/browser/translate/translate_tab_helper.cc +++ b/chrome/browser/translate/translate_tab_helper.cc @@ -5,6 +5,7 @@ #include "chrome/browser/translate/translate_tab_helper.h" #include "chrome/browser/translate/page_translated_details.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/render_messages.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" @@ -42,7 +43,7 @@ void TranslateTabHelper::OnLanguageDetermined(const std::string& language, std::string lang = language; NotificationService::current()->Notify( - NotificationType::TAB_LANGUAGE_DETERMINED, + chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, Source<TabContents>(tab_contents()), Details<std::string>(&lang)); } @@ -55,7 +56,7 @@ void TranslateTabHelper::OnPageTranslated(int32 page_id, language_state_.set_translation_pending(false); PageTranslatedDetails details(original_lang, translated_lang, error_type); NotificationService::current()->Notify( - NotificationType::PAGE_TRANSLATED, + chrome::NOTIFICATION_PAGE_TRANSLATED, Source<TabContents>(tab_contents()), Details<PageTranslatedDetails>(&details)); } diff --git a/chrome/browser/ui/app_modal_dialogs/app_modal_dialog.cc b/chrome/browser/ui/app_modal_dialogs/app_modal_dialog.cc index 9c54657..54c09d0 100644 --- a/chrome/browser/ui/app_modal_dialogs/app_modal_dialog.cc +++ b/chrome/browser/ui/app_modal_dialogs/app_modal_dialog.cc @@ -6,10 +6,10 @@ #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/javascript_dialogs.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" AppModalDialog::AppModalDialog(content::DialogDelegate* delegate, const string16& title) @@ -29,7 +29,7 @@ void AppModalDialog::ShowModalDialog() { CreateAndShowDialog(); NotificationService::current()->Notify( - NotificationType::APP_MODAL_DIALOG_SHOWN, + chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, Source<AppModalDialog>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc index 2e25d03..c7c6d72 100644 --- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc +++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.cc @@ -10,6 +10,7 @@ #include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/webui/chrome_web_ui.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" @@ -25,9 +26,9 @@ BookmarkTabHelper::BookmarkTabHelper(TabContentsWrapper* tab_contents) delegate_(NULL), bookmark_drag_(NULL) { // Register for notifications about URL starredness changing on any profile. - registrar_.Add(this, NotificationType::URLS_STARRED, + registrar_.Add(this, chrome::NOTIFICATION_URLS_STARRED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, NotificationService::AllSources()); } @@ -61,13 +62,13 @@ void BookmarkTabHelper::DidNavigateMainFramePostCommit( UpdateStarredStateForCurrentURL(); } -void BookmarkTabHelper::Observe(NotificationType type, +void BookmarkTabHelper::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::BOOKMARK_MODEL_LOADED: + switch (type) { + case chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED: // BookmarkModel finished loading, fall through to update starred state. - case NotificationType::URLS_STARRED: { + case chrome::NOTIFICATION_URLS_STARRED: { // Somewhere, a URL has been starred. // Ignore notifications for profiles other than our current one. Profile* source_profile = Source<Profile>(source).ptr(); diff --git a/chrome/browser/ui/bookmarks/bookmark_tab_helper.h b/chrome/browser/ui/bookmarks/bookmark_tab_helper.h index 0814236..53d45d8 100644 --- a/chrome/browser/ui/bookmarks/bookmark_tab_helper.h +++ b/chrome/browser/ui/bookmarks/bookmark_tab_helper.h @@ -48,7 +48,7 @@ class BookmarkTabHelper : public NotificationObserver, const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; // NotificationObserver overrides: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index c5385b7..6da0b09 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -99,6 +99,7 @@ #include "chrome/browser/upgrade_detector.h" #include "chrome/browser/web_applications/web_app.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" @@ -250,28 +251,29 @@ Browser::Browser(Type type, Profile* profile) tab_restore_service_delegate_( new BrowserTabRestoreServiceDelegate(this))), bookmark_bar_state_(BookmarkBar::HIDDEN) { - registrar_.Add(this, NotificationType::SSL_VISIBLE_STATE_CHANGED, + registrar_.Add(this, content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UNINSTALLED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_PROCESS_TERMINATED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, NotificationService::AllSources()); registrar_.Add( - this, NotificationType::BROWSER_THEME_CHANGED, + this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(ThemeServiceFactory::GetForProfile(profile_))); - registrar_.Add(this, NotificationType::TAB_CONTENT_SETTINGS_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, + registrar_.Add(this, + chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, NotificationService::AllSources()); // Need to know when to alert the user of theme install delay. - registrar_.Add(this, NotificationType::EXTENSION_READY_FOR_INSTALL, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_READY_FOR_INSTALL, NotificationService::AllSources()); PrefService* local_state = g_browser_process->local_state(); @@ -467,7 +469,7 @@ void Browser::InitBrowserWindow() { #endif NotificationService::current()->Notify( - NotificationType::BROWSER_WINDOW_READY, + chrome::NOTIFICATION_BROWSER_WINDOW_READY, Source<Browser>(this), NotificationService::NoDetails()); @@ -1001,7 +1003,7 @@ void Browser::OnWindowClosing() { // TODO(sky): convert session/tab restore to use notification. NotificationService::current()->Notify( - NotificationType::BROWSER_CLOSING, + chrome::NOTIFICATION_BROWSER_CLOSING, Source<Browser>(this), Details<bool>(&exiting)); @@ -2852,10 +2854,10 @@ void Browser::TabInsertedAt(TabContentsWrapper* contents, // If the tab crashes in the beforeunload or unload handler, it won't be // able to ack. But we know we can close it. - registrar_.Add(this, NotificationType::TAB_CONTENTS_DISCONNECTED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED, Source<TabContents>(contents->tab_contents())); - registrar_.Add(this, NotificationType::INTERSTITIAL_ATTACHED, + registrar_.Add(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED, Source<TabContents>(contents->tab_contents())); } @@ -2863,7 +2865,7 @@ void Browser::TabClosingAt(TabStripModel* tab_strip_model, TabContentsWrapper* contents, int index) { NotificationService::current()->Notify( - NotificationType::TAB_CLOSING, + content::NOTIFICATION_TAB_CLOSING, Source<NavigationController>(&contents->controller()), NotificationService::NoDetails()); @@ -3092,7 +3094,7 @@ void Browser::AddNewContents(TabContents* source, if (source) { NotificationService::current()->Notify( - NotificationType::TAB_ADDED, + content::NOTIFICATION_TAB_ADDED, Source<TabContentsDelegate>(source->delegate()), Details<TabContents>(source)); } @@ -3232,7 +3234,7 @@ void Browser::TabContentsFocused(TabContents* tab_content) { bool Browser::TakeFocus(bool reverse) { NotificationService::current()->Notify( - NotificationType::FOCUS_RETURNED_TO_BROWSER, + chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, Source<Browser>(this), NotificationService::NoDetails()); return false; @@ -3534,11 +3536,11 @@ void Browser::FileSelected(const FilePath& path, int index, void* params) { /////////////////////////////////////////////////////////////////////////////// // Browser, NotificationObserver implementation: -void Browser::Observe(NotificationType type, +void Browser::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::TAB_CONTENTS_DISCONNECTED: + switch (type) { + case content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED: if (is_attempting_to_close_browser_) { // Pass in false so that we delay processing. We need to delay the // processing as it may close the tab, which is currently on the call @@ -3547,7 +3549,7 @@ void Browser::Observe(NotificationType type, } break; - case NotificationType::SSL_VISIBLE_STATE_CHANGED: + case content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED: // When the current tab's SSL state changes, we need to update the URL // bar to reflect the new state. Note that it's possible for the selected // tab contents to be NULL. This is because we listen for all sources @@ -3560,7 +3562,7 @@ void Browser::Observe(NotificationType type, UpdateToolbar(false); break; - case NotificationType::EXTENSION_UPDATE_DISABLED: { + case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: { // Show the UI if the extension was disabled for escalated permissions. Profile* profile = Source<Profile>(source).ptr(); if (profile_->IsSameProfile(profile)) { @@ -3574,7 +3576,7 @@ void Browser::Observe(NotificationType type, break; } - case NotificationType::EXTENSION_UNLOADED: { + case chrome::NOTIFICATION_EXTENSION_UNLOADED: { if (window()->GetLocationBar()) window()->GetLocationBar()->UpdatePageActions(); @@ -3593,23 +3595,23 @@ void Browser::Observe(NotificationType type, break; } - case NotificationType::EXTENSION_PROCESS_TERMINATED: { + case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { if (window()->GetLocationBar()) window()->GetLocationBar()->InvalidatePageActions(); break; } - case NotificationType::EXTENSION_UNINSTALLED: - case NotificationType::EXTENSION_LOADED: + case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: + case chrome::NOTIFICATION_EXTENSION_LOADED: if (window()->GetLocationBar()) window()->GetLocationBar()->UpdatePageActions(); break; - case NotificationType::BROWSER_THEME_CHANGED: + case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: window()->UserChangedTheme(); break; - case NotificationType::EXTENSION_READY_FOR_INSTALL: { + case chrome::NOTIFICATION_EXTENSION_READY_FOR_INSTALL: { // Handle EXTENSION_READY_FOR_INSTALL for last active tabbed browser. if (BrowserList::FindTabbedBrowser(profile(), true) != this) break; @@ -3624,7 +3626,7 @@ void Browser::Observe(NotificationType type, break; } - case NotificationType::PREF_CHANGED: { + case chrome::NOTIFICATION_PREF_CHANGED: { const std::string& pref_name = *Details<std::string>(details).ptr(); if (pref_name == prefs::kUseVerticalTabs) { UseVerticalTabsChanged(); @@ -3661,7 +3663,7 @@ void Browser::Observe(NotificationType type, break; } - case NotificationType::TAB_CONTENT_SETTINGS_CHANGED: { + case chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED: { TabContents* tab_contents = Source<TabContents>(source).ptr(); if (tab_contents == GetSelectedTabContents()) { LocationBar* location_bar = window()->GetLocationBar(); @@ -3671,11 +3673,11 @@ void Browser::Observe(NotificationType type, break; } - case NotificationType::INTERSTITIAL_ATTACHED: + case content::NOTIFICATION_INTERSTITIAL_ATTACHED: UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); break; - case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: + case chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE); break; @@ -4546,9 +4548,9 @@ void Browser::TabDetachedAtImpl(TabContentsWrapper* contents, int index, ClearUnloadState(contents->tab_contents(), false); } - registrar_.Remove(this, NotificationType::INTERSTITIAL_ATTACHED, + registrar_.Remove(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED, Source<TabContents>(contents->tab_contents())); - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DISCONNECTED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED, Source<TabContents>(contents->tab_contents())); } diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 492751a..5f3cc81 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -908,7 +908,7 @@ class Browser : public TabHandlerDelegate, virtual void FileSelected(const FilePath& path, int index, void* params); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc index 361b66b..48a5d1b 100644 --- a/chrome/browser/ui/browser_list.cc +++ b/chrome/browser/ui/browser_list.cc @@ -15,6 +15,7 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/tab_contents/navigation_details.h" @@ -42,17 +43,17 @@ namespace { class BrowserActivityObserver : public NotificationObserver { public: BrowserActivityObserver() { - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); } ~BrowserActivityObserver() {} private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::NAV_ENTRY_COMMITTED); + DCHECK(type == content::NOTIFICATION_NAV_ENTRY_COMMITTED); const content::LoadCommittedDetails& load = *Details<content::LoadCommittedDetails>(details).ptr(); if (!load.is_navigation_to_different_page()) @@ -242,7 +243,7 @@ void BrowserList::AddBrowser(Browser* browser) { activity_observer = new BrowserActivityObserver; NotificationService::current()->Notify( - NotificationType::BROWSER_OPENED, + chrome::NOTIFICATION_BROWSER_OPENED, Source<Browser>(browser), NotificationService::NoDetails()); @@ -263,7 +264,7 @@ void BrowserList::MarkAsCleanShutdown() { void BrowserList::AttemptExitInternal() { NotificationService::current()->Notify( - NotificationType::APP_EXITING, + content::NOTIFICATION_APP_EXITING, NotificationService::AllSources(), NotificationService::NoDetails()); @@ -286,9 +287,10 @@ void BrowserList::NotifyAndTerminate(bool fast_path) { #endif if (fast_path) { - NotificationService::current()->Notify(NotificationType::APP_TERMINATING, - NotificationService::AllSources(), - NotificationService::NoDetails()); + NotificationService::current()->Notify( + content::NOTIFICATION_APP_TERMINATING, + NotificationService::AllSources(), + NotificationService::NoDetails()); } #if defined(OS_CHROMEOS) @@ -319,7 +321,7 @@ void BrowserList::RemoveBrowser(Browser* browser) { // TODO(andybons): Fix the UI tests to Do The Right Thing. bool closing_last_browser = (browsers_.size() == 1); NotificationService::current()->Notify( - NotificationType::BROWSER_CLOSED, + chrome::NOTIFICATION_BROWSER_CLOSED, Source<Browser>(browser), Details<bool>(&closing_last_browser)); RemoveBrowserFrom(browser, &browsers_); @@ -350,9 +352,10 @@ void BrowserList::RemoveBrowser(Browser* browser) { // to call ProfileManager::ShutdownSessionServices() as part of the // shutdown, because Browser::WindowClosing() already makes sure that the // SessionService is created and notified. - NotificationService::current()->Notify(NotificationType::APP_TERMINATING, - NotificationService::AllSources(), - NotificationService::NoDetails()); + NotificationService::current()->Notify( + content::NOTIFICATION_APP_TERMINATING, + NotificationService::AllSources(), + NotificationService::NoDetails()); AllBrowsersClosedAndAppExiting(); } } @@ -513,7 +516,7 @@ void BrowserList::SessionEnding() { browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION); NotificationService::current()->Notify( - NotificationType::APP_EXITING, + content::NOTIFICATION_APP_EXITING, NotificationService::AllSources(), NotificationService::NoDetails()); @@ -525,7 +528,7 @@ void BrowserList::SessionEnding() { // Send out notification. This is used during testing so that the test harness // can properly shutdown before we exit. NotificationService::current()->Notify( - NotificationType::SESSION_END, + chrome::NOTIFICATION_SESSION_END, NotificationService::AllSources(), NotificationService::NoDetails()); diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index 21c3315..4f9e897 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc @@ -72,11 +72,11 @@ void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) { EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL()); } -void BrowserNavigatorTest::Observe(NotificationType type, +void BrowserNavigatorTest::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: { + switch (type) { + case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { ++this->created_tab_contents_count_; break; } @@ -111,7 +111,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { NotificationRegistrar registrar; // As the registrar object goes out of scope, this will get unregistered - registrar.Add(this, NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, + registrar.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, NotificationService::AllSources()); browser()->AddSelectedTabWithURL(singleton_url1, PageTransition::LINK); diff --git a/chrome/browser/ui/browser_navigator_browsertest.h b/chrome/browser/ui/browser_navigator_browsertest.h index 31e480b..4a35639 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.h +++ b/chrome/browser/ui/browser_navigator_browsertest.h @@ -7,7 +7,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/test/in_process_browser_test.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" class GURL; class NotificationDetails; @@ -38,7 +38,7 @@ class BrowserNavigatorTest : public InProcessBrowserTest, void RunSuppressTest(WindowOpenDisposition disposition); // NotificationObserver: - virtual void Observe(NotificationType type, const NotificationSource& source, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); size_t created_tab_contents_count_; diff --git a/chrome/browser/ui/cocoa/base_bubble_controller.mm b/chrome/browser/ui/cocoa/base_bubble_controller.mm index 7b1f247..73c5911 100644 --- a/chrome/browser/ui/cocoa/base_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/base_bubble_controller.mm @@ -9,10 +9,10 @@ #include "base/memory/scoped_nsobject.h" #include "base/string_util.h" #import "chrome/browser/ui/cocoa/info_bubble_view.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -27,12 +27,12 @@ namespace BaseBubbleControllerInternal { class Bridge : public NotificationObserver { public: explicit Bridge(BaseBubbleController* controller) : controller_(controller) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_HIDDEN, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_HIDDEN, NotificationService::AllSources()); } // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { [controller_ close]; diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm index 6797dfb..724283c 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm @@ -26,7 +26,7 @@ class BookmarkBubbleNotificationBridge : public NotificationObserver { BookmarkBubbleNotificationBridge(BookmarkBubbleController* controller, SEL selector); virtual ~BookmarkBubbleNotificationBridge() {} - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: @@ -40,16 +40,16 @@ BookmarkBubbleNotificationBridge::BookmarkBubbleNotificationBridge( : controller_(controller), selector_(selector) { // registrar_ will automatically RemoveAll() when destroyed so we // don't need to do so explicitly. - registrar_.Add(this, NotificationType::TAB_CONTENTS_CONNECTED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::TAB_CLOSED, + registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, NotificationService::AllSources()); } // At this time all notifications instigate the same behavior (go // away) so we don't bother checking which notification came in. void BookmarkBubbleNotificationBridge::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { [controller_ performSelector:selector_ withObject:controller_]; diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller_unittest.mm index 263a441..73e574c 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller_unittest.mm @@ -475,7 +475,7 @@ TEST_F(BookmarkBubbleControllerTest, BubbleGoesAwayOnNewTab) { // we fake the notification that would be triggered by a tab // creation. See TabContents::NotifyConnected(). NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_CONNECTED, + content::NOTIFICATION_TAB_CONTENTS_CONNECTED, Source<TabContents>(NULL), NotificationService::NoDetails()); diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h index 7de0b9f..c9b34f7 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.h +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h @@ -115,7 +115,7 @@ class BrowserWindowCocoa : public BrowserWindow, const gfx::Rect& bounds); // Overridden from NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index 8f3cc61..f9cd26f 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -35,6 +35,7 @@ #import "chrome/browser/ui/cocoa/theme_install_bubble_view.h" #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/native_web_keyboard_event.h" @@ -51,9 +52,10 @@ BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, controller_(controller), confirm_close_factory_(browser) { // This pref applies to all windows, so all must watch for it. - registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, + registrar_.Add(this, + chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::SIDEBAR_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_SIDEBAR_CHANGED, NotificationService::AllSources()); } @@ -583,16 +585,16 @@ WindowOpenDisposition BrowserWindowCocoa::GetDispositionForPopupBounds( return NEW_POPUP; } -void BrowserWindowCocoa::Observe(NotificationType type, +void BrowserWindowCocoa::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { + switch (type) { // Only the key window gets a direct toggle from the menu. // Other windows hear about it from the notification. - case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: + case chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: [controller_ updateBookmarkBarVisibilityWithAnimation:YES]; break; - case NotificationType::SIDEBAR_CHANGED: + case chrome::NOTIFICATION_SIDEBAR_CHANGED: UpdateSidebarForContents( Details<SidebarContainer>(details)->tab_contents()); break; diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm b/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm index a68af29..3348a5b 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm @@ -10,7 +10,7 @@ #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" #include "chrome/browser/ui/cocoa/browser_window_controller.h" #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" -#include "content/common/notification_type.h" +#include "chrome/common/chrome_notification_types.h" #include "testing/gtest/include/gtest/gtest.h" // A BrowserWindowCocoa that goes PONG when @@ -25,10 +25,10 @@ class BrowserWindowCocoaPong : public BrowserWindowCocoa { } virtual ~BrowserWindowCocoaPong() { } - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED) + if (type == chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED) pong_ = true; BrowserWindowCocoa::Observe(type, source, details); } diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h index eda63ae..3151800 100644 --- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h +++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h @@ -33,7 +33,7 @@ class CollectedCookiesMac : public ConstrainedWindowMacDelegateCustomSheet, virtual ~CollectedCookiesMac(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm index 9412aae..b9490e2 100644 --- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm +++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm @@ -15,6 +15,7 @@ #import "chrome/browser/ui/cocoa/vertical_gradient_view.h" #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -84,7 +85,7 @@ CollectedCookiesMac::CollectedCookiesMac(NSWindow* parent, TabSpecificContentSettings* content_settings = TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> content_settings(); - registrar_.Add(this, NotificationType::COLLECTED_COOKIES_SHOWN, + registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, Source<TabSpecificContentSettings>(content_settings)); sheet_controller_ = [[CollectedCookiesWindowController alloc] @@ -107,10 +108,10 @@ void CollectedCookiesMac::DeleteDelegate() { delete this; } -void CollectedCookiesMac::Observe(NotificationType type, +void CollectedCookiesMac::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::COLLECTED_COOKIES_SHOWN); + DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); window_->CloseConstrainedWindow(); } diff --git a/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm b/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm index 0165cf5..9404e4b 100644 --- a/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm +++ b/chrome/browser/ui/cocoa/download/download_started_animation_mac.mm @@ -51,16 +51,16 @@ class DownloadAnimationTabObserver : public NotificationObserver { : owner_(owner), tab_contents_(tab_contents) { registrar_.Add(this, - NotificationType::TAB_CONTENTS_HIDDEN, + content::NOTIFICATION_TAB_CONTENTS_HIDDEN, Source<TabContents>(tab_contents_)); registrar_.Add(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_)); } // Runs when a tab is hidden or destroyed. Let our owner know we should end // the animation. - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // This ends up deleting us. diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm index 19b4dcb..f72a087 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm @@ -12,13 +12,13 @@ #include "chrome/browser/extensions/image_loading_tracker.h" #include "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" #import "chrome/browser/ui/cocoa/image_utils.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_resource.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "skia/ext/skia_utils_mac.h" #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" #include "ui/gfx/canvas_skia_paint.h" @@ -58,7 +58,7 @@ class ExtensionImageTrackerBridge : public NotificationObserver, Extension::kBrowserActionIconMaxSize), ImageLoadingTracker::DONT_CACHE); } - registrar_.Add(this, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, Source<ExtensionAction>(extension->browser_action())); } @@ -73,10 +73,10 @@ class ExtensionImageTrackerBridge : public NotificationObserver, } // Overridden from NotificationObserver. - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::EXTENSION_BROWSER_ACTION_UPDATED) + if (type == chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED) [owner_ updateState]; else NOTREACHED(); diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm index 342c59c..7aedd03 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm @@ -22,6 +22,7 @@ #import "chrome/browser/ui/cocoa/image_button_cell.h" #import "chrome/browser/ui/cocoa/menu_button.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/tab_contents.h" @@ -183,16 +184,16 @@ class ExtensionServiceObserverBridge : public NotificationObserver, public: ExtensionServiceObserverBridge(BrowserActionsController* owner, Profile* profile) : owner_(owner) { - registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(profile)); } // Overridden from NotificationObserver. - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { + switch (type) { + case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { ExtensionPopupController* popup = [ExtensionPopupController popup]; if (popup && ![popup isClosing]) [popup close]; diff --git a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm index 9168ff9..01c8378 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm @@ -20,6 +20,7 @@ #include "chrome/browser/ui/cocoa/info_bubble_view.h" #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_constants.h" @@ -28,7 +29,6 @@ #include "content/common/notification_details.h" #include "content/common/notification_observer.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -77,10 +77,10 @@ class DevmodeObserver : public NotificationObserver { } virtual ~DevmodeObserver() {} - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) + if (type == chrome::NOTIFICATION_PREF_CHANGED) [menu_ updateInspectorItem]; else NOTREACHED(); @@ -98,17 +98,17 @@ class ProfileObserverBridge : public NotificationObserver { const Profile* profile) : owner_(owner), profile_(profile) { - registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile)); } ~ProfileObserverBridge() {} // Overridden from NotificationObserver - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PROFILE_DESTROYED && + if (type == chrome::NOTIFICATION_PROFILE_DESTROYED && source == Source<Profile>(profile_)) { [owner_ invalidateProfile]; } diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm index 01016804..6099ccf 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm @@ -17,6 +17,7 @@ #include "chrome/browser/ui/cocoa/info_bubble_view.h" #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "content/common/notification_details.h" @@ -35,26 +36,26 @@ class ExtensionLoadedNotificationObserver : public NotificationObserver { ExtensionLoadedNotificationObserver( ExtensionInstalledBubbleController* controller, Profile* profile) : controller_(controller) { - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(profile)); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(profile)); } private: // NotificationObserver implementation. Tells the controller to start showing // its window on the main thread when the extension has finished loading. - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::EXTENSION_LOADED) { + if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { const Extension* extension = Details<const Extension>(details).ptr(); if (extension == [controller_ extension]) { [controller_ performSelectorOnMainThread:@selector(showWindow:) withObject:controller_ waitUntilDone:NO]; } - } else if (type == NotificationType::EXTENSION_UNLOADED) { + } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { const Extension* extension = Details<const Extension>(details).ptr(); if (extension == [controller_ extension]) { [controller_ performSelectorOnMainThread:@selector(extensionUnloaded:) diff --git a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm index 65fda6a..17899e5 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm @@ -13,6 +13,7 @@ #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" #import "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" #import "chrome/browser/ui/cocoa/info_bubble_window.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/debugger/devtools_window.h" #include "content/common/notification_details.h" #include "content/common/notification_registrar.h" @@ -38,16 +39,16 @@ class DevtoolsNotificationBridge : public NotificationObserver { explicit DevtoolsNotificationBridge(ExtensionPopupController* controller) : controller_(controller) {} - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: { + switch (type) { + case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { if (Details<ExtensionHost>([controller_ extensionHost]) == details) [controller_ showDevTools]; break; } - case NotificationType::DEVTOOLS_WINDOW_CLOSING: { + case content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING: { RenderViewHost* rvh = [controller_ extensionHost]->render_view_host(); if (Details<RenderViewHost>(rvh) == details) // Allow the devtools to finish detaching before we close the popup @@ -131,10 +132,10 @@ class DevtoolsNotificationBridge : public NotificationObserver { notificationBridge_.reset(new DevtoolsNotificationBridge(self)); registrar_.reset(new NotificationRegistrar); registrar_->Add(notificationBridge_.get(), - NotificationType::DEVTOOLS_WINDOW_CLOSING, + chrome::DEVTOOLS_WINDOW_CLOSING, Source<Profile>(host->profile())); registrar_->Add(notificationBridge_.get(), - NotificationType::EXTENSION_HOST_DID_STOP_LOADING, + chrome::EXTENSION_HOST_DID_STOP_LOADING, Source<Profile>(host->profile())); } return self; diff --git a/chrome/browser/ui/cocoa/history_menu_bridge.h b/chrome/browser/ui/cocoa/history_menu_bridge.h index e11768c..f0ae1bd 100644 --- a/chrome/browser/ui/cocoa/history_menu_bridge.h +++ b/chrome/browser/ui/cocoa/history_menu_bridge.h @@ -126,7 +126,7 @@ class HistoryMenuBridge : public NotificationObserver, virtual ~HistoryMenuBridge(); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/cocoa/history_menu_bridge.mm b/chrome/browser/ui/cocoa/history_menu_bridge.mm index 80798b6..f3c5490 100644 --- a/chrome/browser/ui/cocoa/history_menu_bridge.mm +++ b/chrome/browser/ui/cocoa/history_menu_bridge.mm @@ -16,6 +16,7 @@ #include "chrome/browser/sessions/session_types.h" #include "chrome/browser/sessions/tab_restore_service_factory.h" #import "chrome/browser/ui/cocoa/history_menu_cocoa_controller.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" @@ -103,7 +104,7 @@ HistoryMenuBridge::HistoryMenuBridge(Profile* profile) // The service is not ready for use yet, so become notified when it does. if (!history_service_) { registrar_.Add( - this, NotificationType::HISTORY_LOADED, Source<Profile>(profile_)); + this, chrome::NOTIFICATION_HISTORY_LOADED, Source<Profile>(profile_)); } } @@ -114,12 +115,13 @@ HistoryMenuBridge::~HistoryMenuBridge() { // Unregister ourselves as observers and notifications. if (history_service_) { const NotificationSource& src = NotificationService::AllSources(); - registrar_.Remove(this, NotificationType::HISTORY_TYPED_URLS_MODIFIED, src); - registrar_.Remove(this, NotificationType::HISTORY_URL_VISITED, src); - registrar_.Remove(this, NotificationType::HISTORY_URLS_DELETED, src); + registrar_.Remove(this, chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, + src); + registrar_.Remove(this, chrome::NOTIFICATION_HISTORY_URL_VISITED, src); + registrar_.Remove(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, src); } else { registrar_.Remove( - this, NotificationType::HISTORY_LOADED, Source<Profile>(profile_)); + this, chrome::NOTIFICATION_HISTORY_LOADED, Source<Profile>(profile_)); } if (tab_restore_service_) @@ -134,12 +136,12 @@ HistoryMenuBridge::~HistoryMenuBridge() { } } -void HistoryMenuBridge::Observe(NotificationType type, +void HistoryMenuBridge::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // A history service is now ready. Check to see if it's the one for the main // profile. If so, perform final initialization. - if (type == NotificationType::HISTORY_LOADED) { + if (type == chrome::NOTIFICATION_HISTORY_LOADED) { HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); if (hs != NULL && hs->BackendLoaded()) { @@ -148,7 +150,7 @@ void HistoryMenuBridge::Observe(NotificationType type, // Found our HistoryService, so stop listening for this notification. registrar_.Remove(this, - NotificationType::HISTORY_LOADED, + chrome::NOTIFICATION_HISTORY_LOADED, Source<Profile>(profile_)); } } @@ -363,9 +365,10 @@ NSMenuItem* HistoryMenuBridge::AddItemToMenu(HistoryItem* item, void HistoryMenuBridge::Init() { const NotificationSource& source = NotificationService::AllSources(); - registrar_.Add(this, NotificationType::HISTORY_TYPED_URLS_MODIFIED, source); - registrar_.Add(this, NotificationType::HISTORY_URL_VISITED, source); - registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, source); + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, + source); + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URL_VISITED, source); + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, source); } void HistoryMenuBridge::CreateMenu() { diff --git a/chrome/browser/ui/cocoa/info_bubble_window.mm b/chrome/browser/ui/cocoa/info_bubble_window.mm index dd28438..6c83bc3 100644 --- a/chrome/browser/ui/cocoa/info_bubble_window.mm +++ b/chrome/browser/ui/cocoa/info_bubble_window.mm @@ -7,10 +7,10 @@ #include "base/basictypes.h" #include "base/logging.h" #include "base/memory/scoped_nsobject.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" namespace { @@ -33,16 +33,16 @@ const NSTimeInterval kMinimumTimeInterval = class AppNotificationBridge : public NotificationObserver { public: explicit AppNotificationBridge(InfoBubbleWindow* owner) : owner_(owner) { - registrar_.Add(this, NotificationType::APP_TERMINATING, + registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, NotificationService::AllSources()); } // Overridden from NotificationObserver. - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::APP_TERMINATING: + switch (type) { + case chrome::NOTIFICATION_APP_TERMINATING: [owner_ appIsTerminating]; break; default: diff --git a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm index 3660bca..5c73468 100644 --- a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm +++ b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm @@ -11,6 +11,7 @@ #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" #import "chrome/browser/ui/cocoa/view_id_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" #include "skia/ext/skia_utils_mac.h" @@ -25,18 +26,18 @@ class InfoBarNotificationObserver : public NotificationObserver { private: // NotificationObserver implementation - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { TabContentsWrapper* tab_contents = Source<TabContentsWrapper>(source).ptr(); - switch (type.value) { - case NotificationType::TAB_CONTENTS_INFOBAR_ADDED: + switch (type) { + case chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED: [controller_ addInfoBar:Details<InfoBarAddedDetails>(details)-> CreateInfoBar(tab_contents) animate:YES]; break; - case NotificationType::TAB_CONTENTS_INFOBAR_REMOVED: { + case chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED: { InfoBarRemovedDetails* removed_details = Details<InfoBarRemovedDetails>(details).ptr(); [controller_ @@ -45,7 +46,7 @@ class InfoBarNotificationObserver : public NotificationObserver { break; } - case NotificationType::TAB_CONTENTS_INFOBAR_REPLACED: { + case chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED: { InfoBarReplacedDetails* replaced_details = Details<InfoBarReplacedDetails>(details).ptr(); [controller_ closeInfoBarsForDelegate:replaced_details->first @@ -138,11 +139,11 @@ class InfoBarNotificationObserver : public NotificationObserver { Source<TabContentsWrapper> source(currentTabContents_); registrar_.Add(infoBarObserver_.get(), - NotificationType::TAB_CONTENTS_INFOBAR_ADDED, source); + chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, source); registrar_.Add(infoBarObserver_.get(), - NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, source); + chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, source); registrar_.Add(infoBarObserver_.get(), - NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, source); + chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, source); } [self positionInfoBarsAndRedraw]; diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h index 46e9aa1..e922e1d 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h @@ -147,7 +147,7 @@ class LocationBarViewMac : public AutocompleteEditController, // Overridden from NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index 1721aef..23d887a 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -41,6 +41,7 @@ #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" #include "chrome/browser/ui/content_settings/content_setting_image_model.h" #include "chrome/browser/ui/omnibox/location_bar_util.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_resource.h" @@ -100,7 +101,7 @@ LocationBarViewMac::LocationBarViewMac( } registrar_.Add(this, - NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, NotificationService::AllSources()); edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, @@ -181,7 +182,7 @@ void LocationBarViewMac::UpdatePageActions() { Layout(); if (page_action_decorations_.size() != count_before) { NotificationService::current()->Notify( - NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, Source<LocationBar>(this), NotificationService::NoDetails()); } @@ -193,7 +194,7 @@ void LocationBarViewMac::InvalidatePageActions() { Layout(); if (page_action_decorations_.size() != count_before) { NotificationService::current()->Notify( - NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, Source<LocationBar>(this), NotificationService::NoDetails()); } @@ -474,11 +475,11 @@ NSImage* LocationBarViewMac::GetKeywordImage(const string16& keyword) { return OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH); } -void LocationBarViewMac::Observe(NotificationType type, +void LocationBarViewMac::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { + switch (type) { + case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { TabContents* contents = GetTabContents(); if (Details<TabContents>(contents) != details) return; @@ -488,7 +489,7 @@ void LocationBarViewMac::Observe(NotificationType type, break; } - case NotificationType::PREF_CHANGED: + case chrome::NOTIFICATION_PREF_CHANGED: star_decoration_->SetVisible(IsStarEnabled()); OnChanged(); break; diff --git a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.h b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.h index bc91bb7..39bb38c 100644 --- a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.h +++ b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.h @@ -59,7 +59,7 @@ class PageActionDecoration : public ImageDecoration, private: // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm index 3c11dec..22a86e4 100644 --- a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm @@ -13,6 +13,7 @@ #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_resource.h" #include "content/browser/tab_contents/tab_contents.h" @@ -58,7 +59,7 @@ PageActionDecoration::PageActionDecoration( ImageLoadingTracker::DONT_CACHE); } - registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(profile_)); // We set the owner last of all so that we can determine whether we are in @@ -185,7 +186,7 @@ void PageActionDecoration::UpdateVisibility(TabContents* contents, if (IsVisible() != visible) { SetVisible(visible); NotificationService::current()->Notify( - NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, Source<ExtensionAction>(page_action_), Details<TabContents>(contents)); } @@ -239,11 +240,11 @@ NSMenu* PageActionDecoration::GetMenu() { } void PageActionDecoration::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { + switch (type) { + case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { ExtensionPopupController* popup = [ExtensionPopupController popup]; if (popup && ![popup isClosing]) [popup close]; diff --git a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm index caea8af..3b59fb9 100644 --- a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm +++ b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm @@ -9,11 +9,11 @@ #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" @interface TabContentsController(Private) // Forwards frame update to |delegate_| (ResizeNotificationView calls it). @@ -31,7 +31,7 @@ class TabContentsNotificationBridge : public NotificationObserver { explicit TabContentsNotificationBridge(TabContentsController* controller); // Overriden from NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); // Register for |contents|'s notifications, remove all prior registrations. @@ -47,10 +47,10 @@ TabContentsNotificationBridge::TabContentsNotificationBridge( } void TabContentsNotificationBridge::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::RENDER_VIEW_HOST_CHANGED) { + if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) { RenderViewHostSwitchedDetails* switched_details = Details<RenderViewHostSwitchedDetails>(details).ptr(); [controller_ tabContentsRenderViewHostChanged:switched_details->old_host @@ -64,7 +64,7 @@ void TabContentsNotificationBridge::ChangeTabContents(TabContents* contents) { registrar_.RemoveAll(); if (contents) { registrar_.Add(this, - NotificationType::RENDER_VIEW_HOST_CHANGED, + content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, Source<NavigationController>(&contents->controller())); } } diff --git a/chrome/browser/ui/cocoa/theme_install_bubble_view.h b/chrome/browser/ui/cocoa/theme_install_bubble_view.h index f901e3b..83f2cc2 100644 --- a/chrome/browser/ui/cocoa/theme_install_bubble_view.h +++ b/chrome/browser/ui/cocoa/theme_install_bubble_view.h @@ -30,7 +30,7 @@ class ThemeInstallBubbleView : public NotificationObserver { virtual ~ThemeInstallBubbleView(); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/cocoa/theme_install_bubble_view.mm b/chrome/browser/ui/cocoa/theme_install_bubble_view.mm index 753f3c6..0048a27 100644 --- a/chrome/browser/ui/cocoa/theme_install_bubble_view.mm +++ b/chrome/browser/ui/cocoa/theme_install_bubble_view.mm @@ -7,6 +7,7 @@ #import "chrome/browser/ui/cocoa/theme_install_bubble_view.h" #include "base/memory/scoped_nsobject.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -62,27 +63,27 @@ ThemeInstallBubbleView::ThemeInstallBubbleView(NSWindow* window) // Close when theme has been installed. registrar_.Add( this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); // Close when we are installing an extension, not a theme. registrar_.Add( this, - NotificationType::NO_THEME_DETECTED, + chrome::NOTIFICATION_NO_THEME_DETECTED, NotificationService::AllSources()); registrar_.Add( this, - NotificationType::EXTENSION_INSTALLED, + chrome::NOTIFICATION_EXTENSION_INSTALLED, NotificationService::AllSources()); registrar_.Add( this, - NotificationType::EXTENSION_INSTALL_ERROR, + chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); // Don't let the bubble overlap the confirm dialog. registrar_.Add( this, - NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, NotificationService::AllSources()); // Add the view. @@ -112,7 +113,7 @@ void ThemeInstallBubbleView::Close() { } } -void ThemeInstallBubbleView::Observe(NotificationType type, +void ThemeInstallBubbleView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { Close(); diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm index 8a68fe7..7044bcc 100644 --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm @@ -44,12 +44,12 @@ #include "chrome/browser/ui/toolbar/toolbar_model.h" #include "chrome/browser/ui/toolbar/wrench_menu_model.h" #include "chrome/browser/upgrade_detector.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_details.h" #include "content/common/notification_observer.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -123,19 +123,19 @@ class NotificationBridge : public NotificationObserver { public: explicit NotificationBridge(ToolbarController* controller) : controller_(controller) { - registrar_.Add(this, NotificationType::UPGRADE_RECOMMENDED, + registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, NotificationService::AllSources()); } // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PREF_CHANGED: + switch (type) { + case chrome::NOTIFICATION_PREF_CHANGED: [controller_ prefChanged:Details<std::string>(details).ptr()]; break; - case NotificationType::UPGRADE_RECOMMENDED: + case chrome::NOTIFICATION_UPGRADE_RECOMMENDED: [controller_ badgeWrenchMenuIfNeeded]; break; default: diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm index 7eeff81..c50e077 100644 --- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm +++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm @@ -14,10 +14,10 @@ #import "chrome/browser/ui/cocoa/wrench_menu/menu_tracked_root_view.h" #include "chrome/browser/ui/toolbar/wrench_menu_model.h" #include "content/browser/user_metrics.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -35,14 +35,14 @@ class ZoomLevelObserver : public NotificationObserver { public: explicit ZoomLevelObserver(WrenchMenuController* controller) : controller_(controller) { - registrar_.Add(this, NotificationType::ZOOM_LEVEL_CHANGED, + registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, NotificationService::AllSources()); } - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(type.value, NotificationType::ZOOM_LEVEL_CHANGED); + DCHECK_EQ(type, content::NOTIFICATION_ZOOM_LEVEL_CHANGED); WrenchMenuModel* wrenchMenuModel = [controller_ wrenchMenuModel]; wrenchMenuModel->UpdateZoomControls(); const string16 level = diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc index cb3c179..3c51731 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc @@ -17,6 +17,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "content/browser/renderer_host/render_view_host.h" @@ -327,7 +328,7 @@ class ContentSettingCookiesBubbleModel : public ContentSettingSingleRadioGroup { if (!tab_contents()) return; NotificationService::current()->Notify( - NotificationType::COLLECTED_COOKIES_SHOWN, + chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, Source<TabSpecificContentSettings>(tab_contents()->content_settings()), NotificationService::NoDetails()); browser()->ShowCollectedCookiesDialog(tab_contents()->tab_contents()); @@ -506,9 +507,9 @@ ContentSettingBubbleModel::ContentSettingBubbleModel( : tab_contents_(tab_contents), profile_(profile), content_type_(content_type) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents->tab_contents())); - registrar_.Add(this, NotificationType::PROFILE_DESTROYED, + registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(profile_)); } @@ -535,15 +536,15 @@ void ContentSettingBubbleModel::AddBlockedResource( bubble_content_.resource_identifiers.insert(resource_identifier); } -void ContentSettingBubbleModel::Observe(NotificationType type, +void ContentSettingBubbleModel::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::TAB_CONTENTS_DESTROYED: + switch (type) { + case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: DCHECK(source == Source<TabContents>(tab_contents_->tab_contents())); tab_contents_ = NULL; break; - case NotificationType::PROFILE_DESTROYED: + case chrome::NOTIFICATION_PROFILE_DESTROYED: DCHECK(source == Source<Profile>(profile_)); profile_ = NULL; break; diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.h b/chrome/browser/ui/content_settings/content_setting_bubble_model.h index 2e50a04..ba99a0e 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.h +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.h @@ -81,7 +81,7 @@ class ContentSettingBubbleModel : public NotificationObserver { const BubbleContent& bubble_content() const { return bubble_content_; } // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/find_bar/find_bar_controller.cc b/chrome/browser/ui/find_bar/find_bar_controller.cc index d63d688..db414f7 100644 --- a/chrome/browser/ui/find_bar/find_bar_controller.cc +++ b/chrome/browser/ui/find_bar/find_bar_controller.cc @@ -12,6 +12,7 @@ #include "chrome/browser/ui/find_bar/find_bar_state.h" #include "chrome/browser/ui/find_bar/find_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/common/notification_details.h" @@ -84,9 +85,9 @@ void FindBarController::ChangeTabContents(TabContentsWrapper* contents) { if (!tab_contents_) return; - registrar_.Add(this, NotificationType::FIND_RESULT_AVAILABLE, + registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, Source<TabContents>(tab_contents_->tab_contents())); - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&tab_contents_->controller())); MaybeSetPrepopulateText(); @@ -106,11 +107,11 @@ void FindBarController::ChangeTabContents(TabContentsWrapper* contents) { //////////////////////////////////////////////////////////////////////////////// // FindBarHost, NotificationObserver implementation: -void FindBarController::Observe(NotificationType type, +void FindBarController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { FindTabHelper* find_tab_helper = tab_contents_->find_tab_helper(); - if (type == NotificationType::FIND_RESULT_AVAILABLE) { + if (type == chrome::NOTIFICATION_FIND_RESULT_AVAILABLE) { // Don't update for notifications from TabContentses other than the one we // are actively tracking. if (Source<TabContents>(source).ptr() == tab_contents_->tab_contents()) { @@ -123,7 +124,7 @@ void FindBarController::Observe(NotificationType type, find_bar_->AudibleAlert(); } } - } else if (type == NotificationType::NAV_ENTRY_COMMITTED) { + } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { NavigationController* source_controller = Source<NavigationController>(source).ptr(); if (source_controller == &tab_contents_->controller()) { diff --git a/chrome/browser/ui/find_bar/find_bar_controller.h b/chrome/browser/ui/find_bar/find_bar_controller.h index 98aee9d..6a8e01b 100644 --- a/chrome/browser/ui/find_bar/find_bar_controller.h +++ b/chrome/browser/ui/find_bar/find_bar_controller.h @@ -46,7 +46,7 @@ class FindBarController : public NotificationObserver { void ChangeTabContents(TabContentsWrapper* contents); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/find_bar/find_tab_helper.cc b/chrome/browser/ui/find_bar/find_tab_helper.cc index 9b66bd9..f51d77e 100644 --- a/chrome/browser/ui/find_bar/find_tab_helper.cc +++ b/chrome/browser/ui/find_bar/find_tab_helper.cc @@ -10,6 +10,7 @@ #include "chrome/browser/ui/find_bar/find_bar_state.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "content/common/view_messages.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" @@ -153,7 +154,7 @@ void FindTabHelper::OnFindReply(int request_id, request_id, number_of_matches, selection, active_match_ordinal, final_update); NotificationService::current()->Notify( - NotificationType::FIND_RESULT_AVAILABLE, + chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, Source<TabContents>(tab_contents()), Details<FindNotificationDetails>(&last_search_result_)); } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc index a0902d9..b4ba446 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc @@ -33,6 +33,7 @@ #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" #include "chrome/browser/ui/gtk/tabstrip_origin_provider.h" #include "chrome/browser/ui/gtk/view_id_util.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/tab_contents.h" @@ -156,7 +157,7 @@ BookmarkBarGtk::BookmarkBarGtk(BrowserWindowGtk* window, SetBookmarkBarState(BookmarkBar::SHOW, BookmarkBar::DONT_ANIMATE_STATE_CHANGE); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, @@ -929,10 +930,10 @@ void BookmarkBarGtk::BookmarkNodeChildrenReordered(BookmarkModel* model, CreateAllBookmarkButtons(); } -void BookmarkBarGtk::Observe(NotificationType type, +void BookmarkBarGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::BROWSER_THEME_CHANGED) { + if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { if (model_ && model_->IsLoaded()) { // Regenerate the bookmark bar with all new objects with their theme // properties set correctly for the new theme. @@ -954,7 +955,7 @@ void BookmarkBarGtk::Observe(NotificationType type, } SetOverflowButtonAppearance(); - } else if (type == NotificationType::PREF_CHANGED) { + } else if (type == chrome::NOTIFICATION_PREF_CHANGED) { const std::string& pref_name = *Details<std::string>(details).ptr(); if (pref_name == prefs::kEditBookmarksEnabled) OnEditBookmarksEnabledChanged(); diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h index 8ae89bd..7d0562b 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h @@ -233,7 +233,7 @@ class BookmarkBarGtk : public ui::AnimationDelegate, const BookmarkNode* node) OVERRIDE; // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc index b8dc6e9..fc070ec 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.cc @@ -9,6 +9,7 @@ #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -47,15 +48,15 @@ BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate, G_CALLBACK(gtk_util::InitLabelSizeRequestAndEllipsizeMode), NULL); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); } -void BookmarkBarInstructionsGtk::Observe(NotificationType type, +void BookmarkBarInstructionsGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::BROWSER_THEME_CHANGED) + if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) UpdateColors(); } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h index 509e8fd..3e075a8 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h @@ -34,7 +34,7 @@ class BookmarkBarInstructionsGtk : public NotificationObserver { private: // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc index a41f5ae..856a550 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.cc @@ -19,6 +19,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/user_metrics.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -52,15 +53,15 @@ void BookmarkBubbleGtk::BubbleClosing(BubbleGtk* bubble, } NotificationService::current()->Notify( - NotificationType::BOOKMARK_BUBBLE_HIDDEN, + chrome::BOOKMARK_BUBBLE_HIDDEN, Source<Profile>(profile_->GetOriginalProfile()), NotificationService::NoDetails()); } -void BookmarkBubbleGtk::Observe(NotificationType type, +void BookmarkBubbleGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); if (theme_service_->UsingNativeTheme()) { for (std::vector<GtkWidget*>::iterator it = labels_.begin(); @@ -181,7 +182,7 @@ BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWidget* anchor, g_signal_connect(remove_button_, "clicked", G_CALLBACK(&OnRemoveClickedThunk), this); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h index a563828..13971e5 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h @@ -46,7 +46,7 @@ class BookmarkBubbleGtk : public BubbleDelegateGtk, virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc index e1b0577..c5ad9bd 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc @@ -26,6 +26,7 @@ #include "chrome/browser/ui/gtk/menu_gtk.h" #include "chrome/browser/ui/gtk/view_id_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_resource.h" @@ -33,7 +34,6 @@ #include "content/common/notification_details.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "grit/ui_resources.h" @@ -129,7 +129,7 @@ class BrowserActionButton : public NotificationObserver, signals_.ConnectAfter(widget(), "expose-event", G_CALLBACK(OnExposeEvent), this); - registrar_.Add(this, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, Source<ExtensionAction>(extension->browser_action())); } @@ -150,10 +150,10 @@ class BrowserActionButton : public NotificationObserver, const Extension* extension() { return extension_; } // NotificationObserver implementation. - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::EXTENSION_BROWSER_ACTION_UPDATED) + if (type == chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED) UpdateState(); else NOTREACHED(); @@ -449,7 +449,7 @@ BrowserActionsToolbarGtk::BrowserActionsToolbarGtk(Browser* browser) ViewIDUtil::SetID(button_hbox_.get(), VIEW_ID_BROWSER_ACTION_TOOLBAR); registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); theme_service_->InitThemesFor(this); } @@ -476,10 +476,10 @@ void BrowserActionsToolbarGtk::Update() { } } -void BrowserActionsToolbarGtk::Observe(NotificationType type, +void BrowserActionsToolbarGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(NotificationType::BROWSER_THEME_CHANGED == type); + DCHECK(chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type); gtk_widget_set_visible(separator_, theme_service_->UsingNativeTheme()); } diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h index f49e18d..2b720cb 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h @@ -61,7 +61,7 @@ class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer, void Update(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc index b3c1d43..7c87a8d 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.cc +++ b/chrome/browser/ui/gtk/browser_titlebar.cc @@ -35,6 +35,7 @@ #include "chrome/browser/ui/gtk/unity_service.h" #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" #include "chrome/browser/ui/toolbar/wrench_menu_model.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/tab_contents.h" @@ -403,7 +404,7 @@ void BrowserTitlebar::Init() { // color. theme_service_ = GtkThemeService::GetFrom( browser_window_->browser()->profile()); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); UpdateTitleAndIcon(); @@ -942,15 +943,15 @@ bool BrowserTitlebar::GetAcceleratorForCommandId( return accelerator_gtk; } -void BrowserTitlebar::Observe(NotificationType type, +void BrowserTitlebar::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::BROWSER_THEME_CHANGED: + switch (type) { + case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: UpdateTextColor(); break; - case NotificationType::PREF_CHANGED: { + case chrome::NOTIFICATION_PREF_CHANGED: { std::string* name = Details<std::string>(details).ptr(); if (prefs::kGoogleServicesUsername == *name) profile_button_->UpdateText(); diff --git a/chrome/browser/ui/gtk/browser_titlebar.h b/chrome/browser/ui/gtk/browser_titlebar.h index 7485d0c..7030e21 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.h +++ b/chrome/browser/ui/gtk/browser_titlebar.h @@ -161,7 +161,7 @@ class BrowserTitlebar : public NotificationObserver, ui::Accelerator* accelerator); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc index 71fadf1..d1ac0cc 100644 --- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc @@ -36,13 +36,13 @@ #include "chrome/browser/ui/gtk/view_id_util.h" #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" #include "chrome/browser/upgrade_detector.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/user_metrics.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -97,10 +97,10 @@ BrowserToolbarGtk::BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window) browser_->command_updater()->AddCommandObserver(IDC_BOOKMARK_PAGE, this); registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::UPGRADE_RECOMMENDED, + chrome::NOTIFICATION_UPGRADE_RECOMMENDED, NotificationService::AllSources()); } @@ -222,7 +222,7 @@ void BrowserToolbarGtk::Init(Profile* profile, gtk_box_pack_start(GTK_BOX(toolbar_), wrench_box, FALSE, FALSE, 4); wrench_menu_.reset(new MenuGtk(this, &wrench_menu_model_)); - registrar_.Add(this, NotificationType::ZOOM_LEVEL_CHANGED, + registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, Source<HostZoomMap>(browser_->profile()->GetHostZoomMap())); if (ShouldOnlyShowLocation()) { @@ -346,12 +346,12 @@ bool BrowserToolbarGtk::GetAcceleratorForCommandId( // NotificationObserver -------------------------------------------------------- -void BrowserToolbarGtk::Observe(NotificationType type, +void BrowserToolbarGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { NotifyPrefChanged(Details<std::string>(details).ptr()); - } else if (type == NotificationType::BROWSER_THEME_CHANGED) { + } else if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { // Update the spacing around the menu buttons bool use_gtk = theme_service_->UsingNativeTheme(); int border = use_gtk ? 0 : 2; @@ -384,10 +384,10 @@ void BrowserToolbarGtk::Observe(NotificationType type, } UpdateRoundedness(); - } else if (type == NotificationType::UPGRADE_RECOMMENDED) { + } else if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { // Redraw the wrench menu to update the badge. gtk_widget_queue_draw(wrench_menu_button_->widget()); - } else if (type == NotificationType::ZOOM_LEVEL_CHANGED) { + } else if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) { // If our zoom level changed, we need to tell the menu to update its state, // since the menu could still be open. wrench_menu_->UpdateMenu(); diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.h b/chrome/browser/ui/gtk/browser_toolbar_gtk.h index 33e7c84..090ef6a 100644 --- a/chrome/browser/ui/gtk/browser_toolbar_gtk.h +++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.h @@ -97,7 +97,7 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver, ui::Accelerator* accelerator); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index a3d5fec..2d6c9f4 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -75,6 +75,7 @@ #include "chrome/browser/ui/webui/bug_report_ui.h" #include "chrome/browser/ui/window_sizer.h" #include "chrome/browser/web_applications/web_app.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/debugger/devtools_window.h" @@ -1161,11 +1162,11 @@ void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() { new DownloadInProgressDialogGtk(browser()); } -void BrowserWindowGtk::Observe(NotificationType type, +void BrowserWindowGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PREF_CHANGED: { + switch (type) { + case chrome::NOTIFICATION_PREF_CHANGED: { std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kUseCustomChromeFrame) { UpdateCustomFrame(); @@ -1508,7 +1509,7 @@ bool BrowserWindowGtk::CanClose() const { // Empty TabStripModel, it's now safe to allow the Window to be closed. NotificationService::current()->Notify( - NotificationType::WINDOW_CLOSED, + chrome::NOTIFICATION_WINDOW_CLOSED, Source<GtkWindow>(window_), NotificationService::NoDetails()); return true; diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h index a686695..c04f9d4 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.h +++ b/chrome/browser/ui/gtk/browser_window_gtk.h @@ -137,7 +137,7 @@ class BrowserWindowGtk : public BrowserWindow, const gfx::Rect& bounds); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/bubble/bubble_gtk.cc b/chrome/browser/ui/gtk/bubble/bubble_gtk.cc index e962568..cc096a7 100644 --- a/chrome/browser/ui/gtk/bubble/bubble_gtk.cc +++ b/chrome/browser/ui/gtk/bubble/bubble_gtk.cc @@ -10,6 +10,7 @@ #include "chrome/browser/ui/gtk/bubble/bubble_accelerators_gtk.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "ui/base/gtk/gtk_windowing.h" #include "ui/gfx/gtk_util.h" @@ -179,7 +180,7 @@ void BubbleGtk::Init(GtkWidget* anchor_widget, GrabPointerAndKeyboard(); } - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); } @@ -343,10 +344,10 @@ void BubbleGtk::StackWindow() { ui::StackPopupWindow(window_, GTK_WIDGET(toplevel_window_)); } -void BubbleGtk::Observe(NotificationType type, +void BubbleGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(type.value, NotificationType::BROWSER_THEME_CHANGED); + DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_THEME_CHANGED); if (theme_service_->UsingNativeTheme() && match_system_theme_) { gtk_widget_modify_bg(window_, GTK_STATE_NORMAL, NULL); } else { diff --git a/chrome/browser/ui/gtk/bubble/bubble_gtk.h b/chrome/browser/ui/gtk/bubble/bubble_gtk.h index dc7c5a5..b11b45f 100644 --- a/chrome/browser/ui/gtk/bubble/bubble_gtk.h +++ b/chrome/browser/ui/gtk/bubble/bubble_gtk.h @@ -77,7 +77,7 @@ class BubbleGtk : public NotificationObserver { void Close(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/gtk/collected_cookies_gtk.cc b/chrome/browser/ui/gtk/collected_cookies_gtk.cc index 38d993c..15a4e86 100644 --- a/chrome/browser/ui/gtk/collected_cookies_gtk.cc +++ b/chrome/browser/ui/gtk/collected_cookies_gtk.cc @@ -14,6 +14,7 @@ #include "chrome/browser/ui/gtk/gtk_chrome_cookie_view.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_source.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -82,7 +83,7 @@ CollectedCookiesGtk::CollectedCookiesGtk(GtkWindow* parent, TabSpecificContentSettings* content_settings = TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> content_settings(); - registrar_.Add(this, NotificationType::COLLECTED_COOKIES_SHOWN, + registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, Source<TabSpecificContentSettings>(content_settings)); Init(); @@ -420,10 +421,10 @@ void CollectedCookiesGtk::EnableControls() { enable_for_blocked_cookies); } -void CollectedCookiesGtk::Observe(NotificationType type, +void CollectedCookiesGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::COLLECTED_COOKIES_SHOWN); + DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); window_->CloseConstrainedWindow(); } diff --git a/chrome/browser/ui/gtk/collected_cookies_gtk.h b/chrome/browser/ui/gtk/collected_cookies_gtk.h index 974e668..612c629 100644 --- a/chrome/browser/ui/gtk/collected_cookies_gtk.h +++ b/chrome/browser/ui/gtk/collected_cookies_gtk.h @@ -55,7 +55,7 @@ class CollectedCookiesGtk : public ConstrainedDialogDelegate, ContentSetting setting); // Notification Observer implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc b/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc index 0b94783..1018b41 100644 --- a/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/content_setting_bubble_gtk.cc @@ -18,8 +18,8 @@ #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/common/content_settings.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/ui_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -58,7 +58,7 @@ ContentSettingBubbleGtk::ContentSettingBubbleGtk( delegate_(delegate), content_setting_bubble_model_(content_setting_bubble_model), bubble_(NULL) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents)); BuildBubble(); } @@ -77,10 +77,10 @@ void ContentSettingBubbleGtk::BubbleClosing(BubbleGtk* bubble, delete this; } -void ContentSettingBubbleGtk::Observe(NotificationType type, +void ContentSettingBubbleGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); + DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); DCHECK(source == Source<TabContents>(tab_contents_)); tab_contents_ = NULL; } diff --git a/chrome/browser/ui/gtk/content_setting_bubble_gtk.h b/chrome/browser/ui/gtk/content_setting_bubble_gtk.h index e8b8f19..edad286 100644 --- a/chrome/browser/ui/gtk/content_setting_bubble_gtk.h +++ b/chrome/browser/ui/gtk/content_setting_bubble_gtk.h @@ -44,7 +44,7 @@ class ContentSettingBubbleGtk : public BubbleDelegateGtk, virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/custom_button.cc b/chrome/browser/ui/gtk/custom_button.cc index 9cd2d98..a92abc5 100644 --- a/chrome/browser/ui/gtk/custom_button.cc +++ b/chrome/browser/ui/gtk/custom_button.cc @@ -9,6 +9,7 @@ #include "chrome/browser/ui/gtk/gtk_chrome_button.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/theme_resources_standard.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -39,7 +40,7 @@ CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeService* theme_provider, theme_provider->InitThemesFor(this); registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); } else { // Load the button images from the resource bundle. @@ -140,10 +141,10 @@ void CustomDrawButtonBase::SetBackground(SkColor color, } } -void CustomDrawButtonBase::Observe(NotificationType type, +void CustomDrawButtonBase::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(theme_service_); - DCHECK(NotificationType::BROWSER_THEME_CHANGED == type); + DCHECK(chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type); surfaces_[GTK_STATE_NORMAL]->UsePixbuf(normal_id_ ? theme_service_->GetRTLEnabledPixbufNamed(normal_id_) : NULL); @@ -244,7 +245,7 @@ CustomDrawButton::CustomDrawButton(GtkThemeService* theme_provider, theme_service_->InitThemesFor(this); registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); } @@ -262,7 +263,7 @@ CustomDrawButton::CustomDrawButton(GtkThemeService* theme_provider, theme_service_->InitThemesFor(this); registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); } @@ -279,9 +280,9 @@ void CustomDrawButton::Init() { hover_controller_.Init(widget()); } -void CustomDrawButton::Observe(NotificationType type, +void CustomDrawButton::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(NotificationType::BROWSER_THEME_CHANGED == type); + DCHECK(chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type); SetBrowserTheme(); } diff --git a/chrome/browser/ui/gtk/custom_button.h b/chrome/browser/ui/gtk/custom_button.h index 6bb3c1f..82e1442 100644 --- a/chrome/browser/ui/gtk/custom_button.h +++ b/chrome/browser/ui/gtk/custom_button.h @@ -57,7 +57,7 @@ class CustomDrawButtonBase : public NotificationObserver { void SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask); // Provide NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -185,7 +185,7 @@ class CustomDrawButton : public NotificationObserver { void SetBackground(SkColor color, SkBitmap* image, SkBitmap* mask); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/download/download_item_gtk.cc b/chrome/browser/ui/gtk/download/download_item_gtk.cc index e189c93..d0cbcff 100644 --- a/chrome/browser/ui/gtk/download/download_item_gtk.cc +++ b/chrome/browser/ui/gtk/download/download_item_gtk.cc @@ -22,6 +22,7 @@ #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/nine_box.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -242,7 +243,7 @@ DownloadItemGtk::DownloadItemGtk(DownloadShelfGtk* parent_shelf, gtk_widget_show_all(dangerous_prompt_); } - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); theme_service_->InitThemesFor(this); @@ -367,10 +368,10 @@ void DownloadItemGtk::AnimationProgressed(const ui::Animation* animation) { } } -void DownloadItemGtk::Observe(NotificationType type, +void DownloadItemGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::BROWSER_THEME_CHANGED) { + if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { // Our GtkArrow is only visible in gtk mode. Otherwise, we let the custom // rendering code do whatever it wants. if (theme_service_->UsingNativeTheme()) { diff --git a/chrome/browser/ui/gtk/download/download_item_gtk.h b/chrome/browser/ui/gtk/download/download_item_gtk.h index d66fce6..624eddf 100644 --- a/chrome/browser/ui/gtk/download/download_item_gtk.h +++ b/chrome/browser/ui/gtk/download/download_item_gtk.h @@ -55,7 +55,7 @@ class DownloadItemGtk : public DownloadItem::Observer, virtual void AnimationProgressed(const ui::Animation* animation); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/download/download_shelf_gtk.cc b/chrome/browser/ui/gtk/download/download_shelf_gtk.cc index ef8e8d0..9c9986f 100644 --- a/chrome/browser/ui/gtk/download/download_shelf_gtk.cc +++ b/chrome/browser/ui/gtk/download/download_shelf_gtk.cc @@ -17,6 +17,7 @@ #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -142,7 +143,7 @@ DownloadShelfGtk::DownloadShelfGtk(Browser* browser, GtkWidget* parent) false, true, this)); theme_service_->InitThemesFor(this); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); gtk_widget_show_all(shelf_.get()); @@ -220,10 +221,10 @@ void DownloadShelfGtk::Closed() { } } -void DownloadShelfGtk::Observe(NotificationType type, +void DownloadShelfGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::BROWSER_THEME_CHANGED) { + if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { GdkColor color = theme_service_->GetGdkColor( ThemeService::COLOR_TOOLBAR); gtk_widget_modify_bg(padding_bg_, GTK_STATE_NORMAL, &color); diff --git a/chrome/browser/ui/gtk/download/download_shelf_gtk.h b/chrome/browser/ui/gtk/download/download_shelf_gtk.h index a8e39fd..fd777a9 100644 --- a/chrome/browser/ui/gtk/download/download_shelf_gtk.h +++ b/chrome/browser/ui/gtk/download/download_shelf_gtk.h @@ -52,7 +52,7 @@ class DownloadShelfGtk : public DownloadShelf, virtual void Closed(); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/download/download_started_animation_gtk.cc b/chrome/browser/ui/gtk/download/download_started_animation_gtk.cc index c69ed6b..51e9abf 100644 --- a/chrome/browser/ui/gtk/download/download_started_animation_gtk.cc +++ b/chrome/browser/ui/gtk/download/download_started_animation_gtk.cc @@ -49,7 +49,7 @@ class DownloadStartedAnimationGtk : public ui::LinearAnimation, virtual void AnimateToState(double state); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -98,11 +98,11 @@ DownloadStartedAnimationGtk::DownloadStartedAnimationGtk( registrar_.Add( this, - NotificationType::TAB_CONTENTS_HIDDEN, + content::NOTIFICATION_TAB_CONTENTS_HIDDEN, Source<TabContents>(tab_contents_)); registrar_.Add( this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_)); // TODO(estade): don't show up on the wrong virtual desktop. @@ -150,11 +150,11 @@ void DownloadStartedAnimationGtk::Close() { registrar_.Remove( this, - NotificationType::TAB_CONTENTS_HIDDEN, + content::NOTIFICATION_TAB_CONTENTS_HIDDEN, Source<TabContents>(tab_contents_)); registrar_.Remove( this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_)); tab_contents_ = NULL; @@ -180,7 +180,7 @@ void DownloadStartedAnimationGtk::AnimateToState(double state) { } } -void DownloadStartedAnimationGtk::Observe(NotificationType type, +void DownloadStartedAnimationGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { Close(); diff --git a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc index 767e4a8..7f6800e 100644 --- a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc @@ -19,9 +19,9 @@ #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -89,25 +89,25 @@ ExtensionInstalledBubbleGtk::ExtensionInstalledBubbleGtk( // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we // be sure that a browser action or page action has had views created which we // can inspect for the purpose of pointing to them. - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(browser->profile())); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(browser->profile())); } ExtensionInstalledBubbleGtk::~ExtensionInstalledBubbleGtk() {} -void ExtensionInstalledBubbleGtk::Observe(NotificationType type, +void ExtensionInstalledBubbleGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::EXTENSION_LOADED) { + if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { const Extension* extension = Details<const Extension>(details).ptr(); if (extension == extension_) { // PostTask to ourself to allow all EXTENSION_LOADED Observers to run. MessageLoopForUI::current()->PostTask(FROM_HERE, NewRunnableMethod(this, &ExtensionInstalledBubbleGtk::ShowInternal)); } - } else if (type == NotificationType::EXTENSION_UNLOADED) { + } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { const Extension* extension = Details<UnloadedExtensionInfo>(details)->extension; if (extension == extension_) diff --git a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h index fa943be..1a06242 100644 --- a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h +++ b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h @@ -64,7 +64,7 @@ class ExtensionInstalledBubbleGtk void ShowInternal(); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc index 276df4a..556f3eb 100644 --- a/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc +++ b/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc @@ -18,6 +18,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "content/browser/debugger/devtools_window.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" @@ -50,30 +51,30 @@ ExtensionPopupGtk::ExtensionPopupGtk(Browser* browser, if (host->did_stop_loading()) { ShowPopup(); } else { - registrar_.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, Source<Profile>(host->profile())); } - registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(host->profile())); } ExtensionPopupGtk::~ExtensionPopupGtk() { } -void ExtensionPopupGtk::Observe(NotificationType type, +void ExtensionPopupGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: if (Details<ExtensionHost>(host_.get()) == details) ShowPopup(); break; - case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: + case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: if (Details<ExtensionHost>(host_.get()) == details) DestroyPopup(); break; - case NotificationType::DEVTOOLS_WINDOW_CLOSING: + case content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING: // Make sure its the devtools window that inspecting our popup. if (Details<RenderViewHost>(host_->render_view_host()) != details) break; @@ -98,7 +99,7 @@ void ExtensionPopupGtk::ShowPopup() { if (being_inspected_) { DevToolsWindow::OpenDevToolsWindow(host_->render_view_host()); // Listen for the the devtools window closing. - registrar_.Add(this, NotificationType::DEVTOOLS_WINDOW_CLOSING, + registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, Source<Profile>(host_->profile())); } diff --git a/chrome/browser/ui/gtk/extensions/extension_popup_gtk.h b/chrome/browser/ui/gtk/extensions/extension_popup_gtk.h index 926bb2e..1b41510 100644 --- a/chrome/browser/ui/gtk/extensions/extension_popup_gtk.h +++ b/chrome/browser/ui/gtk/extensions/extension_popup_gtk.h @@ -35,7 +35,7 @@ class ExtensionPopupGtk : public NotificationObserver, bool inspect); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/gtk/find_bar_gtk.cc b/chrome/browser/ui/gtk/find_bar_gtk.cc index 439a815..ae1a647 100644 --- a/chrome/browser/ui/gtk/find_bar_gtk.cc +++ b/chrome/browser/ui/gtk/find_bar_gtk.cc @@ -32,6 +32,7 @@ #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" #include "chrome/browser/ui/gtk/view_id_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/native_web_keyboard_event.h" @@ -300,7 +301,7 @@ void FindBarGtk::InitWidgets() { gtk_box_pack_end(GTK_BOX(hbox), border_bin_, TRUE, TRUE, 0); theme_service_->InitThemesFor(this); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); g_signal_connect(widget(), "parent-set", G_CALLBACK(OnParentSet), this); @@ -456,10 +457,10 @@ FindBarTesting* FindBarGtk::GetFindBarTesting() { return this; } -void FindBarGtk::Observe(NotificationType type, +void FindBarGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(type.value, NotificationType::BROWSER_THEME_CHANGED); + DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_THEME_CHANGED); // Force reshapings of the find bar window. container_width_ = -1; diff --git a/chrome/browser/ui/gtk/find_bar_gtk.h b/chrome/browser/ui/gtk/find_bar_gtk.h index 10606b2..68ecac9 100644 --- a/chrome/browser/ui/gtk/find_bar_gtk.h +++ b/chrome/browser/ui/gtk/find_bar_gtk.h @@ -68,7 +68,7 @@ class FindBarGtk : public FindBar, virtual int GetWidth(); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/global_bookmark_menu.cc b/chrome/browser/ui/gtk/global_bookmark_menu.cc index 23ec551..d2c8ee8d 100644 --- a/chrome/browser/ui/gtk/global_bookmark_menu.cc +++ b/chrome/browser/ui/gtk/global_bookmark_menu.cc @@ -18,6 +18,7 @@ #include "chrome/browser/ui/gtk/global_menu_bar.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -60,7 +61,7 @@ GlobalBookmarkMenu::GlobalBookmarkMenu(Browser* browser) default_favicon_ = GtkThemeService::GetDefaultFavicon(true); default_folder_ = GtkThemeService::GetFolderIcon(true); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>( ThemeServiceFactory::GetForProfile(profile_))); } @@ -225,10 +226,10 @@ void GlobalBookmarkMenu::ClearBookmarkItemCallback(GtkWidget* menu_item, gtk_widget_destroy(menu_item); } -void GlobalBookmarkMenu::Observe(NotificationType type, +void GlobalBookmarkMenu::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type.value == NotificationType::BROWSER_THEME_CHANGED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); // Change the icon and invalidate the menu. default_favicon_ = GtkThemeService::GetDefaultFavicon(true); diff --git a/chrome/browser/ui/gtk/global_bookmark_menu.h b/chrome/browser/ui/gtk/global_bookmark_menu.h index 9c7d4e2..b60c557 100644 --- a/chrome/browser/ui/gtk/global_bookmark_menu.h +++ b/chrome/browser/ui/gtk/global_bookmark_menu.h @@ -78,7 +78,7 @@ class GlobalBookmarkMenu : public GlobalMenuOwner, void* unused); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/global_history_menu.cc b/chrome/browser/ui/gtk/global_history_menu.cc index 2bdc126..7938324 100644 --- a/chrome/browser/ui/gtk/global_history_menu.cc +++ b/chrome/browser/ui/gtk/global_history_menu.cc @@ -20,6 +20,7 @@ #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/owned_widget_gtk.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -118,7 +119,7 @@ void GlobalHistoryMenu::Init(GtkWidget* history_menu, // Register for notification when TopSites changes so that we can update // ourself. - registrar_.Add(this, NotificationType::TOP_SITES_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_CHANGED, Source<history::TopSites>(top_sites_)); } } @@ -278,10 +279,10 @@ void GlobalHistoryMenu::ClearMenuCallback(GtkWidget* menu_item, } } -void GlobalHistoryMenu::Observe(NotificationType type, +void GlobalHistoryMenu::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::TOP_SITES_CHANGED) { + if (type == chrome::NOTIFICATION_TOP_SITES_CHANGED) { if (Source<history::TopSites>(source).ptr() == top_sites_) GetTopSitesData(); } else { diff --git a/chrome/browser/ui/gtk/global_history_menu.h b/chrome/browser/ui/gtk/global_history_menu.h index 7356963..9ddf74e 100644 --- a/chrome/browser/ui/gtk/global_history_menu.h +++ b/chrome/browser/ui/gtk/global_history_menu.h @@ -81,7 +81,7 @@ class GlobalHistoryMenu : public GlobalMenuOwner, static void ClearMenuCallback(GtkWidget* widget, ClearMenuClosure* closure); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/global_menu_bar.cc b/chrome/browser/ui/gtk/global_menu_bar.cc index c6980ad..6e0b726 100644 --- a/chrome/browser/ui/gtk/global_menu_bar.cc +++ b/chrome/browser/ui/gtk/global_menu_bar.cc @@ -14,6 +14,7 @@ #include "chrome/browser/ui/gtk/accelerators_gtk.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/common/notification_service.h" @@ -213,9 +214,10 @@ GlobalMenuBar::GlobalMenuBar(Browser* browser) } // Listen for bookmark bar visibility changes and set the initial state. - registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, + registrar_.Add(this, + chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, NotificationService::AllSources()); - Observe(NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, + Observe(chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, NotificationService::AllSources(), NotificationService::NoDetails()); } @@ -302,10 +304,10 @@ void GlobalMenuBar::EnabledStateChangedForCommand(int id, bool enabled) { gtk_widget_set_sensitive(it->second, enabled); } -void GlobalMenuBar::Observe(NotificationType type, +void GlobalMenuBar::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type.value == NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED); + DCHECK(type == chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED); CommandIDMenuItemMap::iterator it = id_to_menu_item_.find(IDC_SHOW_BOOKMARK_BAR); diff --git a/chrome/browser/ui/gtk/global_menu_bar.h b/chrome/browser/ui/gtk/global_menu_bar.h index d4dbc27..784e003 100644 --- a/chrome/browser/ui/gtk/global_menu_bar.h +++ b/chrome/browser/ui/gtk/global_menu_bar.h @@ -65,7 +65,7 @@ class GlobalMenuBar : public CommandUpdater::CommandObserver, virtual void EnabledStateChangedForCommand(int id, bool enabled); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/gtk_theme_service.cc b/chrome/browser/ui/gtk/gtk_theme_service.cc index 696826c..e624c02 100644 --- a/chrome/browser/ui/gtk/gtk_theme_service.cc +++ b/chrome/browser/ui/gtk/gtk_theme_service.cc @@ -23,12 +23,12 @@ #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/hover_controller_gtk.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/user_metrics.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "grit/ui_resources.h" @@ -334,7 +334,7 @@ bool GtkThemeService::HasCustomImage(int id) const { } void GtkThemeService::InitThemesFor(NotificationObserver* observer) { - observer->Observe(NotificationType::BROWSER_THEME_CHANGED, + observer->Observe(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(this), NotificationService::NoDetails()); } @@ -366,10 +366,10 @@ bool GtkThemeService::UsingNativeTheme() const { return use_gtk_; } -void GtkThemeService::Observe(NotificationType type, +void GtkThemeService::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if ((type == NotificationType::PREF_CHANGED) && + if ((type == chrome::NOTIFICATION_PREF_CHANGED) && (*Details<std::string>(details).ptr() == prefs::kUsesSystemTheme)) { #if !defined(OS_CHROMEOS) use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); diff --git a/chrome/browser/ui/gtk/gtk_theme_service.h b/chrome/browser/ui/gtk/gtk_theme_service.h index c101d68..0875cbf 100644 --- a/chrome/browser/ui/gtk/gtk_theme_service.h +++ b/chrome/browser/ui/gtk/gtk_theme_service.h @@ -60,7 +60,7 @@ class GtkThemeService : public ThemeService { virtual bool UsingNativeTheme() const; // Overridden from ThemeService, NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc index d65a66b..6ff20cb 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc @@ -14,6 +14,7 @@ #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "ui/gfx/gtk_util.h" #include "ui/gfx/image/image.h" @@ -91,7 +92,7 @@ InfoBarGtk::InfoBarGtk(TabContentsWrapper* owner, InfoBarDelegate* delegate) G_CALLBACK(OnChildSizeRequestThunk), this); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); UpdateBorderColor(); } @@ -251,7 +252,7 @@ void InfoBarGtk::PlatformSpecificOnHeightsRecalculated() { gtk_widget_queue_draw(widget_.get()); } -void InfoBarGtk::Observe(NotificationType type, +void InfoBarGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { UpdateBorderColor(); diff --git a/chrome/browser/ui/gtk/infobars/infobar_gtk.h b/chrome/browser/ui/gtk/infobars/infobar_gtk.h index de832f7..a757a3a 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_gtk.h +++ b/chrome/browser/ui/gtk/infobars/infobar_gtk.h @@ -76,7 +76,7 @@ class InfoBarGtk : public InfoBar, virtual void PlatformSpecificOnHeightsRecalculated() OVERRIDE; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 4047e23..498f397 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -47,6 +47,7 @@ #include "chrome/browser/ui/gtk/view_id_util.h" #include "chrome/browser/ui/omnibox/location_bar_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_resource.h" @@ -331,7 +332,7 @@ void LocationBarViewGtk::Init(bool popup_window_mode) { G_CALLBACK(&OnHboxSizeAllocateThunk), this); registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, profile_->GetPrefs(), this); @@ -558,7 +559,7 @@ void LocationBarViewGtk::OnSetFocus() { l10n_util::GetStringUTF8(IDS_ACCNAME_LOCATION).c_str(), false); NotificationService::current()->Notify( - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, Source<Profile>(profile_), Details<AccessibilityTextBoxInfo>(&info)); @@ -662,7 +663,7 @@ void LocationBarViewGtk::UpdatePageActions() { page_action_views_[i]->widget(), FALSE, FALSE, 0); } NotificationService::current()->Notify( - NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, Source<LocationBar>(this), NotificationService::NoDetails()); } @@ -688,7 +689,7 @@ void LocationBarViewGtk::InvalidatePageActions() { page_action_views_.reset(); if (page_action_views_.size() != count_before) { NotificationService::current()->Notify( - NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, Source<LocationBar>(this), NotificationService::NoDetails()); } @@ -756,15 +757,15 @@ void LocationBarViewGtk::TestPageActionPressed(size_t index) { page_action_views_[index]->TestActivatePageAction(); } -void LocationBarViewGtk::Observe(NotificationType type, +void LocationBarViewGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { UpdateStarIcon(); return; } - DCHECK_EQ(type.value, NotificationType::BROWSER_THEME_CHANGED); + DCHECK_EQ(type, chrome::NOTIFICATION_BROWSER_THEME_CHANGED); if (theme_service_->UsingNativeTheme()) { gtk_widget_modify_bg(tab_to_search_box_, GTK_STATE_NORMAL, NULL); @@ -1523,7 +1524,7 @@ void LocationBarViewGtk::PageActionViewGtk::UpdateVisibility( if (visible != old_visible) { NotificationService::current()->Notify( - NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, Source<ExtensionAction>(page_action_), Details<TabContents>(contents)); } diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h index 75c981a..dbb4272 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.h +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h @@ -137,7 +137,7 @@ class LocationBarViewGtk : public AutocompleteEditController, virtual void TestPageActionPressed(size_t index); // Implement the NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc index 062470b..fd76b3b 100644 --- a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc +++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc @@ -27,13 +27,13 @@ #include "chrome/browser/ui/gtk/menu_gtk.h" #include "chrome/browser/ui/gtk/notifications/balloon_view_host_gtk.h" #include "chrome/browser/ui/gtk/rounded_window.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" @@ -313,7 +313,7 @@ void BalloonViewImpl::Show(Balloon* balloon) { options_menu_button_->widget()); gtk_box_pack_end(GTK_BOX(hbox_), options_alignment, FALSE, FALSE, 0); - notification_registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + notification_registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); // We don't do InitThemesFor() because it just forces a redraw. @@ -337,7 +337,7 @@ void BalloonViewImpl::Show(Balloon* balloon) { gtk_widget_show_all(frame_container_); notification_registrar_.Add(this, - NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon)); + chrome::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon)); } void BalloonViewImpl::Update() { @@ -380,17 +380,17 @@ gfx::Rect BalloonViewImpl::GetContentsRectangle() const { content_size.width(), content_size.height()); } -void BalloonViewImpl::Observe(NotificationType type, +void BalloonViewImpl::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::NOTIFY_BALLOON_DISCONNECTED) { + if (type == chrome::NOTIFY_BALLOON_DISCONNECTED) { // If the renderer process attached to this balloon is disconnected // (e.g., because of a crash), we want to close the balloon. notification_registrar_.Remove(this, - NotificationType::NOTIFY_BALLOON_DISCONNECTED, + chrome::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); Close(false); - } else if (type == NotificationType::BROWSER_THEME_CHANGED) { + } else if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { // Since all the buttons change their own properties, and our expose does // all the real differences, we'll need a redraw. gtk_widget_queue_draw(frame_container_); diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h index e1a218f..b055379 100644 --- a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h +++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.h @@ -56,7 +56,7 @@ class BalloonViewImpl : public BalloonView, private: // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc index bb8bfc2..4df64aa 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc @@ -25,6 +25,7 @@ #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/omnibox/omnibox_view.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/theme_resources.h" #include "ui/base/gtk/gtk_windowing.h" @@ -311,7 +312,7 @@ OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font, G_CALLBACK(HandleExposeThunk), this); registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); theme_service_->InitThemesFor(this); @@ -388,10 +389,10 @@ void OmniboxPopupViewGtk::OnDragCanceled() { ignore_mouse_drag_ = true; } -void OmniboxPopupViewGtk::Observe(NotificationType type, +void OmniboxPopupViewGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); if (theme_service_->UsingNativeTheme()) { gtk_util::UndoForceFontSize(window_); diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h index 64710be..025e432 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h +++ b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h @@ -47,7 +47,7 @@ class OmniboxPopupViewGtk : public AutocompletePopupView, virtual void OnDragCanceled(); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc index e8c5b8c..dc93435 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc @@ -24,6 +24,7 @@ #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/view_id_util.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" #include "googleurl/src/gurl.h" @@ -212,7 +213,7 @@ OmniboxViewGtk::OmniboxViewGtk( } OmniboxViewGtk::~OmniboxViewGtk() { - NotificationService::current()->Notify(NotificationType::OMNIBOX_DESTROYED, + NotificationService::current()->Notify(chrome::OMNIBOX_DESTROYED, Source<OmniboxViewGtk>(this), NotificationService::NoDetails()); @@ -408,7 +409,7 @@ void OmniboxViewGtk::Init() { #if !defined(TOOLKIT_VIEWS) registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); theme_service_->InitThemesFor(this); #else @@ -910,10 +911,10 @@ OmniboxView* OmniboxViewGtk::Create(AutocompleteEditController* controller, } #endif -void OmniboxViewGtk::Observe(NotificationType type, +void OmniboxViewGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); SetBaseColor(); } diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h index 7750f76..f52e03b 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h @@ -163,7 +163,7 @@ class OmniboxViewGtk : public OmniboxView, #endif // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/gtk/overflow_button.cc b/chrome/browser/ui/gtk/overflow_button.cc index b37005c..deb1433 100644 --- a/chrome/browser/ui/gtk/overflow_button.cc +++ b/chrome/browser/ui/gtk/overflow_button.cc @@ -8,8 +8,8 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/theme_resources.h" #include "ui/base/resource/resource_bundle.h" @@ -18,7 +18,7 @@ OverflowButton::OverflowButton(Profile* profile) : profile_(profile) { gtk_widget_set_no_show_all(widget_.get(), TRUE); GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service)); theme_service->InitThemesFor(this); } @@ -27,7 +27,7 @@ OverflowButton::~OverflowButton() { widget_.Destroy(); } -void OverflowButton::Observe(NotificationType type, +void OverflowButton::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { GtkWidget* former_child = gtk_bin_get_child(GTK_BIN(widget())); diff --git a/chrome/browser/ui/gtk/overflow_button.h b/chrome/browser/ui/gtk/overflow_button.h index 91583f1..9f4f099 100644 --- a/chrome/browser/ui/gtk/overflow_button.h +++ b/chrome/browser/ui/gtk/overflow_button.h @@ -24,7 +24,7 @@ class OverflowButton : public NotificationObserver { private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/reload_button_gtk.cc b/chrome/browser/ui/gtk/reload_button_gtk.cc index 9dd6a36..890baa3 100644 --- a/chrome/browser/ui/gtk/reload_button_gtk.cc +++ b/chrome/browser/ui/gtk/reload_button_gtk.cc @@ -13,6 +13,7 @@ #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_source.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -61,7 +62,7 @@ ReloadButtonGtk::ReloadButtonGtk(LocationBarViewGtk* location_bar, if (theme_service_) { theme_service_->InitThemesFor(this); registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); } @@ -127,10 +128,10 @@ void ReloadButtonGtk::ChangeMode(Mode mode, bool force) { //////////////////////////////////////////////////////////////////////////////// // ReloadButtonGtk, NotificationObserver implementation: -void ReloadButtonGtk::Observe(NotificationType type, +void ReloadButtonGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& /* details */) { - DCHECK(NotificationType::BROWSER_THEME_CHANGED == type); + DCHECK(chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type); GtkThemeService* provider = static_cast<GtkThemeService*>( Source<ThemeService>(source).ptr()); diff --git a/chrome/browser/ui/gtk/reload_button_gtk.h b/chrome/browser/ui/gtk/reload_button_gtk.h index d623462..8f7700e 100644 --- a/chrome/browser/ui/gtk/reload_button_gtk.h +++ b/chrome/browser/ui/gtk/reload_button_gtk.h @@ -35,7 +35,7 @@ class ReloadButtonGtk : public NotificationObserver { void ChangeMode(Mode mode, bool force); // Provide NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& /* details */); diff --git a/chrome/browser/ui/gtk/repost_form_warning_gtk.cc b/chrome/browser/ui/gtk/repost_form_warning_gtk.cc index f7a79aa..d37c7b1 100644 --- a/chrome/browser/ui/gtk/repost_form_warning_gtk.cc +++ b/chrome/browser/ui/gtk/repost_form_warning_gtk.cc @@ -10,7 +10,7 @@ #include "content/browser/browser_thread.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/gtk/status_bubble_gtk.cc b/chrome/browser/ui/gtk/status_bubble_gtk.cc index de16765..fb548be 100644 --- a/chrome/browser/ui/gtk/status_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/status_bubble_gtk.cc @@ -15,6 +15,7 @@ #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/rounded_window.h" #include "chrome/browser/ui/gtk/slide_animator_gtk.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/text/text_elider.h" @@ -49,7 +50,7 @@ StatusBubbleGtk::StatusBubbleGtk(Profile* profile) InitWidgets(); theme_service_->InitThemesFor(this); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); } @@ -234,10 +235,10 @@ void StatusBubbleGtk::UpdateDownloadShelfVisibility(bool visible) { download_shelf_is_visible_ = visible; } -void StatusBubbleGtk::Observe(NotificationType type, +void StatusBubbleGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::BROWSER_THEME_CHANGED) { + if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { UserChangedTheme(); } } diff --git a/chrome/browser/ui/gtk/status_bubble_gtk.h b/chrome/browser/ui/gtk/status_bubble_gtk.h index a3be4a6..5962972 100644 --- a/chrome/browser/ui/gtk/status_bubble_gtk.h +++ b/chrome/browser/ui/gtk/status_bubble_gtk.h @@ -58,7 +58,7 @@ class StatusBubbleGtk : public StatusBubble, virtual void UpdateDownloadShelfVisibility(bool visible); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/tab_contents_container_gtk.cc b/chrome/browser/ui/gtk/tab_contents_container_gtk.cc index 64ea11f..026d11a 100644 --- a/chrome/browser/ui/gtk/tab_contents_container_gtk.cc +++ b/chrome/browser/ui/gtk/tab_contents_container_gtk.cc @@ -64,7 +64,7 @@ void TabContentsContainerGtk::Init() { void TabContentsContainerGtk::SetTab(TabContentsWrapper* tab) { HideTab(tab_); if (tab_) { - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_->tab_contents())); } @@ -77,7 +77,7 @@ void TabContentsContainerGtk::SetTab(TabContentsWrapper* tab) { } else if (tab_) { // Otherwise we actually have to add it to the widget hierarchy. PackTab(tab); - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_->tab_contents())); } } @@ -95,7 +95,7 @@ void TabContentsContainerGtk::SetPreview(TabContentsWrapper* preview) { preview_ = preview; PackTab(preview); - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(preview_->tab_contents())); } @@ -109,7 +109,7 @@ void TabContentsContainerGtk::RemovePreview() { if (preview_widget) gtk_container_remove(GTK_CONTAINER(expanded_), preview_widget); - registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Remove(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(preview_->tab_contents())); preview_ = NULL; } @@ -168,10 +168,10 @@ void TabContentsContainerGtk::DetachTab(TabContentsWrapper* tab) { } } -void TabContentsContainerGtk::Observe(NotificationType type, +void TabContentsContainerGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); + DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); TabContentsDestroyed(Source<TabContents>(source).ptr()); } diff --git a/chrome/browser/ui/gtk/tab_contents_container_gtk.h b/chrome/browser/ui/gtk/tab_contents_container_gtk.h index f3e48c2..de70475 100644 --- a/chrome/browser/ui/gtk/tab_contents_container_gtk.h +++ b/chrome/browser/ui/gtk/tab_contents_container_gtk.h @@ -46,7 +46,7 @@ class TabContentsContainerGtk : public NotificationObserver, void DetachTab(TabContentsWrapper* tab); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc index 8f017e7..4fa858c 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc @@ -164,10 +164,10 @@ DraggedTabControllerGtk::GetJavaScriptDialogCreator() { //////////////////////////////////////////////////////////////////////////////// // DraggedTabControllerGtk, NotificationObserver implementation: -void DraggedTabControllerGtk::Observe(NotificationType type, +void DraggedTabControllerGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); + DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); DCHECK_EQ(Source<TabContents>(source).ptr(), dragged_contents_->tab_contents()); EndDragImpl(TAB_DESTROYED); @@ -187,7 +187,7 @@ void DraggedTabControllerGtk::SetDraggedContents( TabContentsWrapper* new_contents) { if (dragged_contents_) { registrar_.Remove(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(dragged_contents_->tab_contents())); if (original_delegate_) dragged_contents_->tab_contents()->set_delegate(original_delegate_); @@ -196,7 +196,7 @@ void DraggedTabControllerGtk::SetDraggedContents( dragged_contents_ = new_contents; if (dragged_contents_) { registrar_.Add(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(dragged_contents_->tab_contents())); // We need to be the delegate so we receive messages about stuff, diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h index 41c732d..d6fdb63 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h @@ -88,7 +88,7 @@ class DraggedTabControllerGtk : public NotificationObserver, GetJavaScriptDialogCreator() OVERRIDE; // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc index dda7ae0..64fe5ed 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc @@ -18,6 +18,7 @@ #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -156,7 +157,7 @@ TabRendererGtk::LoadingAnimation::LoadingAnimation( animation_state_(ANIMATION_NONE), animation_frame_(0) { registrar_.Add(this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); } @@ -200,10 +201,10 @@ bool TabRendererGtk::LoadingAnimation::ValidateLoadingAnimation( } void TabRendererGtk::LoadingAnimation::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); data_.reset(new Data(theme_service_)); } @@ -273,7 +274,7 @@ TabRendererGtk::TabRendererGtk(ThemeService* theme_service) hover_animation_.reset(new ui::SlideAnimation(this)); hover_animation_->SetSlideDuration(kHoverDurationMs); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); } @@ -559,10 +560,10 @@ void TabRendererGtk::SetBounds(const gfx::Rect& bounds) { gtk_widget_set_size_request(tab_.get(), bounds.width(), bounds.height()); } -void TabRendererGtk::Observe(NotificationType type, +void TabRendererGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); // Clear our cache when we receive a theme change notification because it // contains cached bitmaps based off the previous theme. diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h index a8a36a3..c5e3728 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h @@ -81,7 +81,7 @@ class TabRendererGtk : public ui::AnimationDelegate, } // Provide NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -164,7 +164,7 @@ class TabRendererGtk : public ui::AnimationDelegate, virtual void SetBounds(const gfx::Rect& bounds); // Provide NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc index 9a7c251..f01809d 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc @@ -24,9 +24,9 @@ #include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h" #include "chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "grit/ui_resources.h" @@ -707,7 +707,7 @@ TabStripGtk::TabStripGtk(TabStripModel* model, BrowserWindowGtk* window) added_as_message_loop_observer_(false), hover_tab_selector_(model) { theme_service_->InitThemesFor(this); - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>(theme_service_)); } @@ -1285,10 +1285,10 @@ void TabStripGtk::DidProcessEvent(GdkEvent* event) { /////////////////////////////////////////////////////////////////////////////// // TabStripGtk, NotificationObserver implementation: -void TabStripGtk::Observe(NotificationType type, +void TabStripGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::BROWSER_THEME_CHANGED) { + if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { TabRendererGtk::SetSelectedTitleColor(theme_service_->GetColor( ThemeService::COLOR_TAB_TEXT)); TabRendererGtk::SetUnselectedTitleColor(theme_service_->GetColor( diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h index cc47446..7615cf1 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h @@ -151,7 +151,7 @@ class TabStripGtk : public TabStripModelObserver, virtual void DidProcessEvent(GdkEvent* event); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc b/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc index bcf074ac..c7bb857 100644 --- a/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc +++ b/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.cc @@ -8,8 +8,8 @@ #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/rounded_window.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -34,7 +34,7 @@ void ThemeInstallBubbleViewGtk::Show(GtkWindow* parent) { instance_ = new ThemeInstallBubbleViewGtk(GTK_WIDGET(parent)); } -void ThemeInstallBubbleViewGtk::Observe(NotificationType type, +void ThemeInstallBubbleViewGtk::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (--num_loads_extant_ == 0) @@ -52,27 +52,27 @@ ThemeInstallBubbleViewGtk::ThemeInstallBubbleViewGtk(GtkWidget* parent) // Close when theme has been installed. registrar_.Add( this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); // Close when we are installing an extension, not a theme. registrar_.Add( this, - NotificationType::NO_THEME_DETECTED, + chrome::NOTIFICATION_NO_THEME_DETECTED, NotificationService::AllSources()); registrar_.Add( this, - NotificationType::EXTENSION_INSTALLED, + chrome::NOTIFICATION_EXTENSION_INSTALLED, NotificationService::AllSources()); registrar_.Add( this, - NotificationType::EXTENSION_INSTALL_ERROR, + chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); // Don't let the bubble overlap the confirm dialog. registrar_.Add( this, - NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, NotificationService::AllSources()); } diff --git a/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h b/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h index 8018e14..118b9d9 100644 --- a/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h +++ b/chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h @@ -18,7 +18,7 @@ class ThemeInstallBubbleViewGtk : public NotificationObserver { static void Show(GtkWindow* parent); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc index 5f7f2b2..2a2c790 100644 --- a/chrome/browser/ui/login/login_prompt.cc +++ b/chrome/browser/ui/login/login_prompt.cc @@ -12,6 +12,7 @@ #include "chrome/browser/password_manager/password_manager.h" #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" @@ -191,29 +192,29 @@ void LoginHandler::OnRequestCancelled() { void LoginHandler::AddObservers() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - registrar_.Add(this, NotificationType::AUTH_SUPPLIED, + registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::AUTH_CANCELLED, + registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, NotificationService::AllSources()); } void LoginHandler::RemoveObservers() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - registrar_.Remove(this, NotificationType::AUTH_SUPPLIED, + registrar_.Remove(this, chrome::NOTIFICATION_AUTH_SUPPLIED, NotificationService::AllSources()); - registrar_.Remove(this, NotificationType::AUTH_CANCELLED, + registrar_.Remove(this, chrome::NOTIFICATION_AUTH_CANCELLED, NotificationService::AllSources()); DCHECK(registrar_.IsEmpty()); } -void LoginHandler::Observe(NotificationType type, +void LoginHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(type == NotificationType::AUTH_SUPPLIED || - type == NotificationType::AUTH_CANCELLED); + DCHECK(type == chrome::NOTIFICATION_AUTH_SUPPLIED || + type == chrome::NOTIFICATION_AUTH_CANCELLED); TabContents* requesting_contents = GetTabContentsForLogin(); if (!requesting_contents) @@ -235,12 +236,12 @@ void LoginHandler::Observe(NotificationType type, return; // Set or cancel the auth in this handler. - if (type == NotificationType::AUTH_SUPPLIED) { + if (type == chrome::NOTIFICATION_AUTH_SUPPLIED) { AuthSuppliedLoginNotificationDetails* supplied_details = Details<AuthSuppliedLoginNotificationDetails>(details).ptr(); SetAuth(supplied_details->username(), supplied_details->password()); } else { - DCHECK(type == NotificationType::AUTH_CANCELLED); + DCHECK(type == chrome::NOTIFICATION_AUTH_CANCELLED); CancelAuth(); } } @@ -271,7 +272,7 @@ void LoginHandler::NotifyAuthNeeded() { LoginNotificationDetails details(this); - service->Notify(NotificationType::AUTH_NEEDED, + service->Notify(chrome::NOTIFICATION_AUTH_NEEDED, Source<NavigationController>(controller), Details<LoginNotificationDetails>(&details)); } @@ -289,7 +290,7 @@ void LoginHandler::NotifyAuthCancelled() { LoginNotificationDetails details(this); - service->Notify(NotificationType::AUTH_CANCELLED, + service->Notify(chrome::NOTIFICATION_AUTH_CANCELLED, Source<NavigationController>(controller), Details<LoginNotificationDetails>(&details)); } @@ -307,7 +308,7 @@ void LoginHandler::NotifyAuthSupplied(const string16& username, NavigationController* controller = &requesting_contents->controller(); AuthSuppliedLoginNotificationDetails details(this, username, password); - service->Notify(NotificationType::AUTH_SUPPLIED, + service->Notify(chrome::NOTIFICATION_AUTH_SUPPLIED, Source<NavigationController>(controller), Details<AuthSuppliedLoginNotificationDetails>(&details)); } diff --git a/chrome/browser/ui/login/login_prompt.h b/chrome/browser/ui/login/login_prompt.h index b9ace30..b0a03ef 100644 --- a/chrome/browser/ui/login/login_prompt.h +++ b/chrome/browser/ui/login/login_prompt.h @@ -69,7 +69,7 @@ class LoginHandler : public ResourceDispatcherHostLoginDelegate, // Listens for AUTH_SUPPLIED and AUTH_CANCELLED notifications from other // LoginHandlers so that this LoginHandler has the chance to dismiss itself // if it was waiting for the same authentication. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/login/login_prompt_browsertest.cc b/chrome/browser/ui/login/login_prompt_browsertest.cc index ba2bd8c..4df0991 100644 --- a/chrome/browser/ui/login/login_prompt_browsertest.cc +++ b/chrome/browser/ui/login/login_prompt_browsertest.cc @@ -11,6 +11,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/login/login_prompt.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/ui_test_utils.h" #include "content/browser/browser_thread.h" @@ -73,7 +74,7 @@ class LoginPromptBrowserTestObserver : public NotificationObserver { auth_supplied_count_(0), auth_cancelled_count_(0) {} - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -100,20 +101,20 @@ class LoginPromptBrowserTestObserver : public NotificationObserver { }; void LoginPromptBrowserTestObserver::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::AUTH_NEEDED) { + if (type == chrome::NOTIFICATION_AUTH_NEEDED) { LoginNotificationDetails* login_details = Details<LoginNotificationDetails>(details).ptr(); AddHandler(login_details->handler()); auth_needed_count_++; - } else if (type == NotificationType::AUTH_SUPPLIED) { + } else if (type == chrome::NOTIFICATION_AUTH_SUPPLIED) { AuthSuppliedLoginNotificationDetails* login_details = Details<AuthSuppliedLoginNotificationDetails>(details).ptr(); RemoveHandler(login_details->handler()); auth_supplied_count_++; - } else if (type == NotificationType::AUTH_CANCELLED) { + } else if (type == chrome::NOTIFICATION_AUTH_CANCELLED) { LoginNotificationDetails* login_details = Details<LoginNotificationDetails>(details).ptr(); RemoveHandler(login_details->handler()); @@ -141,12 +142,12 @@ void LoginPromptBrowserTestObserver::RemoveHandler(LoginHandler* handler) { void LoginPromptBrowserTestObserver::Register( const NotificationSource& source) { - registrar_.Add(this, NotificationType::AUTH_NEEDED, source); - registrar_.Add(this, NotificationType::AUTH_SUPPLIED, source); - registrar_.Add(this, NotificationType::AUTH_CANCELLED, source); + registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source); + registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, source); + registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, source); } -template <NotificationType::Type T> +template <int T> class WindowedNavigationObserver : public ui_test_utils::WindowedNotificationObserver { public: @@ -155,16 +156,16 @@ class WindowedNavigationObserver T, Source<NavigationController>(controller)) {} }; -typedef WindowedNavigationObserver<NotificationType::LOAD_STOP> +typedef WindowedNavigationObserver<content::NOTIFICATION_LOAD_STOP> WindowedLoadStopObserver; -typedef WindowedNavigationObserver<NotificationType::AUTH_NEEDED> +typedef WindowedNavigationObserver<chrome::NOTIFICATION_AUTH_NEEDED> WindowedAuthNeededObserver; -typedef WindowedNavigationObserver<NotificationType::AUTH_CANCELLED> +typedef WindowedNavigationObserver<chrome::NOTIFICATION_AUTH_CANCELLED> WindowedAuthCancelledObserver; -typedef WindowedNavigationObserver<NotificationType::AUTH_SUPPLIED> +typedef WindowedNavigationObserver<chrome::NOTIFICATION_AUTH_SUPPLIED> WindowedAuthSuppliedObserver; const char* kPrefetchAuthPage = "files/login/prefetch.html"; diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index 6ce7597..4d12a45 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc @@ -24,6 +24,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" #include "chrome/browser/ui/omnibox/omnibox_view.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" @@ -200,7 +201,7 @@ class OmniboxViewTest : public InProcessBrowserTest, bool SendKeyAndWait(const Browser* browser, ui::KeyboardCode key, int modifiers, - NotificationType type, + int type, const NotificationSource& source) WARN_UNUSED_RESULT { return ui_test_utils::SendKeyPressAndWait( browser, key, @@ -220,8 +221,8 @@ class OmniboxViewTest : public InProcessBrowserTest, NotificationRegistrar registrar; registrar.Add(this, (tab_count < expected_tab_count ? - NotificationType::TAB_PARENTED : - NotificationType::TAB_CLOSED), + content::NOTIFICATION_TAB_PARENTED : + content::NOTIFICATION_TAB_CLOSED), NotificationService::AllSources()); while (!HasFailure() && browser->tab_count() != expected_tab_count) @@ -247,7 +248,7 @@ class OmniboxViewTest : public InProcessBrowserTest, NotificationRegistrar registrar; registrar.Add(this, - NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_READY, + chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, Source<AutocompleteController>(controller)); while (!HasFailure() && !controller->done()) @@ -263,7 +264,7 @@ class OmniboxViewTest : public InProcessBrowserTest, if (!model->loaded()) { NotificationRegistrar registrar; - registrar.Add(this, NotificationType::TEMPLATE_URL_SERVICE_LOADED, + registrar.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, Source<TemplateURLService>(model)); model->Load(); ui_test_utils::RunMessageLoop(); @@ -295,7 +296,7 @@ class OmniboxViewTest : public InProcessBrowserTest, if (!history_service->BackendLoaded()) { NotificationRegistrar registrar; - registrar.Add(this, NotificationType::HISTORY_LOADED, + registrar.Add(this, chrome::NOTIFICATION_HISTORY_LOADED, Source<Profile>(profile)); ui_test_utils::RunMessageLoop(); } @@ -305,7 +306,7 @@ class OmniboxViewTest : public InProcessBrowserTest, if (!bookmark_model->IsLoaded()) { NotificationRegistrar registrar; - registrar.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, + registrar.Add(this, chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED, Source<Profile>(profile)); ui_test_utils::RunMessageLoop(); } @@ -344,16 +345,16 @@ class OmniboxViewTest : public InProcessBrowserTest, ASSERT_NO_FATAL_FAILURE(SetupHistory()); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::TAB_PARENTED: - case NotificationType::TAB_CLOSED: - case NotificationType::TEMPLATE_URL_SERVICE_LOADED: - case NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_READY: - case NotificationType::HISTORY_LOADED: - case NotificationType::BOOKMARK_MODEL_LOADED: + switch (type) { + case content::NOTIFICATION_TAB_PARENTED: + case content::NOTIFICATION_TAB_CLOSED: + case chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED: + case chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY: + case chrome::NOTIFICATION_HISTORY_LOADED: + case chrome::NOTIFICATION_BOOKMARK_MODEL_LOADED: break; default: FAIL() << "Unexpected notification type"; @@ -416,7 +417,7 @@ class OmniboxViewTest : public InProcessBrowserTest, // Try alt-f4 to close the browser. ASSERT_TRUE(SendKeyAndWait( browser(), ui::VKEY_F4, ui::EF_ALT_DOWN, - NotificationType::BROWSER_CLOSED, Source<Browser>(browser()))); + chrome::NOTIFICATION_BROWSER_CLOSED, Source<Browser>(browser()))); #endif } @@ -437,7 +438,7 @@ class OmniboxViewTest : public InProcessBrowserTest, // No BROWSER_CLOSED notification will be sent. ASSERT_TRUE(SendKeyAndWait( popup, ui::VKEY_W, ui::EF_CONTROL_DOWN, - NotificationType::BROWSER_CLOSED, Source<Browser>(popup))); + chrome::NOTIFICATION_BROWSER_CLOSED, Source<Browser>(popup))); // Create another popup. popup = CreateBrowserForPopup(browser()->profile()); @@ -465,7 +466,7 @@ class OmniboxViewTest : public InProcessBrowserTest, // Try alt-f4 to close the popup. ASSERT_TRUE(SendKeyAndWait( popup, ui::VKEY_F4, ui::EF_ALT_DOWN, - NotificationType::BROWSER_CLOSED, Source<Browser>(popup))); + chrome::NOTIFICATION_BROWSER_CLOSED, Source<Browser>(popup))); #endif } diff --git a/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc b/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc index e650b65..4b97cd4 100644 --- a/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc +++ b/chrome/browser/ui/search_engines/keyword_editor_controller_unittest.cc @@ -10,6 +10,7 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" #include "chrome/browser/ui/search_engines/template_url_table_model.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/testing_pref_service.h" #include "chrome/test/testing_profile.h" @@ -83,7 +84,7 @@ class KeywordEditorControllerTest : public testing::Test, service->SetManagedPref( prefs::kDefaultSearchProviderPrepopulateID, new StringValue("")); model_->Observe( - NotificationType::PREF_CHANGED, + chrome::NOTIFICATION_PREF_CHANGED, Source<PrefService>(profile_->GetTestingPrefService()), Details<std::string>(NULL)); } diff --git a/chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.cc b/chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.cc index 490f9d2..37e6edc 100644 --- a/chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.cc +++ b/chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.cc @@ -10,8 +10,8 @@ #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" #include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" TemplateURLFetcherUICallbacks::TemplateURLFetcherUICallbacks( SearchEngineTabHelper* tab_helper, @@ -19,7 +19,7 @@ TemplateURLFetcherUICallbacks::TemplateURLFetcherUICallbacks( : source_(tab_helper), tab_contents_(tab_contents) { registrar_.Add(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_)); } @@ -51,10 +51,10 @@ void TemplateURLFetcherUICallbacks::ConfirmAddSearchProvider( } void TemplateURLFetcherUICallbacks::Observe( - NotificationType type, + int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); + DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); DCHECK(source == Source<TabContents>(tab_contents_)); source_ = NULL; tab_contents_ = NULL; diff --git a/chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h b/chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h index 012d737..2ed407f 100644 --- a/chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h +++ b/chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h @@ -31,7 +31,7 @@ class TemplateURLFetcherUICallbacks : public TemplateURLFetcherCallbacks, Profile* profile); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc index 5315c94..f2a735f 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc @@ -47,6 +47,7 @@ #include "chrome/browser/ui/find_bar/find_tab_helper.h" #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" @@ -152,12 +153,12 @@ TabContentsWrapper::TabContentsWrapper(TabContents* contents) if (OmniboxSearchHint::IsEnabled(contents->profile())) omnibox_search_hint_.reset(new OmniboxSearchHint(this)); - registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::USER_STYLE_SHEET_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED, NotificationService::AllSources()); #if defined(OS_POSIX) && !defined(OS_MACOSX) - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); #endif @@ -408,11 +409,11 @@ void TabContentsWrapper::TabContentsDestroyed(TabContents* tab) { DCHECK(in_destructor_); } -void TabContentsWrapper::Observe(NotificationType type, +void TabContentsWrapper::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::NAV_ENTRY_COMMITTED: { + switch (type) { + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { DCHECK(&tab_contents_->controller() == Source<NavigationController>(source).ptr()); @@ -430,19 +431,19 @@ void TabContentsWrapper::Observe(NotificationType type, break; } - case NotificationType::GOOGLE_URL_UPDATED: + case chrome::NOTIFICATION_GOOGLE_URL_UPDATED: UpdateAlternateErrorPageURL(render_view_host()); break; - case NotificationType::USER_STYLE_SHEET_UPDATED: + case chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED: UpdateWebPreferences(); break; #if defined(OS_POSIX) && !defined(OS_MACOSX) - case NotificationType::BROWSER_THEME_CHANGED: { + case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: { UpdateRendererPreferences(); break; } #endif - case NotificationType::PREF_CHANGED: { + case chrome::NOTIFICATION_PREF_CHANGED: { std::string* pref_name_in = Details<std::string>(details).ptr(); DCHECK(Source<PrefService>(source).ptr() == profile()->GetPrefs()); if (*pref_name_in == prefs::kAlternateErrorPagesEnabled) { @@ -480,14 +481,14 @@ void TabContentsWrapper::AddInfoBar(InfoBarDelegate* delegate) { infobars_.push_back(delegate); NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_INFOBAR_ADDED, + chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, Source<TabContentsWrapper>(this), Details<InfoBarAddedDetails>(delegate)); // Add ourselves as an observer for navigations the first time a delegate is // added. We use this notification to expire InfoBars that need to expire on // page transitions. if (infobars_.size() == 1) { - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&tab_contents_->controller())); } } @@ -514,7 +515,7 @@ void TabContentsWrapper::ReplaceInfoBar(InfoBarDelegate* old_delegate, InfoBarReplacedDetails replaced_details(old_delegate, new_delegate); NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, + chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, Source<TabContentsWrapper>(this), Details<InfoBarReplacedDetails>(&replaced_details)); @@ -561,7 +562,7 @@ void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol, void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { NotificationService::current()->Notify( - NotificationType::TAB_SNAPSHOT_TAKEN, + chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, Source<TabContentsWrapper>(this), Details<const SkBitmap>(&bitmap)); } @@ -645,14 +646,14 @@ void TabContentsWrapper::RemoveInfoBarInternal(InfoBarDelegate* delegate, InfoBarRemovedDetails removed_details(infobar, animate); NotificationService::current()->Notify( - NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, + chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, Source<TabContentsWrapper>(this), Details<InfoBarRemovedDetails>(&removed_details)); infobars_.erase(infobars_.begin() + i); // Remove ourselves as an observer if we are tracking no more InfoBars. if (infobars_.empty()) { - registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(&tab_contents_->controller())); } } diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h index a848457..3064302 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h @@ -198,7 +198,7 @@ class TabContentsWrapper : public TabContentsObserver, virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; // NotificationObserver overrides: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc index a3a438e..270e1c4 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc @@ -29,9 +29,9 @@ #include "chrome/common/pref_names.h" #include "chrome/common/profiling.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -222,9 +222,9 @@ WrenchMenuModel::WrenchMenuModel(ui::AcceleratorProvider* provider, tabstrip_model_->AddObserver(this); - registrar_.Add(this, NotificationType::ZOOM_LEVEL_CHANGED, + registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, Source<HostZoomMap>(browser_->profile()->GetHostZoomMap())); - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); } @@ -375,12 +375,12 @@ void WrenchMenuModel::TabStripModelDeleted() { tabstrip_model_ = NULL; } -void WrenchMenuModel::Observe(NotificationType type, +void WrenchMenuModel::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::ZOOM_LEVEL_CHANGED: - case NotificationType::NAV_ENTRY_COMMITTED: + switch (type) { + case content::NOTIFICATION_ZOOM_LEVEL_CHANGED: + case content::NOTIFICATION_NAV_ENTRY_COMMITTED: UpdateZoomControls(); break; default: diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.h b/chrome/browser/ui/toolbar/wrench_menu_model.h index 5f824be..e96876c 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.h +++ b/chrome/browser/ui/toolbar/wrench_menu_model.h @@ -120,7 +120,7 @@ class WrenchMenuModel : public ui::SimpleMenuModel, virtual void TabStripModelDeleted() OVERRIDE; // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc index 344f921..897d9cf 100644 --- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc +++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc @@ -16,8 +16,8 @@ #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "content/common/view_messages.h" #include "ui/base/animation/slide_animation.h" #include "ui/gfx/rect.h" @@ -62,22 +62,22 @@ TouchBrowserFrameView::TouchBrowserFrameView(BrowserFrame* frame, focus_listener_added_(false), keyboard_(NULL) { registrar_.Add(this, - NotificationType::NAV_ENTRY_COMMITTED, + chrome::NAV_ENTRY_COMMITTED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::FOCUS_CHANGED_IN_PAGE, + chrome::FOCUS_CHANGED_IN_PAGE, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::TAB_CONTENTS_DESTROYED, + chrome::TAB_CONTENTS_DESTROYED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::HIDE_KEYBOARD_INVOKED, + chrome::HIDE_KEYBOARD_INVOKED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::SET_KEYBOARD_HEIGHT_INVOKED, + chrome::SET_KEYBOARD_HEIGHT_INVOKED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::EDITABLE_ELEMENT_TOUCHED, + chrome::EDITABLE_ELEMENT_TOUCHED, NotificationService::AllSources()); browser_view->browser()->tabstrip_model()->AddObserver(this); @@ -260,11 +260,11 @@ void TouchBrowserFrameView::TabStripEmpty() { } } -void TouchBrowserFrameView::Observe(NotificationType type, +void TouchBrowserFrameView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { Browser* browser = browser_view()->browser(); - if (type == NotificationType::FOCUS_CHANGED_IN_PAGE) { + if (type == chrome::FOCUS_CHANGED_IN_PAGE) { // Only modify the keyboard state if the currently active tab sent the // notification. const TabContents* current_tab = browser->GetSelectedTabContents(); @@ -278,7 +278,7 @@ void TouchBrowserFrameView::Observe(NotificationType type, // can be determined after tab switching. GetFocusedStateAccessor()->SetProperty( source_tab->property_bag(), editable); - } else if (type == NotificationType::NAV_ENTRY_COMMITTED) { + } else if (type == chrome::NAV_ENTRY_COMMITTED) { NavigationController* controller = Source<NavigationController>(source).ptr(); Browser* source_browser = Browser::GetBrowserForController( @@ -299,12 +299,12 @@ void TouchBrowserFrameView::Observe(NotificationType type, } if (source_browser == browser) UpdateKeyboardAndLayout(keyboard_type == GENERIC); - } else if (type == NotificationType::TAB_CONTENTS_DESTROYED) { + } else if (type == chrome::TAB_CONTENTS_DESTROYED) { GetFocusedStateAccessor()->DeleteProperty( Source<TabContents>(source).ptr()->property_bag()); - } else if (type == NotificationType::PREF_CHANGED) { + } else if (type == chrome::PREF_CHANGED) { OpaqueBrowserFrameView::Observe(type, source, details); - } else if (type == NotificationType::HIDE_KEYBOARD_INVOKED) { + } else if (type == chrome::HIDE_KEYBOARD_INVOKED) { TabContents* tab_contents = browser_view()->browser()->GetSelectedTabContents(); if (tab_contents) { @@ -312,7 +312,7 @@ void TouchBrowserFrameView::Observe(NotificationType type, false); } UpdateKeyboardAndLayout(false); - } else if (type == NotificationType::SET_KEYBOARD_HEIGHT_INVOKED) { + } else if (type == chrome::SET_KEYBOARD_HEIGHT_INVOKED) { // TODO(penghuang) Allow extension conrtol the virtual keyboard directly // instead of using Notification. int height = *reinterpret_cast<int*>(details.map_key()); @@ -323,7 +323,7 @@ void TouchBrowserFrameView::Observe(NotificationType type, keyboard_height_ = height; parent()->Layout(); } - } else if (type == NotificationType::EDITABLE_ELEMENT_TOUCHED) { + } else if (type == chrome::EDITABLE_ELEMENT_TOUCHED) { UpdateKeyboardAndLayout(true); } } diff --git a/chrome/browser/ui/touch/frame/touch_browser_frame_view.h b/chrome/browser/ui/touch/frame/touch_browser_frame_view.h index 109e3ff..6f02128 100644 --- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.h +++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.h @@ -89,7 +89,7 @@ class TouchBrowserFrameView virtual void TabStripEmpty(); // Overridden from NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/views/accessibility_event_router_views.cc b/chrome/browser/ui/views/accessibility_event_router_views.cc index be15213..218008e 100644 --- a/chrome/browser/ui/views/accessibility_event_router_views.cc +++ b/chrome/browser/ui/views/accessibility_event_router_views.cc @@ -12,7 +12,7 @@ #include "chrome/browser/extensions/extension_accessibility_api.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" -#include "content/common/notification_type.h" +#include "chrome/common/chrome_notification_types.h" #include "ui/base/accessibility/accessible_view_state.h" #include "views/controls/button/text_button.h" #include "views/controls/menu/menu_item_view.h" @@ -45,30 +45,30 @@ void AccessibilityEventRouterViews::HandleAccessibilityEvent( switch (event_type) { case ui::AccessibilityTypes::EVENT_FOCUS: DispatchAccessibilityNotification( - view, NotificationType::ACCESSIBILITY_CONTROL_FOCUSED); + view, chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED); break; case ui::AccessibilityTypes::EVENT_MENUSTART: case ui::AccessibilityTypes::EVENT_MENUPOPUPSTART: DispatchAccessibilityNotification( - view, NotificationType::ACCESSIBILITY_MENU_OPENED); + view, chrome::NOTIFICATION_ACCESSIBILITY_MENU_OPENED); break; case ui::AccessibilityTypes::EVENT_MENUEND: case ui::AccessibilityTypes::EVENT_MENUPOPUPEND: DispatchAccessibilityNotification( - view, NotificationType::ACCESSIBILITY_MENU_CLOSED); + view, chrome::NOTIFICATION_ACCESSIBILITY_MENU_CLOSED); break; case ui::AccessibilityTypes::EVENT_TEXT_CHANGED: case ui::AccessibilityTypes::EVENT_SELECTION_CHANGED: DispatchAccessibilityNotification( - view, NotificationType::ACCESSIBILITY_TEXT_CHANGED); + view, chrome::NOTIFICATION_ACCESSIBILITY_TEXT_CHANGED); break; case ui::AccessibilityTypes::EVENT_VALUE_CHANGED: DispatchAccessibilityNotification( - view, NotificationType::ACCESSIBILITY_CONTROL_ACTION); + view, chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_ACTION); break; case ui::AccessibilityTypes::EVENT_ALERT: DispatchAccessibilityNotification( - view, NotificationType::ACCESSIBILITY_WINDOW_OPENED); + view, chrome::NOTIFICATION_ACCESSIBILITY_WINDOW_OPENED); break; case ui::AccessibilityTypes::EVENT_NAME_CHANGED: NOTIMPLEMENTED(); @@ -97,7 +97,7 @@ void AccessibilityEventRouterViews::HandleMenuItemFocused( item_index, item_count); SendAccessibilityNotification( - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, &info); + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, &info); } // @@ -105,7 +105,7 @@ void AccessibilityEventRouterViews::HandleMenuItemFocused( // void AccessibilityEventRouterViews::DispatchAccessibilityNotification( - views::View* view, NotificationType type) { + views::View* view, int type) { // Get the profile associated with this view. If it's not found, use // the most recent profile where accessibility events were sent, or // the default profile. @@ -126,8 +126,8 @@ void AccessibilityEventRouterViews::DispatchAccessibilityNotification( most_recent_profile_ = profile; - if (type == NotificationType::ACCESSIBILITY_MENU_OPENED || - type == NotificationType::ACCESSIBILITY_MENU_CLOSED) { + if (type == chrome::NOTIFICATION_ACCESSIBILITY_MENU_OPENED || + type == chrome::NOTIFICATION_ACCESSIBILITY_MENU_CLOSED) { SendMenuNotification(view, type, profile); return; } @@ -174,7 +174,7 @@ void AccessibilityEventRouterViews::DispatchAccessibilityNotification( void AccessibilityEventRouterViews::SendButtonNotification( views::View* view, - NotificationType type, + int type, Profile* profile) { AccessibilityButtonInfo info(profile, GetViewName(view)); SendAccessibilityNotification(type, &info); @@ -182,7 +182,7 @@ void AccessibilityEventRouterViews::SendButtonNotification( void AccessibilityEventRouterViews::SendLinkNotification( views::View* view, - NotificationType type, + int type, Profile* profile) { AccessibilityLinkInfo info(profile, GetViewName(view)); SendAccessibilityNotification(type, &info); @@ -190,7 +190,7 @@ void AccessibilityEventRouterViews::SendLinkNotification( void AccessibilityEventRouterViews::SendMenuNotification( views::View* view, - NotificationType type, + int type, Profile* profile) { AccessibilityMenuInfo info(profile, GetViewName(view)); SendAccessibilityNotification(type, &info); @@ -198,7 +198,7 @@ void AccessibilityEventRouterViews::SendMenuNotification( void AccessibilityEventRouterViews::SendMenuItemNotification( views::View* view, - NotificationType type, + int type, Profile* profile) { std::string name = GetViewName(view); @@ -225,7 +225,7 @@ void AccessibilityEventRouterViews::SendMenuItemNotification( void AccessibilityEventRouterViews::SendTextfieldNotification( views::View* view, - NotificationType type, + int type, Profile* profile) { ui::AccessibleViewState state; view->GetAccessibleState(&state); @@ -240,7 +240,7 @@ void AccessibilityEventRouterViews::SendTextfieldNotification( void AccessibilityEventRouterViews::SendComboboxNotification( views::View* view, - NotificationType type, + int type, Profile* profile) { ui::AccessibleViewState state; view->GetAccessibleState(&state); @@ -253,7 +253,7 @@ void AccessibilityEventRouterViews::SendComboboxNotification( void AccessibilityEventRouterViews::SendCheckboxNotification( views::View* view, - NotificationType type, + int type, Profile* profile) { ui::AccessibleViewState state; view->GetAccessibleState(&state); @@ -266,7 +266,7 @@ void AccessibilityEventRouterViews::SendCheckboxNotification( void AccessibilityEventRouterViews::SendWindowNotification( views::View* view, - NotificationType type, + int type, Profile* profile) { ui::AccessibleViewState state; view->GetAccessibleState(&state); @@ -293,9 +293,9 @@ std::string AccessibilityEventRouterViews::GetViewName(views::View* view) { bool AccessibilityEventRouterViews::IsMenuEvent( views::View* view, - NotificationType type) { - if (type == NotificationType::ACCESSIBILITY_MENU_OPENED || - type == NotificationType::ACCESSIBILITY_MENU_CLOSED) + int type) { + if (type == chrome::NOTIFICATION_ACCESSIBILITY_MENU_OPENED || + type == chrome::NOTIFICATION_ACCESSIBILITY_MENU_CLOSED) return true; while (view) { diff --git a/chrome/browser/ui/views/accessibility_event_router_views.h b/chrome/browser/ui/views/accessibility_event_router_views.h index 8890026..9ae9947 100644 --- a/chrome/browser/ui/views/accessibility_event_router_views.h +++ b/chrome/browser/ui/views/accessibility_event_router_views.h @@ -76,32 +76,32 @@ class AccessibilityEventRouterViews { // Checks the type of the view and calls one of the more specific // Send*Notification methods, below. void DispatchAccessibilityNotification( - views::View* view, NotificationType type); + views::View* view, int type); // Each of these methods constructs an AccessibilityControlInfo object // and sends a notification of a specific accessibility event. void SendButtonNotification( - views::View* view, NotificationType type, Profile* profile); + views::View* view, int type, Profile* profile); void SendLinkNotification( - views::View* view, NotificationType type, Profile* profile); + views::View* view, int type, Profile* profile); void SendMenuNotification( - views::View* view, NotificationType type, Profile* profile); + views::View* view, int type, Profile* profile); void SendMenuItemNotification( - views::View* view, NotificationType type, Profile* profile); + views::View* view, int type, Profile* profile); void SendTextfieldNotification( - views::View* view, NotificationType type, Profile* profile); + views::View* view, int type, Profile* profile); void SendComboboxNotification( - views::View* view, NotificationType type, Profile* profile); + views::View* view, int type, Profile* profile); void SendCheckboxNotification( - views::View* view, NotificationType type, Profile* profile); + views::View* view, int type, Profile* profile); void SendWindowNotification( - views::View* view, NotificationType type, Profile* profile); + views::View* view, int type, Profile* profile); // Return the name of a view. std::string GetViewName(views::View* view); // Return true if it's an event on a menu. - bool IsMenuEvent(views::View* view, NotificationType type); + bool IsMenuEvent(views::View* view, int type); // Recursively explore all menu items of |menu| and return in |count| // the total number of items, and in |index| the 0-based index of diff --git a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc index e984655..c76d342 100644 --- a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc +++ b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc @@ -9,6 +9,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/extensions/extension_accessibility_api.h" #include "chrome/browser/ui/views/accessibility_event_router_views.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/testing_profile.h" #include "content/common/notification_registrar.h" #include "content/common/notification_service.h" @@ -114,10 +115,10 @@ class AccessibilityEventRouterViewsTest protected: // Implement NotificationObserver::Observe and store information about a // ACCESSIBILITY_CONTROL_FOCUSED event. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - ASSERT_EQ(type.value, NotificationType::ACCESSIBILITY_CONTROL_FOCUSED); + ASSERT_EQ(type, chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED); const AccessibilityControlInfo* info = Details<const AccessibilityControlInfo>(details).ptr(); focus_event_count_++; @@ -157,7 +158,7 @@ TEST_F(AccessibilityEventRouterViewsTest, TestFocusNotification) { // Start listening to ACCESSIBILITY_CONTROL_FOCUSED notifications. NotificationRegistrar registrar; registrar.Add(this, - NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, + chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, NotificationService::AllSources()); // Switch on accessibility event notifications. diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index 075e7e8..2c308cd 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -30,6 +30,7 @@ #include "chrome/browser/ui/views/event_utils.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/pref_names.h" @@ -428,8 +429,8 @@ void BookmarkBarView::SetProfile(Profile* profile) { other_bookmarked_button_->SetEnabled(false); Source<Profile> ns_source(profile_->GetOriginalProfile()); - registrar_.Add(this, NotificationType::BOOKMARK_BUBBLE_SHOWN, ns_source); - registrar_.Add(this, NotificationType::BOOKMARK_BUBBLE_HIDDEN, ns_source); + registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_BUBBLE_SHOWN, ns_source); + registrar_.Add(this, chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN, ns_source); // Remove any existing bookmark buttons. while (GetBookmarkButtonCount()) @@ -1145,12 +1146,12 @@ void BookmarkBarView::ShowContextMenuForView(View* source, controller.RunMenuAt(p); } -void BookmarkBarView::Observe(NotificationType type, +void BookmarkBarView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(profile_); - switch (type.value) { - case NotificationType::BOOKMARK_BUBBLE_SHOWN: { + switch (type) { + case chrome::NOTIFICATION_BOOKMARK_BUBBLE_SHOWN: { StopThrobbing(true); GURL url = *(Details<GURL>(details).ptr()); const BookmarkNode* node = model_->GetMostRecentlyAddedNodeForURL(url); @@ -1159,7 +1160,7 @@ void BookmarkBarView::Observe(NotificationType type, StartThrobbing(node, false); break; } - case NotificationType::BOOKMARK_BUBBLE_HIDDEN: + case chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN: StopThrobbing(false); break; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h index dd358e7..ee138ec 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.h @@ -241,7 +241,7 @@ class BookmarkBarView : public DetachableToolbarView, bool is_mouse_gesture) OVERRIDE; // NotificationService: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc index 997da22..f0248d4 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc @@ -11,6 +11,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/test/interactive_ui/view_event_test_base.h" #include "chrome/test/testing_profile.h" @@ -460,11 +461,11 @@ class ContextMenuNotificationObserver : public NotificationObserver { public: explicit ContextMenuNotificationObserver(Task* task) : task_(task) { registrar_.Add(this, - NotificationType::BOOKMARK_CONTEXT_MENU_SHOWN, + chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, NotificationService::AllSources()); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { MessageLoop::current()->PostTask(FROM_HERE, task_); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc index 63edf3b..0f28330 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc @@ -15,6 +15,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/views/bubble/bubble.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/user_metrics.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -104,7 +105,7 @@ void BookmarkBubbleView::Show(views::Widget* parent, bubble->SizeToContents(); GURL url_ptr(url); NotificationService::current()->Notify( - NotificationType::BOOKMARK_BUBBLE_SHOWN, + chrome::NOTIFICATION_BOOKMARK_BUBBLE_SHOWN, Source<Profile>(profile->GetOriginalProfile()), Details<GURL>(&url_ptr)); bookmark_bubble_->BubbleShown(); @@ -325,7 +326,7 @@ void BookmarkBubbleView::BubbleClosing(Bubble* bubble, if (delegate_) delegate_->BubbleClosing(bubble, closed_by_escape); NotificationService::current()->Notify( - NotificationType::BOOKMARK_BUBBLE_HIDDEN, + chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN, Source<Profile>(profile_->GetOriginalProfile()), NotificationService::NoDetails()); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc index 8ac9789..4504833 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu.cc @@ -9,6 +9,7 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -40,7 +41,7 @@ BookmarkContextMenu::~BookmarkContextMenu() { void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) { NotificationService::current()->Notify( - NotificationType::BOOKMARK_CONTEXT_MENU_SHOWN, + chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, Source<BookmarkContextMenu>(this), NotificationService::NoDetails()); // width/height don't matter here. diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 5bfb2bd..04b2487 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -21,6 +21,7 @@ #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" #include "chrome/browser/ui/views/extensions/extension_popup.h" #include "chrome/browser/ui/views/toolbar_view.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/pref_names.h" @@ -28,7 +29,6 @@ #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" @@ -76,7 +76,7 @@ BrowserActionButton::BrowserActionButton(const Extension* extension, // No UpdateState() here because View hierarchy not setup yet. Our parent // should call UpdateState() after creation. - registrar_.Add(this, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, Source<ExtensionAction>(browser_action_)); } @@ -186,10 +186,10 @@ GURL BrowserActionButton::GetPopupUrl() { return (tab_id < 0) ? GURL() : browser_action_->GetPopupUrl(tab_id); } -void BrowserActionButton::Observe(NotificationType type, +void BrowserActionButton::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::EXTENSION_BROWSER_ACTION_UPDATED); + DCHECK(type == chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED); UpdateState(); // The browser action may have become visible/hidden so we need to make // sure the state gets updated. diff --git a/chrome/browser/ui/views/browser_actions_container.h b/chrome/browser/ui/views/browser_actions_container.h index b2c1763..00a14d3 100644 --- a/chrome/browser/ui/views/browser_actions_container.h +++ b/chrome/browser/ui/views/browser_actions_container.h @@ -89,7 +89,7 @@ class BrowserActionButton : public views::MenuButton, int index) OVERRIDE; // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/bubble/bubble.cc b/chrome/browser/ui/views/bubble/bubble.cc index 6886d72..7a5a676 100644 --- a/chrome/browser/ui/views/bubble/bubble.cc +++ b/chrome/browser/ui/views/bubble/bubble.cc @@ -7,6 +7,7 @@ #include <vector> #include "chrome/browser/ui/views/bubble/border_contents.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_service.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -273,9 +274,9 @@ void Bubble::InitBubble(views::Widget* parent, GetWidget()->SetBounds(window_bounds); // Done creating the bubble. - NotificationService::current()->Notify(NotificationType::INFO_BUBBLE_CREATED, - Source<Bubble>(this), - NotificationService::NoDetails()); + NotificationService::current()->Notify( + chrome::NOTIFICATION_INFO_BUBBLE_CREATED, Source<Bubble>(this), + NotificationService::NoDetails()); // Show the window. #if defined(OS_WIN) diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc index 1deae52..7da33b4 100644 --- a/chrome/browser/ui/views/collected_cookies_win.cc +++ b/chrome/browser/ui/views/collected_cookies_win.cc @@ -11,6 +11,7 @@ #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/views/cookie_info_view.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" #include "grit/generated_resources.h" @@ -175,7 +176,7 @@ CollectedCookiesWin::CollectedCookiesWin(gfx::NativeWindow parent_window, TabSpecificContentSettings* content_settings = TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> content_settings(); - registrar_.Add(this, NotificationType::COLLECTED_COOKIES_SHOWN, + registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, Source<TabSpecificContentSettings>(content_settings)); Init(); @@ -500,9 +501,9 @@ void CollectedCookiesWin::AddContentException(views::TreeView* tree_view, /////////////////////////////////////////////////////////////////////////////// // NotificationObserver implementation. -void CollectedCookiesWin::Observe(NotificationType type, +void CollectedCookiesWin::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::COLLECTED_COOKIES_SHOWN); + DCHECK(type == chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN); window_->CloseConstrainedWindow(); } diff --git a/chrome/browser/ui/views/collected_cookies_win.h b/chrome/browser/ui/views/collected_cookies_win.h index 7022fde..4a8f213 100644 --- a/chrome/browser/ui/views/collected_cookies_win.h +++ b/chrome/browser/ui/views/collected_cookies_win.h @@ -80,7 +80,7 @@ class CollectedCookiesWin : public ConstrainedDialogDelegate, void AddContentException(views::TreeView* tree_view, ContentSetting setting); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc b/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc index d0376a3..8e46fd9 100644 --- a/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc +++ b/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc @@ -352,9 +352,9 @@ void CompactLocationBarViewHost::TabChangedAt(TabContentsWrapper* contents, if (tab_contents->is_loading()) { // Register to NavigationController LOAD_STOP so that we can autohide // when loading is done. - if (!registrar_.IsRegistered(this, NotificationType::LOAD_STOP, + if (!registrar_.IsRegistered(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(&tab_contents->controller()))) { - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(&tab_contents->controller())); } } else { @@ -374,14 +374,14 @@ void CompactLocationBarViewHost::ActiveTabClicked(int index) { //////////////////////////////////////////////////////////////////////////////// // CompactLocationBarViewHost, NotificationObserver implementation: -void CompactLocationBarViewHost::Observe(NotificationType type, +void CompactLocationBarViewHost::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::LOAD_STOP: { + switch (type) { + case content::NOTIFICATION_LOAD_STOP: { StartAutoHideTimer(); // This is one shot deal... - registrar_.Remove(this, NotificationType::LOAD_STOP, source); + registrar_.Remove(this, content::NOTIFICATION_LOAD_STOP, source); break; } default: diff --git a/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.h b/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.h index 606e7a2..830a1949 100644 --- a/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.h +++ b/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.h @@ -100,7 +100,7 @@ class CompactLocationBarViewHost : public DropdownBarHost, virtual void ActiveTabClicked(int index) OVERRIDE; // Overridden from NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc index 3d83490..344fd78 100644 --- a/chrome/browser/ui/views/constrained_window_views.cc +++ b/chrome/browser/ui/views/constrained_window_views.cc @@ -12,6 +12,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/window_sizer.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/common/notification_service.h" @@ -597,7 +598,7 @@ void ConstrainedWindowViews::CloseConstrainedWindow() { // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED. // One example of such an observer is AutomationCWindowTracker in the // automation component. - NotificationService::current()->Notify(NotificationType::CWINDOW_CLOSED, + NotificationService::current()->Notify(chrome::NOTIFICATION_CWINDOW_CLOSED, Source<ConstrainedWindow>(this), NotificationService::NoDetails()); Close(); diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc index 15da1e1..b3c28ac 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc @@ -16,8 +16,8 @@ #include "chrome/browser/ui/views/browser_dialogs.h" #include "chrome/browser/ui/views/bubble/bubble.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "views/controls/button/radio_button.h" @@ -105,7 +105,7 @@ ContentSettingBubbleContents::ContentSettingBubbleContents( custom_link_(NULL), manage_link_(NULL), close_button_(NULL) { - registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, + registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents)); } @@ -168,10 +168,10 @@ void ContentSettingBubbleContents::LinkClicked(views::Link* source, content_setting_bubble_model_->OnPopupClicked(i->second); } -void ContentSettingBubbleContents::Observe(NotificationType type, +void ContentSettingBubbleContents::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); + DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); DCHECK(source == Source<TabContents>(tab_contents_)); tab_contents_ = NULL; } diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.h b/chrome/browser/ui/views/content_setting_bubble_contents.h index 1b7bc16..9f8cbe4 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.h +++ b/chrome/browser/ui/views/content_setting_bubble_contents.h @@ -67,7 +67,7 @@ class ContentSettingBubbleContents : public views::View, virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/views/dom_view_browsertest.cc b/chrome/browser/ui/views/dom_view_browsertest.cc index a61c804..d4b76ae 100644 --- a/chrome/browser/ui/views/dom_view_browsertest.cc +++ b/chrome/browser/ui/views/dom_view_browsertest.cc @@ -31,7 +31,7 @@ IN_PROC_BROWSER_TEST_F(DOMViewTest, TestShowAndHide) { dom_view->Init(browser()->profile(), NULL); dom_view->LoadURL(GURL("http://www.google.com")); - ui_test_utils::WaitForNotification(NotificationType::LOAD_STOP); + ui_test_utils::WaitForNotification(content::NOTIFICATION_LOAD_STOP); one->Show(); ui_test_utils::RunAllPendingInMessageLoop(); @@ -49,7 +49,7 @@ IN_PROC_BROWSER_TEST_F(DOMViewTest, TestRemoveAndDelete) { dom_view->Init(browser()->profile(), NULL); dom_view->LoadURL(GURL("http://www.google.com")); - ui_test_utils::WaitForNotification(NotificationType::LOAD_STOP); + ui_test_utils::WaitForNotification(content::NOTIFICATION_LOAD_STOP); one->Show(); ui_test_utils::RunAllPendingInMessageLoop(); @@ -71,7 +71,7 @@ IN_PROC_BROWSER_TEST_F(DOMViewTest, TestReparent) { dom_view->Init(browser()->profile(), NULL); dom_view->LoadURL(GURL("http://www.google.com")); - ui_test_utils::WaitForNotification(NotificationType::LOAD_STOP); + ui_test_utils::WaitForNotification(content::NOTIFICATION_LOAD_STOP); one->Show(); ui_test_utils::RunAllPendingInMessageLoop(); diff --git a/chrome/browser/ui/views/download/download_started_animation_win.cc b/chrome/browser/ui/views/download/download_started_animation_win.cc index f38a5b2..1039770 100644 --- a/chrome/browser/ui/views/download/download_started_animation_win.cc +++ b/chrome/browser/ui/views/download/download_started_animation_win.cc @@ -50,7 +50,7 @@ class DownloadStartedAnimationWin : public ui::LinearAnimation, virtual void AnimateToState(double state); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -92,11 +92,11 @@ DownloadStartedAnimationWin::DownloadStartedAnimationWin( registrar_.Add( this, - NotificationType::TAB_CONTENTS_HIDDEN, + content::NOTIFICATION_TAB_CONTENTS_HIDDEN, Source<TabContents>(tab_contents_)); registrar_.Add( this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_)); SetImage(kDownloadImage); @@ -139,11 +139,11 @@ void DownloadStartedAnimationWin::Close() { registrar_.Remove( this, - NotificationType::TAB_CONTENTS_HIDDEN, + content::NOTIFICATION_TAB_CONTENTS_HIDDEN, Source<TabContents>(tab_contents_)); registrar_.Remove( this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_)); tab_contents_ = NULL; popup_->Close(); @@ -166,7 +166,7 @@ void DownloadStartedAnimationWin::AnimateToState(double state) { } } -void DownloadStartedAnimationWin::Observe(NotificationType type, +void DownloadStartedAnimationWin::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { Close(); diff --git a/chrome/browser/ui/views/extensions/extension_dialog.cc b/chrome/browser/ui/views/extensions/extension_dialog.cc index 3b3ecde..5f76421 100644 --- a/chrome/browser/ui/views/extensions/extension_dialog.cc +++ b/chrome/browser/ui/views/extensions/extension_dialog.cc @@ -11,11 +11,11 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" #include "chrome/browser/ui/views/window.h" // CreateViewsWindow +#include "chrome/common/chrome_notification_types.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "views/widget/widget.h" @@ -38,7 +38,7 @@ ExtensionDialog::ExtensionDialog(Browser* browser, ExtensionHost* host, host->view()->SetContainer(this /* ExtensionView::Container */); // Listen for the containing view calling window.close(); - registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(host->profile())); window_->Show(); @@ -127,11 +127,11 @@ void ExtensionDialog::OnExtensionPreferredSizeChanged(ExtensionView* view) { ///////////////////////////////////////////////////////////////////////////// // NotificationObserver overrides. -void ExtensionDialog::Observe(NotificationType type, +void ExtensionDialog::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: // If we aren't the host of the popup, then disregard the notification. if (Details<ExtensionHost>(host()) != details) return; diff --git a/chrome/browser/ui/views/extensions/extension_dialog.h b/chrome/browser/ui/views/extensions/extension_dialog.h index f0e50ea..741b2c4 100644 --- a/chrome/browser/ui/views/extensions/extension_dialog.h +++ b/chrome/browser/ui/views/extensions/extension_dialog.h @@ -65,7 +65,7 @@ class ExtensionDialog : public views::WidgetDelegate, virtual void OnExtensionPreferredSizeChanged(ExtensionView* view); // NotificationObserver overrides. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index a87b809..f9e30ab 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -16,11 +16,11 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/toolbar_view.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" @@ -264,18 +264,18 @@ ExtensionInstalledBubble::ExtensionInstalledBubble(const Extension* extension, // fired, but all of the EXTENSION_LOADED Observers have run. Only then can we // be sure that a BrowserAction or PageAction has had views created which we // can inspect for the purpose of previewing of pointing to them. - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, Source<Profile>(browser->profile())); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, Source<Profile>(browser->profile())); } ExtensionInstalledBubble::~ExtensionInstalledBubble() {} -void ExtensionInstalledBubble::Observe(NotificationType type, +void ExtensionInstalledBubble::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::EXTENSION_LOADED) { + if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { const Extension* extension = Details<const Extension>(details).ptr(); if (extension == extension_) { animation_wait_retries_ = 0; @@ -283,7 +283,7 @@ void ExtensionInstalledBubble::Observe(NotificationType type, MessageLoopForUI::current()->PostTask(FROM_HERE, NewRunnableMethod(this, &ExtensionInstalledBubble::ShowInternal)); } - } else if (type == NotificationType::EXTENSION_UNLOADED) { + } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { const Extension* extension = Details<UnloadedExtensionInfo>(details)->extension; if (extension == extension_) diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.h b/chrome/browser/ui/views/extensions/extension_installed_bubble.h index b024da9..8f5f5b7 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.h +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.h @@ -61,7 +61,7 @@ class ExtensionInstalledBubble void ShowInternal(); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc index 88107794..8c87527 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.cc +++ b/chrome/browser/ui/views/extensions/extension_popup.cc @@ -12,13 +12,13 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "content/browser/debugger/devtools_window.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" @@ -60,11 +60,11 @@ ExtensionPopup::ExtensionPopup(ExtensionHost* host, // We wait to show the popup until the contained host finishes loading. registrar_.Add(this, - NotificationType::EXTENSION_HOST_DID_STOP_LOADING, + chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, Source<Profile>(host->profile())); // Listen for the containing view calling window.close(); - registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(host->profile())); } @@ -116,11 +116,11 @@ void ExtensionPopup::BubbleLostFocus(BrowserBubble* bubble, } -void ExtensionPopup::Observe(NotificationType type, +void ExtensionPopup::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: + switch (type) { + case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: // Once we receive did stop loading, the content will be complete and // the width will have been computed. Now it's safe to show. if (extension_host_.get() == Details<ExtensionHost>(details).ptr()) { @@ -128,7 +128,7 @@ void ExtensionPopup::Observe(NotificationType type, if (inspect_with_devtools_) { // Listen for the the devtools window closing. - registrar_.Add(this, NotificationType::DEVTOOLS_WINDOW_CLOSING, + registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, Source<Profile>(extension_host_->profile())); DevToolsWindow::ToggleDevToolsWindow( extension_host_->render_view_host(), @@ -136,14 +136,14 @@ void ExtensionPopup::Observe(NotificationType type, } } break; - case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: + case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: // If we aren't the host of the popup, then disregard the notification. if (Details<ExtensionHost>(host()) != details) return; Close(); break; - case NotificationType::DEVTOOLS_WINDOW_CLOSING: + case content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING: // Make sure its the devtools window that inspecting our popup. if (Details<RenderViewHost>(extension_host_->render_view_host()) != details) diff --git a/chrome/browser/ui/views/extensions/extension_popup.h b/chrome/browser/ui/views/extensions/extension_popup.h index 2358ab2..7f0abc3 100644 --- a/chrome/browser/ui/views/extensions/extension_popup.h +++ b/chrome/browser/ui/views/extensions/extension_popup.h @@ -82,7 +82,7 @@ class ExtensionPopup : public BrowserBubble, bool lost_focus_to_child); // NotificationObserver overrides. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/views/file_manager_dialog_browsertest.cc b/chrome/browser/ui/views/file_manager_dialog_browsertest.cc index 0e5862b..35c98b4 100644 --- a/chrome/browser/ui/views/file_manager_dialog_browsertest.cc +++ b/chrome/browser/ui/views/file_manager_dialog_browsertest.cc @@ -130,7 +130,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerDialogTest, SelectFileAndCancel) { // Inject JavaScript to click the cancel button and wait for notification // that the window has closed. ui_test_utils::WindowedNotificationObserver host_destroyed( - NotificationType::RENDER_WIDGET_HOST_DESTROYED, + chrome::RENDER_WIDGET_HOST_DESTROYED, NotificationService::AllSources()); RenderViewHost* host = dialog_->GetRenderViewHost(); string16 main_frame; @@ -194,7 +194,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerDialogTest, SelectFileAndOpen) { // Inject JavaScript to click the open button and wait for notification // that the window has closed. ui_test_utils::WindowedNotificationObserver host_destroyed( - NotificationType::RENDER_WIDGET_HOST_DESTROYED, + chrome::RENDER_WIDGET_HOST_DESTROYED, NotificationService::AllSources()); RenderViewHost* host = dialog_->GetRenderViewHost(); string16 main_frame; @@ -254,7 +254,7 @@ IN_PROC_BROWSER_TEST_F(FileManagerDialogTest, SelectFileAndSave) { // Inject JavaScript to click the save button and wait for notification // that the window has closed. ui_test_utils::WindowedNotificationObserver host_destroyed( - NotificationType::RENDER_WIDGET_HOST_DESTROYED, + chrome::RENDER_WIDGET_HOST_DESTROYED, NotificationService::AllSources()); RenderViewHost* host = dialog_->GetRenderViewHost(); string16 main_frame; diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc index 5834ba7..b4349e7 100644 --- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/find_bar_host.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" #include "content/browser/tab_contents/tab_contents.h" @@ -325,7 +326,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, PasteWithoutTextChange) { Source<TabContents> notification_source(browser()->GetSelectedTabContents()); ui_test_utils::WindowedNotificationObserverWithDetails <FindNotificationDetails> observer( - NotificationType::FIND_RESULT_AVAILABLE, notification_source); + chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, notification_source); ASSERT_TRUE(ui_test_utils::SendKeyPressSync( browser(), ui::VKEY_V, true, false, false, false)); diff --git a/chrome/browser/ui/views/frame/browser_root_view.cc b/chrome/browser/ui/views/frame/browser_root_view.cc index 51c606a..49d2fbe 100644 --- a/chrome/browser/ui/views/frame/browser_root_view.cc +++ b/chrome/browser/ui/views/frame/browser_root_view.cc @@ -19,8 +19,8 @@ #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/l10n/l10n_util.h" #if defined(TOUCH_UI) +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "views/ime/input_method.h" #endif @@ -48,7 +48,7 @@ ui::TouchStatus BrowserRootView::OnTouchEvent(const views::TouchEvent& event) { ui::TextInputType text_input_type = input_method->GetTextInputType(); if (text_input_type != ui::TEXT_INPUT_TYPE_NONE) { NotificationService::current()->Notify( - NotificationType::EDITABLE_ELEMENT_TOUCHED, + chrome::EDITABLE_ELEMENT_TOUCHED, Source<View>(this), Details<ui::TextInputType>(&text_input_type)); } diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 556af60..7cb5cfb 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -69,6 +69,7 @@ #include "chrome/browser/ui/webui/bug_report_ui.h" #include "chrome/browser/ui/webui/task_manager_dialog.h" #include "chrome/browser/ui/window_sizer.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/native_window_notification_source.h" @@ -337,7 +338,7 @@ BrowserView::BrowserView(Browser* browser) browser_->tabstrip_model()->AddObserver(this); registrar_.Add(this, - NotificationType::SIDEBAR_CHANGED, + chrome::NOTIFICATION_SIDEBAR_CHANGED, Source<SidebarManager>(SidebarManager::GetInstance())); } @@ -1394,11 +1395,11 @@ ToolbarView* BrowserView::GetToolbarView() const { /////////////////////////////////////////////////////////////////////////////// // BrowserView, NotificationObserver implementation: -void BrowserView::Observe(NotificationType type, +void BrowserView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::SIDEBAR_CHANGED: + switch (type) { + case chrome::NOTIFICATION_SIDEBAR_CHANGED: if (Details<SidebarContainer>(details)->tab_contents() == browser_->GetSelectedTabContents()) { UpdateSidebar(); @@ -1729,7 +1730,7 @@ bool BrowserView::CanClose() { // Empty TabStripModel, it's now safe to allow the Window to be closed. NotificationService::current()->Notify( - NotificationType::WINDOW_CLOSED, + chrome::NOTIFICATION_WINDOW_CLOSED, Source<gfx::NativeWindow>(frame_->GetNativeWindow()), NotificationService::NoDetails()); return true; diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 361a79f..9da0d76 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -349,7 +349,7 @@ class BrowserView : public BrowserBubbleHost, virtual ToolbarView* GetToolbarView() const OVERRIDE; // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc index adbc5b8..b43bebb 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc @@ -19,6 +19,7 @@ #include "chrome/browser/ui/views/tabs/side_tab_strip.h" #include "chrome/browser/ui/views/tabs/tab.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/common/notification_service.h" @@ -90,7 +91,7 @@ GlassBrowserFrameView::GlassBrowserFrameView(BrowserFrame* frame, AddChildView(avatar_button_.get()); UpdateAvatarInfo(); if (!browser_view_->IsOffTheRecord()) { - registrar_.Add(this, NotificationType::PROFILE_CACHED_INFO_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, NotificationService::AllSources()); } } @@ -513,11 +514,11 @@ void GlassBrowserFrameView::DisplayNextThrobberFrame() { reinterpret_cast<LPARAM>(throbber_icons_[throbber_frame_])); } -void GlassBrowserFrameView::Observe(NotificationType type, +void GlassBrowserFrameView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PROFILE_CACHED_INFO_CHANGED: + switch (type) { + case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED: UpdateAvatarInfo(); LayoutAvatar(); break; diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.h b/chrome/browser/ui/views/frame/glass_browser_frame_view.h index 79a083e..ea6aba4 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.h @@ -82,7 +82,7 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView, void DisplayNextThrobberFrame(); // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index 37f84c4..1920b04 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -18,6 +18,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/toolbar_view.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/tab_contents.h" @@ -206,7 +207,7 @@ OpaqueBrowserFrameView::OpaqueBrowserFrameView(BrowserFrame* frame, AddChildView(avatar_button_.get()); UpdateAvatarInfo(); if (!browser_view_->IsOffTheRecord()) { - registrar_.Add(this, NotificationType::PROFILE_CACHED_INFO_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, NotificationService::AllSources()); } } @@ -507,11 +508,11 @@ SkBitmap OpaqueBrowserFrameView::GetFaviconForTabIconView() { /////////////////////////////////////////////////////////////////////////////// // OpaqueBrowserFrameView, protected: -void OpaqueBrowserFrameView::Observe(NotificationType type, +void OpaqueBrowserFrameView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PROFILE_CACHED_INFO_CHANGED: + switch (type) { + case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED: UpdateAvatarInfo(); LayoutAvatar(); break; diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h index c73573d..bcf4e79 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h @@ -101,7 +101,7 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, protected: // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/html_dialog_view.cc b/chrome/browser/ui/views/html_dialog_view.cc index dd48600..3886e14 100644 --- a/chrome/browser/ui/views/html_dialog_view.cc +++ b/chrome/browser/ui/views/html_dialog_view.cc @@ -10,9 +10,9 @@ #include "chrome/browser/ui/views/window.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/native_web_keyboard_event.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "ui/base/keycodes/keyboard_codes.h" #include "views/events/event.h" #include "views/widget/root_view.h" @@ -251,33 +251,33 @@ void HtmlDialogView::InitDialog() { this); notification_registrar_.Add( this, - NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, + content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, Source<TabContents>(tab_contents())); notification_registrar_.Add( this, - NotificationType::LOAD_COMPLETED_MAIN_FRAME, + content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, Source<TabContents>(tab_contents())); DOMView::LoadURL(GetDialogContentURL()); } -void HtmlDialogView::Observe(NotificationType type, +void HtmlDialogView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: { + switch (type) { + case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { RenderWidgetHost* rwh = Details<RenderWidgetHost>(details).ptr(); notification_registrar_.Add( this, - NotificationType::RENDER_WIDGET_HOST_DID_PAINT, + content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, Source<RenderWidgetHost>(rwh)); break; } - case NotificationType::LOAD_COMPLETED_MAIN_FRAME: + case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: if (state_ == INITIALIZED) state_ = LOADED; break; - case NotificationType::RENDER_WIDGET_HOST_DID_PAINT: + case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: if (state_ == LOADED) { state_ = PAINTED; #if defined(OS_CHROMEOS) @@ -287,7 +287,7 @@ void HtmlDialogView::Observe(NotificationType type, } break; default: - NOTREACHED() << "unknown type" << type.value; + NOTREACHED() << "unknown type" << type; } } diff --git a/chrome/browser/ui/views/html_dialog_view.h b/chrome/browser/ui/views/html_dialog_view.h index cc06018..06e8a56 100644 --- a/chrome/browser/ui/views/html_dialog_view.h +++ b/chrome/browser/ui/views/html_dialog_view.h @@ -85,7 +85,7 @@ class HtmlDialogView virtual void CloseContents(TabContents* source) OVERRIDE; // Overridden from NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 9b3b79f..b87739b 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -36,6 +36,7 @@ #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" #include "chrome/browser/ui/views/location_bar/star_view.h" #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/renderer_host/render_widget_host_view.h" @@ -319,7 +320,7 @@ void LocationBarView::UpdatePageActions() { RefreshPageActionViews(); if (page_action_views_.size() != count_before) { NotificationService::current()->Notify( - NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, Source<LocationBar>(this), NotificationService::NoDetails()); } @@ -333,7 +334,7 @@ void LocationBarView::InvalidatePageActions() { DeletePageActionViews(); if (page_action_views_.size() != count_before) { NotificationService::current()->Notify( - NotificationType::EXTENSION_PAGE_ACTION_COUNT_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, Source<LocationBar>(this), NotificationService::NoDetails()); } @@ -984,7 +985,7 @@ void LocationBarView::RefreshPageActionViews() { if (old_visibility.find(action) == old_visibility.end() || old_visibility[action] != (*i)->IsVisible()) { NotificationService::current()->Notify( - NotificationType::EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, Source<ExtensionAction>(action), Details<TabContents>(contents)); } @@ -1239,10 +1240,10 @@ void LocationBarView::OnTemplateURLServiceChanged() { ShowFirstRunBubble(bubble_type_); } -void LocationBarView::Observe(NotificationType type, +void LocationBarView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { std::string* name = Details<std::string>(details).ptr(); if (*name == prefs::kEditBookmarksEnabled) Update(NULL); diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index f3d024d..89dc545 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -267,7 +267,7 @@ class LocationBarView : public LocationBar, virtual void OnTemplateURLServiceChanged() OVERRIDE; // Overridden from NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index b0566a1..1b8dcf5 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -15,11 +15,12 @@ #include "chrome/browser/notifications/notification_options_menu_model.h" #include "chrome/browser/ui/views/bubble/bubble_border.h" #include "chrome/browser/ui/views/notifications/balloon_view_host.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" @@ -357,8 +358,9 @@ void BalloonViewImpl::Show(Balloon* balloon) { html_container_->Show(); frame_container_->Show(); - notification_registrar_.Add(this, - NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon)); + notification_registrar_.Add( + this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, + Source<Balloon>(balloon)); } void BalloonViewImpl::RunOptionsMenu(const gfx::Point& pt) { @@ -488,17 +490,18 @@ void BalloonViewImpl::OnBoundsChanged(const gfx::Rect& previous_bounds) { SizeContentsWindow(); } -void BalloonViewImpl::Observe(NotificationType type, +void BalloonViewImpl::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::NOTIFY_BALLOON_DISCONNECTED) { + if (type != chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED) { NOTREACHED(); return; } // If the renderer process attached to this balloon is disconnected // (e.g., because of a crash), we want to close the balloon. - notification_registrar_.Remove(this, - NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); + notification_registrar_.Remove( + this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, + Source<Balloon>(balloon_)); Close(false); } diff --git a/chrome/browser/ui/views/notifications/balloon_view.h b/chrome/browser/ui/views/notifications/balloon_view.h index a52598c..be1195e 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.h +++ b/chrome/browser/ui/views/notifications/balloon_view.h @@ -80,7 +80,7 @@ class BalloonViewImpl : public BalloonView, views::Button* sender, const views::Event&) OVERRIDE; // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index 32c65d9..08b65b9 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc @@ -15,6 +15,7 @@ #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h" #include "chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" #include "googleurl/src/gurl.h" @@ -144,9 +145,9 @@ OmniboxViewViews::OmniboxViewViews(AutocompleteEditController* controller, } OmniboxViewViews::~OmniboxViewViews() { - NotificationService::current()->Notify(NotificationType::OMNIBOX_DESTROYED, - Source<OmniboxViewViews>(this), - NotificationService::NoDetails()); + NotificationService::current()->Notify( + chrome::NOTIFICATION_OMNIBOX_DESTROYED, Source<OmniboxViewViews>(this), + NotificationService::NoDetails()); // Explicitly teardown members which have a reference to us. Just to be safe // we want them to be destroyed before destroying any other internal state. popup_view_.reset(); @@ -564,10 +565,10 @@ int OmniboxViewViews::OnPerformDrop(const views::DropTargetEvent& event) { //////////////////////////////////////////////////////////////////////////////// // OmniboxViewViews, NotificationObserver implementation: -void OmniboxViewViews::Observe(NotificationType type, +void OmniboxViewViews::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); + DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED); SetBaseColor(); } diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.h b/chrome/browser/ui/views/omnibox/omnibox_view_views.h index 3ce4b72..7b3ae8f 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.h @@ -128,7 +128,7 @@ class OmniboxViewViews : public views::View, virtual int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE; // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc index da20ab8..f7306e1 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc @@ -29,6 +29,7 @@ #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/user_metrics.h" #include "content/common/notification_service.h" @@ -482,9 +483,9 @@ OmniboxViewWin::OmniboxViewWin(const gfx::Font& font, } OmniboxViewWin::~OmniboxViewWin() { - NotificationService::current()->Notify(NotificationType::OMNIBOX_DESTROYED, - Source<OmniboxViewWin>(this), - NotificationService::NoDetails()); + NotificationService::current()->Notify( + chrome::NOTIFICATION_OMNIBOX_DESTROYED, Source<OmniboxViewWin>(this), + NotificationService::NoDetails()); // Explicitly release the text object model now that we're done with it, and // before we free the library. If the library gets unloaded before this diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc index 3f99810..00c8823 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc @@ -26,15 +26,15 @@ TabContentsContainer::~TabContentsContainer() { //////////////////////////////////////////////////////////////////////////////// // TabContentsContainer, NotificationObserver implementation: -void TabContentsContainer::Observe(NotificationType type, +void TabContentsContainer::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::RENDER_VIEW_HOST_CHANGED) { + if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) { RenderViewHostSwitchedDetails* switched_details = Details<RenderViewHostSwitchedDetails>(details).ptr(); RenderViewHostChanged(switched_details->old_host, switched_details->new_host); - } else if (type == NotificationType::TAB_CONTENTS_DESTROYED) { + } else if (type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED) { TabContentsDestroyed(Source<TabContents>(source).ptr()); } else { NOTREACHED(); @@ -56,11 +56,11 @@ void TabContentsContainer::AddObservers() { // shown and getting focused. We need to keep track of that so we install // the focus subclass on the shown HWND so we intercept focus change events. registrar_.Add(this, - NotificationType::RENDER_VIEW_HOST_CHANGED, + content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, Source<NavigationController>(&tab_contents_->controller())); registrar_.Add(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_)); } diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container_native.h b/chrome/browser/ui/views/tab_contents/tab_contents_container_native.h index 7bb0338..da28347 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container_native.h +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container_native.h @@ -42,7 +42,7 @@ class TabContentsContainer : public views::View, void SetReservedContentsRect(const gfx::Rect& reserved_rect); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container_views.h b/chrome/browser/ui/views/tab_contents/tab_contents_container_views.h index f0bf995..2b9a427 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container_views.h +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container_views.h @@ -44,7 +44,7 @@ class TabContentsContainer : public views::View, void SetReservedContentsRect(const gfx::Rect& reserved_rect); // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc index fbbc24e..e8cfdb95 100644 --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc @@ -16,6 +16,7 @@ #include "chrome/browser/ui/tabs/tab_menu_model.h" #include "chrome/browser/ui/views/tabs/base_tab_strip.h" #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" @@ -137,7 +138,7 @@ BrowserTabStripController::BrowserTabStripController(Browser* browser, model_->AddObserver(this); notification_registrar_.Add(this, - NotificationType::TAB_CLOSEABLE_STATE_CHANGED, + chrome::NOTIFICATION_TAB_CLOSEABLE_STATE_CHANGED, NotificationService::AllSources()); } @@ -403,9 +404,9 @@ void BrowserTabStripController::TabBlockedStateChanged( //////////////////////////////////////////////////////////////////////////////// // BrowserTabStripController, NotificationObserver implementation: -void BrowserTabStripController::Observe(NotificationType type, +void BrowserTabStripController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type.value == NotificationType::TAB_CLOSEABLE_STATE_CHANGED); + DCHECK(type == chrome::NOTIFICATION_TAB_CLOSEABLE_STATE_CHANGED); // Note that this notification may be fired during a model mutation and // possibly before the tabstrip has processed the change. // Here, we just re-layout each existing tab to reflect the change in its diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h index 8d5622f..f1a2f85 100644 --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h @@ -92,7 +92,7 @@ class BrowserTabStripController : public TabStripController, int model_index) OVERRIDE; // NotificationObserver implementation: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc index 2af3101..c499bcb 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc @@ -397,7 +397,7 @@ void DraggedTabController::InitTabDragData(BaseTab* tab, drag_data->source_model_index); drag_data->pinned = source_tabstrip_->IsTabPinned(tab); registrar_.Add(this, - NotificationType::TAB_CONTENTS_DESTROYED, + content::NOTIFICATION_TAB_CONTENTS_DESTROYED, Source<TabContents>(drag_data->contents->tab_contents())); // We need to be the delegate so we receive messages about stuff, otherwise @@ -471,10 +471,10 @@ DraggedTabController::GetJavaScriptDialogCreator() { /////////////////////////////////////////////////////////////////////////////// // DraggedTabController, NotificationObserver implementation: -void DraggedTabController::Observe(NotificationType type, +void DraggedTabController::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(type.value, NotificationType::TAB_CONTENTS_DESTROYED); + DCHECK_EQ(type, content::NOTIFICATION_TAB_CONTENTS_DESTROYED); TabContents* destroyed_contents = Source<TabContents>(source).ptr(); for (size_t i = 0; i < drag_data_.size(); ++i) { if (drag_data_[i].contents->tab_contents() == destroyed_contents) { diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.h b/chrome/browser/ui/views/tabs/dragged_tab_controller.h index c59aad7..0ef7bc3 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_controller.h +++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.h @@ -146,7 +146,7 @@ class DraggedTabController : public TabContentsDelegate, GetJavaScriptDialogCreator() OVERRIDE; // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/theme_install_bubble_view.cc b/chrome/browser/ui/views/theme_install_bubble_view.cc index b099af95..c3e09e4 100644 --- a/chrome/browser/ui/views/theme_install_bubble_view.cc +++ b/chrome/browser/ui/views/theme_install_bubble_view.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ui/views/theme_install_bubble_view.h" #include "base/utf_string_conversions.h" +#include "chrome/common/chrome_notification_types.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -47,27 +48,27 @@ ThemeInstallBubbleView::ThemeInstallBubbleView(TabContents* tab_contents) // Close when theme has been installed. registrar_.Add( this, - NotificationType::BROWSER_THEME_CHANGED, + chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); // Close when we are installing an extension, not a theme. registrar_.Add( this, - NotificationType::NO_THEME_DETECTED, + chrome::NOTIFICATION_NO_THEME_DETECTED, NotificationService::AllSources()); registrar_.Add( this, - NotificationType::EXTENSION_INSTALLED, + chrome::NOTIFICATION_EXTENSION_INSTALLED, NotificationService::AllSources()); registrar_.Add( this, - NotificationType::EXTENSION_INSTALL_ERROR, + chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, NotificationService::AllSources()); // Don't let the bubble overlap the confirm dialog. registrar_.Add( this, - NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, NotificationService::AllSources()); popup_ = new views::Widget; @@ -156,7 +157,7 @@ void ThemeInstallBubbleView::Close() { } } -void ThemeInstallBubbleView::Observe(NotificationType type, +void ThemeInstallBubbleView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { Close(); diff --git a/chrome/browser/ui/views/theme_install_bubble_view.h b/chrome/browser/ui/views/theme_install_bubble_view.h index 6463a5d..08aacc8 100644 --- a/chrome/browser/ui/views/theme_install_bubble_view.h +++ b/chrome/browser/ui/views/theme_install_bubble_view.h @@ -37,7 +37,7 @@ class ThemeInstallBubbleView : public NotificationObserver, virtual ~ThemeInstallBubbleView(); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index b1edf03..046b1b3 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -17,6 +17,7 @@ #include "chrome/browser/ui/views/event_utils.h" #include "chrome/browser/ui/views/wrench_menu.h" #include "chrome/browser/upgrade_detector.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/accessibility/browser_accessibility_state.h" #include "content/browser/user_metrics.h" @@ -103,9 +104,10 @@ ToolbarView::ToolbarView(Browser* browser) IDR_LOCATIONBG_POPUPMODE_EDGE); } - registrar_.Add(this, NotificationType::UPGRADE_RECOMMENDED, + registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::MODULE_INCOMPATIBILITY_BADGE_CHANGE, + registrar_.Add(this, + chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, NotificationService::AllSources()); } @@ -404,17 +406,18 @@ void ToolbarView::ButtonPressed(views::Button* sender, //////////////////////////////////////////////////////////////////////////////// // ToolbarView, NotificationObserver implementation: -void ToolbarView::Observe(NotificationType type, +void ToolbarView::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kShowHomeButton) { Layout(); SchedulePaint(); } - } else if (type == NotificationType::UPGRADE_RECOMMENDED || - type == NotificationType::MODULE_INCOMPATIBILITY_BADGE_CHANGE) { + } else if ( + type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED || + type == chrome::NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE) { UpdateAppMenuBadge(); } } diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h index ad5842c..4874dfb 100644 --- a/chrome/browser/ui/views/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar_view.h @@ -110,7 +110,7 @@ class ToolbarView : public AccessiblePaneView, OVERRIDE; // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc index 93abf2a..c08882f 100644 --- a/chrome/browser/ui/views/wrench_menu.cc +++ b/chrome/browser/ui/views/wrench_menu.cc @@ -16,10 +16,10 @@ #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/user_metrics.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -438,7 +438,7 @@ class WrenchMenu::ZoomView : public WrenchMenuView, UpdateZoomControls(); registrar_.Add( - this, NotificationType::ZOOM_LEVEL_CHANGED, + this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, Source<HostZoomMap>(menu->browser_->profile()->GetHostZoomMap())); } @@ -488,10 +488,10 @@ class WrenchMenu::ZoomView : public WrenchMenuView, } // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(NotificationType::ZOOM_LEVEL_CHANGED, type.value); + DCHECK_EQ(content::NOTIFICATION_ZOOM_LEVEL_CHANGED, type); UpdateZoomControls(); } diff --git a/chrome/browser/ui/web_applications/web_app_ui.cc b/chrome/browser/ui/web_applications/web_app_ui.cc index b7a68b4..64761af0 100644 --- a/chrome/browser/ui/web_applications/web_app_ui.cc +++ b/chrome/browser/ui/web_applications/web_app_ui.cc @@ -44,7 +44,7 @@ class UpdateShortcutWorker : public NotificationObserver { private: // Overridden from NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -99,7 +99,7 @@ UpdateShortcutWorker::UpdateShortcutWorker(TabContentsWrapper* tab_contents) &unprocessed_icons_); file_name_ = web_app::internals::GetSanitizedFileName(shortcut_info_.title); - registrar_.Add(this, NotificationType::TAB_CLOSING, + registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, Source<NavigationController>(&tab_contents_->controller())); } @@ -108,10 +108,10 @@ void UpdateShortcutWorker::Run() { DownloadIcon(); } -void UpdateShortcutWorker::Observe(NotificationType type, +void UpdateShortcutWorker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::TAB_CLOSING && + if (type == content::NOTIFICATION_TAB_CLOSING && Source<NavigationController>(source).ptr() == &tab_contents_->controller()) { // Underlying tab is closing. diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc b/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc index 67852a4..ec1e264 100644 --- a/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc +++ b/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc @@ -17,14 +17,14 @@ class NavigationNotificationObserver : public NotificationObserver { NavigationNotificationObserver() : got_navigation_(false), http_status_code_(0) { - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, NotificationService::AllSources()); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE { - DCHECK_EQ(NotificationType::NAV_ENTRY_COMMITTED, type.value); + DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); got_navigation_ = true; http_status_code_ = Details<content::LoadCommittedDetails>(details)-> diff --git a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc index 41e31cd..fb5a267 100644 --- a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc +++ b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc @@ -19,8 +19,8 @@ #include "chrome/common/url_constants.h" #include "content/browser/browser_thread.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -444,14 +444,14 @@ void SimUnlockHandler::EnterCode(const std::string& code, void SimUnlockHandler::NotifyOnEnterPinEnded(bool cancelled) { NotificationService::current()->Notify( - NotificationType::ENTER_PIN_ENDED, + chrome::ENTER_PIN_ENDED, NotificationService::AllSources(), Details<bool>(&cancelled)); } void SimUnlockHandler::NotifyOnRequirePinChangeEnded(bool new_value) { NotificationService::current()->Notify( - NotificationType::REQUIRE_PIN_SETTING_CHANGE_ENDED, + chrome::REQUIRE_PIN_SETTING_CHANGE_ENDED, NotificationService::AllSources(), Details<bool>(&new_value)); } diff --git a/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc b/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc index de3de0b..25b6630 100644 --- a/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc +++ b/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc @@ -151,7 +151,7 @@ CollectedCookiesUIDelegate::CollectedCookiesUIDelegate( HostContentSettingsMap* host_content_settings_map = tab_contents_->profile()->GetHostContentSettingsMap(); - registrar_.Add(this, NotificationType::COLLECTED_COOKIES_SHOWN, + registrar_.Add(this, chrome::COLLECTED_COOKIES_SHOWN, Source<TabSpecificContentSettings>(content_settings)); allowed_cookies_tree_model_.reset( @@ -237,10 +237,10 @@ void CollectedCookiesUIDelegate::AddContentException( } } -void CollectedCookiesUIDelegate::Observe(NotificationType type, +void CollectedCookiesUIDelegate::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(type.value, NotificationType::COLLECTED_COOKIES_SHOWN); + DCHECK_EQ(type, chrome::COLLECTED_COOKIES_SHOWN); CloseDialog(); } diff --git a/chrome/browser/ui/webui/collected_cookies_ui_delegate.h b/chrome/browser/ui/webui/collected_cookies_ui_delegate.h index a7066e4..493a2db 100644 --- a/chrome/browser/ui/webui/collected_cookies_ui_delegate.h +++ b/chrome/browser/ui/webui/collected_cookies_ui_delegate.h @@ -61,7 +61,7 @@ class CollectedCookiesUIDelegate : public HtmlDialogUIDelegate, ContentSetting setting); // Notification Observer implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/conflicts_ui.cc b/chrome/browser/ui/webui/conflicts_ui.cc index f0a08e3..a5dc564 100644 --- a/chrome/browser/ui/webui/conflicts_ui.cc +++ b/chrome/browser/ui/webui/conflicts_ui.cc @@ -14,6 +14,7 @@ #include "chrome/browser/enumerate_modules_model_win.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/url_constants.h" #include "content/browser/tab_contents/tab_contents.h" @@ -128,7 +129,7 @@ class ConflictsDOMHandler : public WebUIMessageHandler, private: void SendModuleList(); - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -144,7 +145,7 @@ void ConflictsDOMHandler::RegisterMessages() { void ConflictsDOMHandler::HandleRequestModuleList(const ListValue* args) { // This request is handled asynchronously. See Observe for when we reply back. - registrar_.Add(this, NotificationType::MODULE_LIST_ENUMERATED, + registrar_.Add(this, chrome::NOTIFICATION_MODULE_LIST_ENUMERATED, NotificationService::AllSources()); EnumerateModulesModel::GetInstance()->ScanNow(); } @@ -175,11 +176,11 @@ void ConflictsDOMHandler::SendModuleList() { web_ui_->CallJavascriptFunction("returnModuleList", results); } -void ConflictsDOMHandler::Observe(NotificationType type, +void ConflictsDOMHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::MODULE_LIST_ENUMERATED: + switch (type) { + case chrome::NOTIFICATION_MODULE_LIST_ENUMERATED: SendModuleList(); registrar_.RemoveAll(); break; diff --git a/chrome/browser/ui/webui/history2_ui.cc b/chrome/browser/ui/webui/history2_ui.cc index b5488a9..ab9385c 100644 --- a/chrome/browser/ui/webui/history2_ui.cc +++ b/chrome/browser/ui/webui/history2_ui.cc @@ -24,6 +24,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/webui/favicon_source.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/time_format.h" #include "chrome/common/url_constants.h" @@ -135,7 +136,7 @@ WebUIMessageHandler* BrowsingHistoryHandler2::Attach(WebUI* web_ui) { new FaviconSource(profile, FaviconSource::FAVICON)); // Get notifications when history is cleared. - registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, Source<Profile>(web_ui->GetProfile()->GetOriginalProfile())); return WebUIMessageHandler::Attach(web_ui); } @@ -374,10 +375,10 @@ history::QueryOptions BrowsingHistoryHandler2::CreateMonthQueryOptions( return options; } -void BrowsingHistoryHandler2::Observe(NotificationType type, +void BrowsingHistoryHandler2::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::HISTORY_URLS_DELETED) { + if (type != chrome::NOTIFICATION_HISTORY_URLS_DELETED) { NOTREACHED(); return; } diff --git a/chrome/browser/ui/webui/history2_ui.h b/chrome/browser/ui/webui/history2_ui.h index 26d12b0..4ad6e90 100644 --- a/chrome/browser/ui/webui/history2_ui.h +++ b/chrome/browser/ui/webui/history2_ui.h @@ -62,7 +62,7 @@ class BrowsingHistoryHandler2 : public WebUIMessageHandler, void HandleClearBrowsingData(const ListValue* args); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc index e8d3765..cefc2a7 100644 --- a/chrome/browser/ui/webui/history_ui.cc +++ b/chrome/browser/ui/webui/history_ui.cc @@ -25,6 +25,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" #include "chrome/browser/ui/webui/favicon_source.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/time_format.h" #include "chrome/common/url_constants.h" @@ -138,7 +139,7 @@ WebUIMessageHandler* BrowsingHistoryHandler::Attach(WebUI* web_ui) { new FaviconSource(profile, FaviconSource::FAVICON)); // Get notifications when history is cleared. - registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, + registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, Source<Profile>(profile->GetOriginalProfile())); return WebUIMessageHandler::Attach(web_ui); } @@ -365,10 +366,10 @@ history::QueryOptions BrowsingHistoryHandler::CreateMonthQueryOptions( return options; } -void BrowsingHistoryHandler::Observe(NotificationType type, +void BrowsingHistoryHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::HISTORY_URLS_DELETED) { + if (type != chrome::NOTIFICATION_HISTORY_URLS_DELETED) { NOTREACHED(); return; } diff --git a/chrome/browser/ui/webui/history_ui.h b/chrome/browser/ui/webui/history_ui.h index b3523a5..78a85b7 100644 --- a/chrome/browser/ui/webui/history_ui.h +++ b/chrome/browser/ui/webui/history_ui.h @@ -41,7 +41,7 @@ class BrowsingHistoryHandler : public WebUIMessageHandler, void HandleClearBrowsingData(const ListValue* args); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals_ui.cc index e16204a..e4d83ec 100644 --- a/chrome/browser/ui/webui/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals_ui.cc @@ -32,6 +32,7 @@ #include "chrome/browser/prerender/prerender_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/jstemplate_builder.h" @@ -39,7 +40,6 @@ #include "chrome/common/url_constants.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/net_internals_resources.h" #include "net/base/escape.h" @@ -166,7 +166,7 @@ class NetInternalsMessageHandler void CallJavascriptFunction(const std::wstring& function_name, Value* arg); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -638,11 +638,11 @@ void NetInternalsMessageHandler::CallJavascriptFunction( } } -void NetInternalsMessageHandler::Observe(NotificationType type, +void NetInternalsMessageHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK_EQ(type.value, NotificationType::PREF_CHANGED); + DCHECK_EQ(type, chrome::NOTIFICATION_PREF_CHANGED); std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kHttpThrottlingEnabled) { diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 782bdb4..5590295 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -27,6 +27,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/webui/extension_icon_source.h" #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" @@ -37,7 +38,6 @@ #include "content/browser/disposition_utils.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" @@ -214,14 +214,14 @@ void AppLauncherHandler::RegisterMessages() { NewCallback(this, &AppLauncherHandler::HandleSaveAppPageName)); } -void AppLauncherHandler::Observe(NotificationType type, +void AppLauncherHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (ignore_changes_) return; - switch (type.value) { - case NotificationType::APP_NOTIFICATION_STATE_CHANGED: { + switch (type) { + case chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED: { const std::string& id = *Details<const std::string>(details).ptr(); const AppNotification* notification = extensions_service_->app_notification_manager()->GetLast(id); @@ -232,10 +232,10 @@ void AppLauncherHandler::Observe(NotificationType type, web_ui_->CallJavascriptFunction("appNotificationChanged", args); break; } - case NotificationType::EXTENSION_LOADED: - case NotificationType::EXTENSION_UNLOADED: { + case chrome::NOTIFICATION_EXTENSION_LOADED: + case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* extension = - type == NotificationType::EXTENSION_LOADED ? + type == chrome::NOTIFICATION_EXTENSION_LOADED ? Details<const Extension>(details).ptr() : Details<UnloadedExtensionInfo>(details)->extension; if (!extension->is_app()) @@ -244,7 +244,7 @@ void AppLauncherHandler::Observe(NotificationType type, if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) { scoped_ptr<DictionaryValue> app_info(GetAppInfo(extension)); std::string function = - type.value == NotificationType::EXTENSION_LOADED ? + type == chrome::NOTIFICATION_EXTENSION_LOADED ? "ntp4.appAdded" : "ntp4.appRemoved"; web_ui_->CallJavascriptFunction(function, *app_info); } else if (web_ui_->tab_contents()) { @@ -253,14 +253,14 @@ void AppLauncherHandler::Observe(NotificationType type, break; } - case NotificationType::EXTENSION_LAUNCHER_REORDERED: + case chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED: // The promo may not load until a couple seconds after the first NTP view, // so we listen for the load notification and notify the NTP when ready. - case NotificationType::WEB_STORE_PROMO_LOADED: + case chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED: if (web_ui_->tab_contents()) HandleGetApps(NULL); break; - case NotificationType::PREF_CHANGED: { + case chrome::NOTIFICATION_PREF_CHANGED: { if (!web_ui_->tab_contents()) break; // Handle app page renames. @@ -399,15 +399,15 @@ void AppLauncherHandler::HandleGetApps(const ListValue* args) { // First time we get here we set up the observer so that we can tell update // the apps as they change. if (registrar_.IsEmpty()) { - registrar_.Add(this, NotificationType::APP_NOTIFICATION_STATE_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_LAUNCHER_REORDERED, + registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::WEB_STORE_PROMO_LOADED, + registrar_.Add(this, chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, NotificationService::AllSources()); } if (pref_change_registrar_.IsEmpty()) { diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.h b/chrome/browser/ui/webui/ntp/app_launcher_handler.h index 10d2d86..6fe8a3c 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.h +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.h @@ -51,7 +51,7 @@ class AppLauncherHandler : public WebUIMessageHandler, virtual void RegisterMessages(); // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc index d16b9e1..2fdb70e 100644 --- a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc +++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc @@ -16,6 +16,7 @@ #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" #include "chrome/common/url_constants.h" @@ -42,24 +43,24 @@ void ForeignSessionHandler::RegisterMessages() { } void ForeignSessionHandler::Init() { - registrar_.Add(this, NotificationType::SYNC_CONFIGURE_DONE, + registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::FOREIGN_SESSION_UPDATED, + registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::FOREIGN_SESSION_DISABLED, + registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_DISABLED, NotificationService::AllSources()); } -void ForeignSessionHandler::Observe(NotificationType type, +void ForeignSessionHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { ListValue list_value; - switch (type.value) { - case NotificationType::SYNC_CONFIGURE_DONE: - case NotificationType::FOREIGN_SESSION_UPDATED: + switch (type) { + case chrome::NOTIFICATION_SYNC_CONFIGURE_DONE: + case chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED: HandleGetForeignSessions(&list_value); break; - case NotificationType::FOREIGN_SESSION_DISABLED: + case chrome::NOTIFICATION_FOREIGN_SESSION_DISABLED: // Calling foreignSessions with empty list will automatically hide // foreign session section. web_ui_->CallJavascriptFunction("foreignSessions", list_value); diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.h b/chrome/browser/ui/webui/ntp/foreign_session_handler.h index 7bff99a..0bb190e 100644 --- a/chrome/browser/ui/webui/ntp/foreign_session_handler.h +++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.h @@ -30,7 +30,7 @@ class ForeignSessionHandler : public WebUIMessageHandler, void Init(); // Determines how ForeignSessionHandler will interact with the new tab page. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.cc b/chrome/browser/ui/webui/ntp/most_visited_handler.cc index e4b1dd1..6b539c8 100644 --- a/chrome/browser/ui/webui/ntp/most_visited_handler.cc +++ b/chrome/browser/ui/webui/ntp/most_visited_handler.cc @@ -25,12 +25,12 @@ #include "chrome/browser/ui/webui/favicon_source.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_thread.h" #include "content/browser/user_metrics.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -73,7 +73,7 @@ WebUIMessageHandler* MostVisitedHandler::Attach(WebUI* web_ui) { // Register for notification when TopSites changes so that we can update // ourself. - registrar_.Add(this, NotificationType::TOP_SITES_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_CHANGED, Source<history::TopSites>(ts)); } @@ -349,10 +349,10 @@ const std::vector<MostVisitedHandler::MostVisitedPage>& return pages; } -void MostVisitedHandler::Observe(NotificationType type, +void MostVisitedHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(type.value, NotificationType::TOP_SITES_CHANGED); + DCHECK_EQ(type, chrome::NOTIFICATION_TOP_SITES_CHANGED); // Most visited urls changed, query again. StartQueryForMostVisited(); diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.h b/chrome/browser/ui/webui/ntp/most_visited_handler.h index d2ca8ea..4e037b8 100644 --- a/chrome/browser/ui/webui/ntp/most_visited_handler.h +++ b/chrome/browser/ui/webui/ntp/most_visited_handler.h @@ -61,7 +61,7 @@ class MostVisitedHandler : public WebUIMessageHandler, void HandleRemovePinnedURL(const ListValue* args); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc index 945471a..2b11282 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc @@ -40,6 +40,7 @@ #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" #include "chrome/browser/ui/webui/ntp/value_helper.h" #include "chrome/browser/ui/webui/theme_source.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" @@ -266,7 +267,7 @@ void MetricsHandler::HandleLogEventTime(const ListValue* args) { NOTREACHED(); } NotificationService::current()->Notify( - NotificationType::METRIC_EVENT_DURATION, + chrome::NOTIFICATION_METRIC_EVENT_DURATION, Source<TabContents>(tab), Details<MetricEventDurationDetails>(&details)); } @@ -339,7 +340,7 @@ void NewTabPageClosePromoHandler::HandleClosePromo( const ListValue* args) { web_ui_->GetProfile()->GetPrefs()->SetBoolean(prefs::kNTPPromoClosed, true); NotificationService* service = NotificationService::current(); - service->Notify(NotificationType::PROMO_RESOURCE_STATE_CHANGED, + service->Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, Source<NewTabPageClosePromoHandler>(this), NotificationService::NoDetails()); } @@ -409,11 +410,12 @@ NewTabUI::NewTabUI(TabContents* contents) contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); // Listen for theme installation. - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>( ThemeServiceFactory::GetForProfile(GetProfile()))); // Listen for bookmark bar visibility changes. - registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, + registrar_.Add(this, + chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, NotificationService::AllSources()); } @@ -431,7 +433,7 @@ void NewTabUI::PaintTimeout() { base::TimeDelta load_time = last_paint_ - start_; int load_time_ms = static_cast<int>(load_time.InMilliseconds()); NotificationService::current()->Notify( - NotificationType::INITIAL_NEW_TAB_UI_LOAD, + chrome::NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD, NotificationService::AllSources(), Details<int>(&load_time_ms)); UMA_HISTOGRAM_TIMES("NewTabUI load", load_time); @@ -447,7 +449,7 @@ void NewTabUI::PaintTimeout() { void NewTabUI::StartTimingPaint(RenderViewHost* render_view_host) { start_ = base::TimeTicks::Now(); last_paint_ = start_; - registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DID_PAINT, + registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, Source<RenderWidgetHost>(render_view_host)); timer_.Start(base::TimeDelta::FromMilliseconds(kTimeoutMs), this, &NewTabUI::PaintTimeout); @@ -461,11 +463,11 @@ void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { StartTimingPaint(render_view_host); } -void NewTabUI::Observe(NotificationType type, +void NewTabUI::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::BROWSER_THEME_CHANGED: { + switch (type) { + case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: { InitializeCSSCaches(); ListValue args; args.Append(Value::CreateStringValue( @@ -475,7 +477,7 @@ void NewTabUI::Observe(NotificationType type, CallJavascriptFunction("themeChanged", args); break; } - case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: { + case chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: { if (GetProfile()->GetPrefs()->IsManagedPreference( prefs::kEnableBookmarkBar)) { break; @@ -486,12 +488,12 @@ void NewTabUI::Observe(NotificationType type, CallJavascriptFunction("bookmarkBarDetached"); break; } - case NotificationType::RENDER_WIDGET_HOST_DID_PAINT: { + case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: { last_paint_ = base::TimeTicks::Now(); break; } default: - CHECK(false) << "Unexpected notification: " << type.value; + CHECK(false) << "Unexpected notification: " << type; } } diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.h b/chrome/browser/ui/webui/ntp/new_tab_ui.h index 3b580316..cc27f6a 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.h +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.h @@ -89,7 +89,7 @@ class NewTabUI : public ChromeWebUI, private: FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc index d545b27..c2973fd 100644 --- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc +++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc @@ -12,6 +12,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/sync_setup_flow.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_details.h" @@ -33,10 +34,10 @@ void NTPLoginHandler::RegisterMessages() { NewCallback(this, &NTPLoginHandler::HandleInitializeLogin)); } -void NTPLoginHandler::Observe(NotificationType type, +void NTPLoginHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::PREF_CHANGED); + DCHECK(type == chrome::NOTIFICATION_PREF_CHANGED); std::string* name = Details<std::string>(details).ptr(); if (prefs::kGoogleServicesUsername == *name) UpdateLogin(); diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.h b/chrome/browser/ui/webui/ntp/ntp_login_handler.h index d39c6cd..5811f40 100644 --- a/chrome/browser/ui/webui/ntp/ntp_login_handler.h +++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.h @@ -25,7 +25,7 @@ class NTPLoginHandler : public WebUIMessageHandler, virtual void RegisterMessages(); // NotificationObserver interface - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc index 959295c..75eb237 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc @@ -25,6 +25,7 @@ #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" #include "chrome/browser/web_resource/promo_resource_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" @@ -34,7 +35,6 @@ #include "content/browser/browser_thread.h" #include "content/browser/user_metrics.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -154,10 +154,10 @@ bool InDateRange(double begin, double end) { } // namespace NTPResourceCache::NTPResourceCache(Profile* profile) : profile_(profile) { - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, Source<ThemeService>( ThemeServiceFactory::GetForProfile(profile))); - registrar_.Add(this, NotificationType::PROMO_RESOURCE_STATE_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, NotificationService::AllSources()); // Watch for pref changes that cause us to need to invalidate the HTML cache. @@ -195,16 +195,16 @@ RefCountedBytes* NTPResourceCache::GetNewTabCSS(bool is_incognito) { : new_tab_css_.get(); } -void NTPResourceCache::Observe(NotificationType type, +void NTPResourceCache::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Invalidate the cache. - if (NotificationType::BROWSER_THEME_CHANGED == type || - NotificationType::PROMO_RESOURCE_STATE_CHANGED == type) { + if (chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type || + chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED == type) { new_tab_incognito_html_ = NULL; new_tab_html_ = NULL; new_tab_incognito_css_ = NULL; new_tab_css_ = NULL; - } else if (NotificationType::PREF_CHANGED == type) { + } else if (chrome::NOTIFICATION_PREF_CHANGED == type) { std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kShowBookmarkBar || *pref_name == prefs::kEnableBookmarkBar || diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.h b/chrome/browser/ui/webui/ntp/ntp_resource_cache.h index a8b66b0..c4a10e0 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.h +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.h @@ -28,7 +28,7 @@ class NTPResourceCache : public NotificationObserver, RefCountedBytes* GetNewTabCSS(bool is_incognito); // NotificationObserver interface. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/ntp/shown_sections_handler.cc b/chrome/browser/ui/webui/ntp/shown_sections_handler.cc index fdc42a8..d2a7963 100644 --- a/chrome/browser/ui/webui/ntp/shown_sections_handler.cc +++ b/chrome/browser/ui/webui/ntp/shown_sections_handler.cc @@ -12,11 +12,11 @@ #include "base/values.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/user_metrics.h" #include "content/common/notification_details.h" -#include "content/common/notification_type.h" namespace { @@ -68,10 +68,10 @@ void ShownSectionsHandler::RegisterMessages() { NewCallback(this, &ShownSectionsHandler::HandleSetShownSections)); } -void ShownSectionsHandler::Observe(NotificationType type, +void ShownSectionsHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { std::string* pref_name = Details<std::string>(details).ptr(); DCHECK(*pref_name == prefs::kNTPShownSections); int sections = pref_service_->GetInteger(prefs::kNTPShownSections); diff --git a/chrome/browser/ui/webui/ntp/shown_sections_handler.h b/chrome/browser/ui/webui/ntp/shown_sections_handler.h index 1fae2e4..9571f792 100644 --- a/chrome/browser/ui/webui/ntp/shown_sections_handler.h +++ b/chrome/browser/ui/webui/ntp/shown_sections_handler.h @@ -50,7 +50,7 @@ class ShownSectionsHandler : public WebUIMessageHandler, virtual void RegisterMessages(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.cc b/chrome/browser/ui/webui/options/advanced_options_handler.cc index fd9e0c2..ac4491d 100644 --- a/chrome/browser/ui/webui/options/advanced_options_handler.cc +++ b/chrome/browser/ui/webui/options/advanced_options_handler.cc @@ -23,14 +23,15 @@ #include "chrome/browser/service/service_process_control.h" #include "chrome/browser/ui/options/options_util.h" #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/user_metrics.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -306,10 +307,10 @@ void AdvancedOptionsHandler::RegisterMessages() { #endif } -void AdvancedOptionsHandler::Observe(NotificationType type, +void AdvancedOptionsHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { std::string* pref_name = Details<std::string>(details).ptr(); if ((*pref_name == prefs::kDownloadDefaultDirectory) || (*pref_name == prefs::kPromptForDownload) || diff --git a/chrome/browser/ui/webui/options/advanced_options_handler.h b/chrome/browser/ui/webui/options/advanced_options_handler.h index ef3848df..ddc3e10 100644 --- a/chrome/browser/ui/webui/options/advanced_options_handler.h +++ b/chrome/browser/ui/webui/options/advanced_options_handler.h @@ -33,7 +33,7 @@ class AdvancedOptionsHandler virtual void RegisterMessages(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 3eadb9a..a8f3dbe 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -25,13 +25,13 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/webui/favicon_source.h" #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_thread.h" #include "content/browser/user_metrics.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -348,7 +348,7 @@ void BrowserOptionsHandler::OnItemsRemoved(int start, int length) { OnModelChanged(); } -void BrowserOptionsHandler::Observe(NotificationType type, +void BrowserOptionsHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { UpdateDefaultBrowserState(); @@ -454,7 +454,7 @@ void BrowserOptionsHandler::RequestAutocompleteSuggestions( void BrowserOptionsHandler::ToggleShowBookmarksBar(const ListValue* args) { Source<Profile> source(web_ui_->GetProfile()); NotificationService::current()->Notify( - NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, + chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, source, NotificationService::NoDetails()); } diff --git a/chrome/browser/ui/webui/options/browser_options_handler.h b/chrome/browser/ui/webui/options/browser_options_handler.h index 021a747..6c9cc95 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.h +++ b/chrome/browser/ui/webui/options/browser_options_handler.h @@ -52,7 +52,7 @@ class BrowserOptionsHandler : public OptionsPageUIHandler, private: // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc index 2186a79..dffcd35 100644 --- a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc @@ -58,13 +58,13 @@ void CoreChromeOSOptionsHandler::StopObservingPref(const std::string& path) { ::CoreOptionsHandler::StopObservingPref(path); } -void CoreChromeOSOptionsHandler::Observe(NotificationType type, +void CoreChromeOSOptionsHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Ignore the notification if this instance had caused it. if (handling_change_) return; - if (type == NotificationType::SYSTEM_SETTING_CHANGED) { + if (type == chrome::SYSTEM_SETTING_CHANGED) { NotifySettingsChanged(Details<std::string>(details).ptr()); return; } diff --git a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h index 3f37bb3..6c18fe0 100644 --- a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h +++ b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.h @@ -25,7 +25,7 @@ class CoreChromeOSOptionsHandler : public CoreOptionsHandler { virtual void StopObservingPref(const std::string& path); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc index 62f9f67..cdd7355 100644 --- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc @@ -36,8 +36,8 @@ #include "chrome/browser/ui/webui/web_ui_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/time_format.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -52,9 +52,9 @@ static const char kOtherNetworksFakePath[] = "?"; InternetOptionsHandler::InternetOptionsHandler() : chromeos::CrosOptionsPageUIHandler( new chromeos::UserCrosSettingsProvider) { - registrar_.Add(this, NotificationType::REQUIRE_PIN_SETTING_CHANGE_ENDED, + registrar_.Add(this, chrome::REQUIRE_PIN_SETTING_CHANGE_ENDED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::ENTER_PIN_ENDED, + registrar_.Add(this, chrome::ENTER_PIN_ENDED, NotificationService::AllSources()); cros_ = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); if (cros_) { @@ -527,17 +527,17 @@ void InternetOptionsHandler::OnCellularDataPlanChanged( } -void InternetOptionsHandler::Observe(NotificationType type, +void InternetOptionsHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { chromeos::CrosOptionsPageUIHandler::Observe(type, source, details); - if (type == NotificationType::REQUIRE_PIN_SETTING_CHANGE_ENDED) { + if (type == chrome::REQUIRE_PIN_SETTING_CHANGE_ENDED) { bool require_pin = *Details<bool>(details).ptr(); DictionaryValue dictionary; dictionary.SetBoolean("requirePin", require_pin); web_ui_->CallJavascriptFunction( "options.InternetOptions.updateSecurityTab", dictionary); - } else if (type == NotificationType::ENTER_PIN_ENDED) { + } else if (type == chrome::ENTER_PIN_ENDED) { // We make an assumption (which is valid for now) that the SIM // unlock dialog is put up only when the user is trying to enable // mobile data. diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h index 9b2a02b..ff86de2 100644 --- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h +++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.h @@ -43,7 +43,7 @@ class InternetOptionsHandler virtual void OnCellularDataPlanChanged(chromeos::NetworkLibrary* network_lib); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc index 84fcc19..4147832 100644 --- a/chrome/browser/ui/webui/options/content_settings_handler.cc +++ b/chrome/browser/ui/webui/options/content_settings_handler.cc @@ -21,13 +21,14 @@ #include "chrome/browser/notifications/desktop_notification_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings_helper.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "ui/base/l10n/l10n_util.h" @@ -268,25 +269,25 @@ void ContentSettingsHandler::GetLocalizedValues( void ContentSettingsHandler::Initialize() { const HostContentSettingsMap* settings_map = GetContentSettingsMap(); notification_registrar_.Add( - this, NotificationType::OTR_PROFILE_CREATED, + this, chrome::NOTIFICATION_OTR_PROFILE_CREATED, NotificationService::AllSources()); notification_registrar_.Add( - this, NotificationType::PROFILE_DESTROYED, + this, chrome::NOTIFICATION_PROFILE_DESTROYED, NotificationService::AllSources()); UpdateHandlersEnabledRadios(); UpdateAllExceptionsViewsFromModel(); notification_registrar_.Add( - this, NotificationType::CONTENT_SETTINGS_CHANGED, + this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, Source<HostContentSettingsMap>(settings_map)); notification_registrar_.Add( - this, NotificationType::DESKTOP_NOTIFICATION_DEFAULT_CHANGED, + this, chrome::NOTIFICATION_DESKTOP_NOTIFICATION_DEFAULT_CHANGED, NotificationService::AllSources()); notification_registrar_.Add( - this, NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, + this, chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED, NotificationService::AllSources()); notification_registrar_.Add( - this, NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED, + this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, NotificationService::AllSources()); PrefService* prefs = web_ui_->GetProfile()->GetPrefs(); @@ -295,11 +296,11 @@ void ContentSettingsHandler::Initialize() { pref_change_registrar_.Add(prefs::kGeolocationContentSettings, this); } -void ContentSettingsHandler::Observe(NotificationType type, +void ContentSettingsHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::PROFILE_DESTROYED: { + switch (type) { + case chrome::NOTIFICATION_PROFILE_DESTROYED: { Profile* profile = static_cast<Source<Profile> >(source).ptr(); if (profile->IsOffTheRecord()) { web_ui_->CallJavascriptFunction( @@ -308,12 +309,12 @@ void ContentSettingsHandler::Observe(NotificationType type, break; } - case NotificationType::OTR_PROFILE_CREATED: { + case chrome::NOTIFICATION_OTR_PROFILE_CREATED: { UpdateAllOTRExceptionsViewsFromModel(); break; } - case NotificationType::CONTENT_SETTINGS_CHANGED: { + case chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED: { const ContentSettingsDetails* settings_details = Details<const ContentSettingsDetails>(details).ptr(); @@ -325,7 +326,7 @@ void ContentSettingsHandler::Observe(NotificationType type, break; } - case NotificationType::PREF_CHANGED: { + case chrome::NOTIFICATION_PREF_CHANGED: { const std::string& pref_name = *Details<std::string>(details).ptr(); if (pref_name == prefs::kGeolocationDefaultContentSetting) UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_GEOLOCATION); @@ -334,17 +335,17 @@ void ContentSettingsHandler::Observe(NotificationType type, break; } - case NotificationType::DESKTOP_NOTIFICATION_DEFAULT_CHANGED: { + case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_DEFAULT_CHANGED: { UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); break; } - case NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED: { + case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: { UpdateNotificationExceptionsView(); break; } - case NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED: { + case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { UpdateHandlersEnabledRadios(); break; } diff --git a/chrome/browser/ui/webui/options/content_settings_handler.h b/chrome/browser/ui/webui/options/content_settings_handler.h index 2df9829..f183936 100644 --- a/chrome/browser/ui/webui/options/content_settings_handler.h +++ b/chrome/browser/ui/webui/options/content_settings_handler.h @@ -29,7 +29,7 @@ class ContentSettingsHandler : public OptionsPageUIHandler { virtual void RegisterMessages(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc index b2812df..7a5e2f1 100644 --- a/chrome/browser/ui/webui/options/core_options_handler.cc +++ b/chrome/browser/ui/webui/options/core_options_handler.cc @@ -14,11 +14,12 @@ #include "chrome/browser/google/google_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/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/user_metrics.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_details.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -95,10 +96,10 @@ WebUIMessageHandler* CoreOptionsHandler::Attach(WebUI* web_ui) { return result; } -void CoreOptionsHandler::Observe(NotificationType type, +void CoreOptionsHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) + if (type == chrome::NOTIFICATION_PREF_CHANGED) NotifyPrefChanged(Details<std::string>(details).ptr()); } diff --git a/chrome/browser/ui/webui/options/core_options_handler.h b/chrome/browser/ui/webui/options/core_options_handler.h index 9aa5f4f..185914d 100644 --- a/chrome/browser/ui/webui/options/core_options_handler.h +++ b/chrome/browser/ui/webui/options/core_options_handler.h @@ -27,7 +27,7 @@ class CoreOptionsHandler : public OptionsPageUIHandler { virtual void Uninitialize(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/options/extension_settings_handler.cc b/chrome/browser/ui/webui/options/extension_settings_handler.cc index a8210a6..b7ac296 100644 --- a/chrome/browser/ui/webui/options/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/options/extension_settings_handler.cc @@ -40,8 +40,8 @@ #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -397,31 +397,31 @@ void ExtensionsDOMHandler::OnIconsLoaded(DictionaryValue* json) { // Register for notifications that we need to reload the page. registrar_.RemoveAll(); - registrar_.Add(this, NotificationType::EXTENSION_LOADED, + registrar_.Add(this, chrome::EXTENSION_LOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_PROCESS_CREATED, + registrar_.Add(this, chrome::EXTENSION_PROCESS_CREATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, + registrar_.Add(this, chrome::EXTENSION_UNLOADED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSION_UPDATE_DISABLED, + registrar_.Add(this, chrome::EXTENSION_UPDATE_DISABLED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::NAV_ENTRY_COMMITTED, + chrome::NAV_ENTRY_COMMITTED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::RENDER_VIEW_HOST_CREATED, + chrome::RENDER_VIEW_HOST_CREATED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::RENDER_VIEW_HOST_DELETED, + chrome::RENDER_VIEW_HOST_DELETED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::BACKGROUND_CONTENTS_NAVIGATED, + chrome::BACKGROUND_CONTENTS_NAVIGATED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::BACKGROUND_CONTENTS_DELETED, + chrome::BACKGROUND_CONTENTS_DELETED, NotificationService::AllSources()); registrar_.Add(this, - NotificationType::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, + chrome::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, NotificationService::AllSources()); } @@ -710,10 +710,10 @@ void ExtensionsDOMHandler::MultiFilesSelected( NOTREACHED(); } -void ExtensionsDOMHandler::Observe(NotificationType type, +void ExtensionsDOMHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { + switch (type) { // We listen for notifications that will result in the page being // repopulated with data twice for the same event in certain cases. // For instance, EXTENSION_LOADED & EXTENSION_PROCESS_CREATED because @@ -728,22 +728,22 @@ void ExtensionsDOMHandler::Observe(NotificationType type, // // Doing it this way gets everything but causes the page to be rendered // more than we need. It doesn't seem to result in any noticeable flicker. - case NotificationType::RENDER_VIEW_HOST_DELETED: + case chrome::RENDER_VIEW_HOST_DELETED: deleting_rvh_ = Details<RenderViewHost>(details).ptr(); MaybeUpdateAfterNotification(); break; - case NotificationType::BACKGROUND_CONTENTS_DELETED: + case chrome::BACKGROUND_CONTENTS_DELETED: deleting_rvh_ = Details<BackgroundContents>(details)->render_view_host(); MaybeUpdateAfterNotification(); break; - case NotificationType::EXTENSION_LOADED: - case NotificationType::EXTENSION_PROCESS_CREATED: - case NotificationType::EXTENSION_UNLOADED: - case NotificationType::EXTENSION_UPDATE_DISABLED: - case NotificationType::RENDER_VIEW_HOST_CREATED: - case NotificationType::NAV_ENTRY_COMMITTED: - case NotificationType::BACKGROUND_CONTENTS_NAVIGATED: - case NotificationType::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED: + case chrome::EXTENSION_LOADED: + case chrome::EXTENSION_PROCESS_CREATED: + case chrome::EXTENSION_UNLOADED: + case chrome::EXTENSION_UPDATE_DISABLED: + case chrome::RENDER_VIEW_HOST_CREATED: + case chrome::NAV_ENTRY_COMMITTED: + case chrome::BACKGROUND_CONTENTS_NAVIGATED: + case chrome::EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED: MaybeUpdateAfterNotification(); break; default: diff --git a/chrome/browser/ui/webui/options/extension_settings_handler.h b/chrome/browser/ui/webui/options/extension_settings_handler.h index c333635..c30e320 100644 --- a/chrome/browser/ui/webui/options/extension_settings_handler.h +++ b/chrome/browser/ui/webui/options/extension_settings_handler.h @@ -193,7 +193,7 @@ class ExtensionsDOMHandler : public WebUIMessageHandler, virtual void FileSelectionCanceled(void* params) {} // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/options/font_settings_handler.cc b/chrome/browser/ui/webui/options/font_settings_handler.cc index 7e416ba..95521ba 100644 --- a/chrome/browser/ui/webui/options/font_settings_handler.cc +++ b/chrome/browser/ui/webui/options/font_settings_handler.cc @@ -17,9 +17,9 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/options/font_settings_utils.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_details.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -149,10 +149,10 @@ void FontSettingsHandler::FontsListHasLoaded( selected_values); } -void FontSettingsHandler::Observe(NotificationType type, +void FontSettingsHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kWebKitStandardFontFamily) { SetUpStandardFontSample(); diff --git a/chrome/browser/ui/webui/options/font_settings_handler.h b/chrome/browser/ui/webui/options/font_settings_handler.h index 1bfee9b..b460010 100644 --- a/chrome/browser/ui/webui/options/font_settings_handler.h +++ b/chrome/browser/ui/webui/options/font_settings_handler.h @@ -27,7 +27,7 @@ class FontSettingsHandler : public base::SupportsWeakPtr<FontSettingsHandler>, virtual void RegisterMessages(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/options/handler_options_handler.cc b/chrome/browser/ui/webui/options/handler_options_handler.cc index d1ca414..04c44cb 100644 --- a/chrome/browser/ui/webui/options/handler_options_handler.cc +++ b/chrome/browser/ui/webui/options/handler_options_handler.cc @@ -10,6 +10,7 @@ #include "base/values.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_notification_types.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -41,7 +42,7 @@ void HandlerOptionsHandler::GetLocalizedValues( void HandlerOptionsHandler::Initialize() { UpdateHandlerList(); notification_registrar_.Add( - this, NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED, + this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, NotificationService::AllSources()); } @@ -156,10 +157,10 @@ ProtocolHandler HandlerOptionsHandler::ParseHandlerFromArgs( title); } -void HandlerOptionsHandler::Observe(NotificationType type, +void HandlerOptionsHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::PROTOCOL_HANDLER_REGISTRY_CHANGED) + if (type == chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED) UpdateHandlerList(); else NOTREACHED(); diff --git a/chrome/browser/ui/webui/options/handler_options_handler.h b/chrome/browser/ui/webui/options/handler_options_handler.h index ac79dad..69baf75 100644 --- a/chrome/browser/ui/webui/options/handler_options_handler.h +++ b/chrome/browser/ui/webui/options/handler_options_handler.h @@ -25,7 +25,7 @@ class HandlerOptionsHandler : public OptionsPageUIHandler { virtual void RegisterMessages(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/options/options_ui.cc b/chrome/browser/ui/webui/options/options_ui.cc index 754c744..b8eb577 100644 --- a/chrome/browser/ui/webui/options/options_ui.cc +++ b/chrome/browser/ui/webui/options/options_ui.cc @@ -44,7 +44,7 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" #include "content/browser/user_metrics.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" diff --git a/chrome/browser/ui/webui/options/options_ui.h b/chrome/browser/ui/webui/options/options_ui.h index 8886d8f..1ebbfa9 100644 --- a/chrome/browser/ui/webui/options/options_ui.h +++ b/chrome/browser/ui/webui/options/options_ui.h @@ -12,9 +12,9 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/browser/ui/webui/chrome_web_ui.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/notification_type.h" class GURL; class PrefService; @@ -44,7 +44,7 @@ class OptionsPageUIHandler : public WebUIMessageHandler, virtual void RegisterMessages() {} // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) {} diff --git a/chrome/browser/ui/webui/options/password_manager_handler.cc b/chrome/browser/ui/webui/options/password_manager_handler.cc index bc5876c..5d416c9 100644 --- a/chrome/browser/ui/webui/options/password_manager_handler.cc +++ b/chrome/browser/ui/webui/options/password_manager_handler.cc @@ -11,6 +11,7 @@ #include "chrome/browser/google/google_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/pref_names.h" #include "chrome/common/url_constants.h" #include "content/common/notification_details.h" @@ -106,10 +107,10 @@ PasswordStore* PasswordManagerHandler::GetPasswordStore() { return web_ui_->GetProfile()->GetPasswordStore(Profile::EXPLICIT_ACCESS); } -void PasswordManagerHandler::Observe(NotificationType type, +void PasswordManagerHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type.value == NotificationType::PREF_CHANGED) { + if (type == chrome::NOTIFICATION_PREF_CHANGED) { std::string* pref_name = Details<std::string>(details).ptr(); if (*pref_name == prefs::kPasswordManagerAllowShowPasswords) { UpdatePasswordLists(NULL); diff --git a/chrome/browser/ui/webui/options/password_manager_handler.h b/chrome/browser/ui/webui/options/password_manager_handler.h index 4903765..9b1e8f2 100644 --- a/chrome/browser/ui/webui/options/password_manager_handler.h +++ b/chrome/browser/ui/webui/options/password_manager_handler.h @@ -29,7 +29,7 @@ class PasswordManagerHandler : public OptionsPageUIHandler, virtual void OnLoginsChanged(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc index 3a6338c..f5131de 100644 --- a/chrome/browser/ui/webui/options/personal_options_handler.cc +++ b/chrome/browser/ui/webui/options/personal_options_handler.cc @@ -23,6 +23,7 @@ #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/net/gaia/google_service_auth_error.h" @@ -50,7 +51,7 @@ PersonalOptionsHandler::PersonalOptionsHandler() { multiprofile_ = ProfileManager::IsMultipleProfilesEnabled(); #if defined(OS_CHROMEOS) registrar_.Add(this, - NotificationType::LOGIN_USER_IMAGE_CHANGED, + chrome::LOGIN_USER_IMAGE_CHANGED, NotificationService::AllSources()); #endif } @@ -203,13 +204,13 @@ void PersonalOptionsHandler::RegisterMessages() { #endif } -void PersonalOptionsHandler::Observe(NotificationType type, +void PersonalOptionsHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::BROWSER_THEME_CHANGED) { + if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { ObserveThemeChanged(); #if defined(OS_CHROMEOS) - } else if (type == NotificationType::LOGIN_USER_IMAGE_CHANGED) { + } else if (type == chrome::LOGIN_USER_IMAGE_CHANGED) { LoadAccountPicture(NULL); #endif } else { @@ -354,7 +355,7 @@ void PersonalOptionsHandler::Initialize() { OPTIONS_PAGE_CONTENT)); // Listen for theme installation. - registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, NotificationService::AllSources()); ObserveThemeChanged(); diff --git a/chrome/browser/ui/webui/options/personal_options_handler.h b/chrome/browser/ui/webui/options/personal_options_handler.h index eb58ce4..afebea0 100644 --- a/chrome/browser/ui/webui/options/personal_options_handler.h +++ b/chrome/browser/ui/webui/options/personal_options_handler.h @@ -32,7 +32,7 @@ class PersonalOptionsHandler : public OptionsPageUIHandler, virtual void RegisterMessages(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc index feaad94..37e48cf3 100644 --- a/chrome/browser/ui/webui/plugins_ui.cc +++ b/chrome/browser/ui/webui/plugins_ui.cc @@ -114,7 +114,7 @@ class PluginsDOMHandler : public WebUIMessageHandler, void HandleGetShowDetails(const ListValue* args); // NotificationObserver method overrides - void Observe(NotificationType type, + void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -151,7 +151,7 @@ class PluginsDOMHandler : public WebUIMessageHandler, PluginsDOMHandler::PluginsDOMHandler() : ALLOW_THIS_IN_INITIALIZER_LIST(get_plugins_factory_(this)) { registrar_.Add(this, - NotificationType::PLUGIN_ENABLE_STATUS_CHANGED, + content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, NotificationService::AllSources()); } @@ -247,10 +247,10 @@ void PluginsDOMHandler::HandleGetShowDetails(const ListValue* args) { web_ui_->CallJavascriptFunction("loadShowDetailsFromPrefs", show_details); } -void PluginsDOMHandler::Observe(NotificationType type, +void PluginsDOMHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK_EQ(NotificationType::PLUGIN_ENABLE_STATUS_CHANGED, type.value); + DCHECK_EQ(content::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, type); LoadPlugins(); } diff --git a/chrome/browser/ui/webui/web_ui_test_handler.cc b/chrome/browser/ui/webui/web_ui_test_handler.cc index 4213487..704abc5 100644 --- a/chrome/browser/ui/webui/web_ui_test_handler.cc +++ b/chrome/browser/ui/webui/web_ui_test_handler.cc @@ -15,7 +15,7 @@ bool WebUITestHandler::RunJavascript(const std::string& js_test, bool is_test) { if (is_test) { NotificationRegistrar notification_registrar; notification_registrar.Add( - this, NotificationType::EXECUTE_JAVASCRIPT_RESULT, + this, content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, Source<RenderViewHost>(web_ui_->GetRenderViewHost())); web_ui_->GetRenderViewHost()->ExecuteJavascriptInWebFrameNotifyResult( string16(), UTF8ToUTF16(js_test)); @@ -27,7 +27,7 @@ bool WebUITestHandler::RunJavascript(const std::string& js_test, bool is_test) { } } -void WebUITestHandler::Observe(NotificationType type, +void WebUITestHandler::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { // Quit the message loop if we were waiting so Waiting process can get result diff --git a/chrome/browser/ui/webui/web_ui_test_handler.h b/chrome/browser/ui/webui/web_ui_test_handler.h index 304f6d4..185e69b 100644 --- a/chrome/browser/ui/webui/web_ui_test_handler.h +++ b/chrome/browser/ui/webui/web_ui_test_handler.h @@ -24,7 +24,7 @@ class WebUITestHandler : public WebUIMessageHandler, virtual void RegisterMessages() {} // From NotificationObserver. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc index e0fb2d5..994f75c 100644 --- a/chrome/browser/upgrade_detector.cc +++ b/chrome/browser/upgrade_detector.cc @@ -5,9 +5,9 @@ #include "chrome/browser/upgrade_detector.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "grit/theme_resources.h" // static @@ -43,7 +43,7 @@ void UpgradeDetector::NotifyUpgradeDetected() { upgrade_detected_time_ = base::Time::Now(); NotificationService::current()->Notify( - NotificationType::UPGRADE_DETECTED, + chrome::NOTIFICATION_UPGRADE_DETECTED, Source<UpgradeDetector>(this), NotificationService::NoDetails()); } @@ -52,7 +52,7 @@ void UpgradeDetector::NotifyUpgradeRecommended() { notify_upgrade_ = true; NotificationService::current()->Notify( - NotificationType::UPGRADE_RECOMMENDED, + chrome::NOTIFICATION_UPGRADE_RECOMMENDED, Source<UpgradeDetector>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/user_style_sheet_watcher.cc b/chrome/browser/user_style_sheet_watcher.cc index 25dc57b..86e08fd 100644 --- a/chrome/browser/user_style_sheet_watcher.cc +++ b/chrome/browser/user_style_sheet_watcher.cc @@ -6,8 +6,9 @@ #include "base/base64.h" #include "base/file_util.h" +#include "chrome/common/chrome_notification_types.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" using ::base::files::FilePathWatcher; @@ -77,7 +78,7 @@ UserStyleSheetLoader::UserStyleSheetLoader() void UserStyleSheetLoader::NotifyLoaded() { if (has_loaded_) { NotificationService::current()->Notify( - NotificationType::USER_STYLE_SHEET_UPDATED, + chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED, Source<UserStyleSheetLoader>(this), NotificationService::NoDetails()); } @@ -131,7 +132,7 @@ UserStyleSheetWatcher::UserStyleSheetWatcher(const FilePath& profile_path) // Listen for when the first render view host is created. If we load // too fast, the first tab won't hear the notification and won't get // the user style sheet. - registrar_.Add(this, NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, + registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, NotificationService::AllSources()); } @@ -163,9 +164,9 @@ GURL UserStyleSheetWatcher::user_style_sheet() const { return loader_->user_style_sheet(); } -void UserStyleSheetWatcher::Observe(NotificationType type, +void UserStyleSheetWatcher::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB); + DCHECK(type == content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB); loader_->NotifyLoaded(); registrar_.RemoveAll(); } diff --git a/chrome/browser/user_style_sheet_watcher.h b/chrome/browser/user_style_sheet_watcher.h index 9ea1aac..72f87d9f 100644 --- a/chrome/browser/user_style_sheet_watcher.h +++ b/chrome/browser/user_style_sheet_watcher.h @@ -31,7 +31,7 @@ class UserStyleSheetWatcher GURL user_style_sheet() const; // NotificationObserver interface - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/visitedlink/visitedlink_event_listener.cc b/chrome/browser/visitedlink/visitedlink_event_listener.cc index 3c5febb..cadfedb 100644 --- a/chrome/browser/visitedlink/visitedlink_event_listener.cc +++ b/chrome/browser/visitedlink/visitedlink_event_listener.cc @@ -103,11 +103,11 @@ class VisitedLinkUpdater { }; VisitedLinkEventListener::VisitedLinkEventListener() { - registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED, + registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, NotificationService::AllSources()); } @@ -158,11 +158,11 @@ void VisitedLinkEventListener::CommitVisitedLinks() { pending_visited_links_.clear(); } -void VisitedLinkEventListener::Observe(NotificationType type, +void VisitedLinkEventListener::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - switch (type.value) { - case NotificationType::RENDERER_PROCESS_CREATED: { + switch (type) { + case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); updaters_[process->id()] = make_linked_ptr(new VisitedLinkUpdater(process->id())); @@ -176,14 +176,14 @@ void VisitedLinkEventListener::Observe(NotificationType type, updaters_[process->id()]->SendVisitedLinkTable(master->shared_memory()); break; } - case NotificationType::RENDERER_PROCESS_TERMINATED: { + case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { RenderProcessHost* process = Source<RenderProcessHost>(source).ptr(); if (updaters_.count(process->id())) { updaters_.erase(process->id()); } break; } - case NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED: { + case content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED: { RenderWidgetHost* widget = Source<RenderWidgetHost>(source).ptr(); int child_id = widget->process()->id(); if (updaters_.count(child_id)) diff --git a/chrome/browser/visitedlink/visitedlink_event_listener.h b/chrome/browser/visitedlink/visitedlink_event_listener.h index 2eb7e03..9c11660 100644 --- a/chrome/browser/visitedlink/visitedlink_event_listener.h +++ b/chrome/browser/visitedlink/visitedlink_event_listener.h @@ -38,7 +38,7 @@ class VisitedLinkEventListener : public VisitedLinkMaster::Listener, void CommitVisitedLinks(); // NotificationObserver implementation. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/visitedlink/visitedlink_unittest.cc b/chrome/browser/visitedlink/visitedlink_unittest.cc index 8f4687b..54fa310 100644 --- a/chrome/browser/visitedlink/visitedlink_unittest.cc +++ b/chrome/browser/visitedlink/visitedlink_unittest.cc @@ -496,12 +496,12 @@ class VisitRelayingRenderProcessHost : public BrowserRenderProcessHost { explicit VisitRelayingRenderProcessHost(Profile* profile) : BrowserRenderProcessHost(profile) { NotificationService::current()->Notify( - NotificationType::RENDERER_PROCESS_CREATED, + content::NOTIFICATION_RENDERER_PROCESS_CREATED, Source<RenderProcessHost>(this), NotificationService::NoDetails()); } virtual ~VisitRelayingRenderProcessHost() { NotificationService::current()->Notify( - NotificationType::RENDERER_PROCESS_TERMINATED, + content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, Source<RenderProcessHost>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/web_resource/gpu_blacklist_updater.cc b/chrome/browser/web_resource/gpu_blacklist_updater.cc index 9bb0812..d0d66a6 100644 --- a/chrome/browser/web_resource/gpu_blacklist_updater.cc +++ b/chrome/browser/web_resource/gpu_blacklist_updater.cc @@ -11,12 +11,12 @@ #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" #include "content/browser/gpu/gpu_blacklist.h" #include "content/browser/gpu/gpu_data_manager.h" -#include "content/common/notification_type.h" #include "grit/browser_resources.h" #include "ui/base/resource/resource_bundle.h" @@ -42,7 +42,7 @@ GpuBlacklistUpdater::GpuBlacklistUpdater() : WebResourceService(g_browser_process->local_state(), GpuBlacklistUpdater::kDefaultGpuBlacklistURL, false, // don't append locale to URL - NotificationType::NOTIFICATION_TYPE_COUNT, + chrome::NOTIFICATION_CHROME_END, prefs::kGpuBlacklistUpdate, kStartGpuBlacklistFetchDelay, kCacheUpdateDelay) { diff --git a/chrome/browser/web_resource/promo_resource_service.cc b/chrome/browser/web_resource/promo_resource_service.cc index 6186099..8c9e9a4 100644 --- a/chrome/browser/web_resource/promo_resource_service.cc +++ b/chrome/browser/web_resource/promo_resource_service.cc @@ -13,11 +13,11 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/sync_ui_util.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/pref_names.h" #include "content/browser/browser_thread.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" namespace { @@ -115,7 +115,7 @@ PromoResourceService::PromoResourceService(Profile* profile) : WebResourceService(profile->GetPrefs(), PromoResourceService::kDefaultPromoResourceServer, true, // append locale to URL - NotificationType::PROMO_RESOURCE_STATE_CHANGED, + chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, prefs::kNTPPromoResourceCacheUpdate, kStartResourceFetchDelay, kCacheUpdateDelay), @@ -381,7 +381,7 @@ void PromoResourceService::UnpackWebStoreSignal( AppsPromo::SetWebStoreSupportedForLocale(is_webstore_active); NotificationService::current()->Notify( - NotificationType::WEB_STORE_PROMO_LOADED, + chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED, Source<PromoResourceService>(this), NotificationService::NoDetails()); @@ -450,7 +450,7 @@ void PromoResourceService::UnpackLogoSignal( prefs_->SetDouble(prefs::kNTPCustomLogoStart, logo_start); prefs_->SetDouble(prefs::kNTPCustomLogoEnd, logo_end); NotificationService* service = NotificationService::current(); - service->Notify(NotificationType::PROMO_RESOURCE_STATE_CHANGED, + service->Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, Source<WebResourceService>(this), NotificationService::NoDetails()); } diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc index a68f038..3c84ab3 100644 --- a/chrome/browser/web_resource/web_resource_service.cc +++ b/chrome/browser/web_resource/web_resource_service.cc @@ -15,6 +15,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/sync/sync_ui_util.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_utility_messages.h" #include "chrome/common/extensions/extension.h" @@ -213,7 +214,7 @@ WebResourceService::WebResourceService( PrefService* prefs, const char* web_resource_server, bool apply_locale_to_url, - NotificationType::Type notification_type, + int notification_type, const char* last_update_time_pref_name, int start_fetch_delay, int cache_update_delay) @@ -262,7 +263,7 @@ void WebResourceService::OnWebResourceUnpacked( void WebResourceService::WebResourceStateChange() { web_resource_update_scheduled_ = false; - if (notification_type_ == NotificationType::NOTIFICATION_TYPE_COUNT) + if (notification_type_ == chrome::NOTIFICATION_CHROME_END) return; NotificationService* service = NotificationService::current(); service->Notify(notification_type_, diff --git a/chrome/browser/web_resource/web_resource_service.h b/chrome/browser/web_resource/web_resource_service.h index 43f668d..1f08a9d 100644 --- a/chrome/browser/web_resource/web_resource_service.h +++ b/chrome/browser/web_resource/web_resource_service.h @@ -9,7 +9,7 @@ #include <string> #include "content/browser/utility_process_host.h" -#include "content/common/notification_type.h" +#include "content/common/content_notification_types.h" class DictionaryValue; class PrefService; @@ -24,7 +24,7 @@ class WebResourceService : public UtilityProcessHost::Client { WebResourceService(PrefService* prefs, const char* web_resource_server, bool apply_locale_to_url_, - NotificationType::Type notification_type, + int notification_type, const char* last_update_time_pref_name, int start_fetch_delay, int cache_update_delay); @@ -87,7 +87,7 @@ class WebResourceService : public UtilityProcessHost::Client { bool apply_locale_to_url_; // Notification type when an update is done. - NotificationType::Type notification_type_; + int notification_type_; // Pref name to store the last update's time. const char* last_update_time_pref_name_; diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc index 74f07e1..cc77219 100644 --- a/chrome/browser/webdata/web_data_service.cc +++ b/chrome/browser/webdata/web_data_service.cc @@ -16,10 +16,10 @@ #include "chrome/browser/webdata/autofill_entry.h" #include "chrome/browser/webdata/web_database.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" #include "content/common/notification_source.h" -#include "content/common/notification_type.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -606,9 +606,9 @@ void WebDataService::InitializeDatabaseIfNecessary() { void WebDataService::NotifyDatabaseLoadedOnUIThread() { // Notify that the database has been initialized. - NotificationService::current()->Notify(NotificationType::WEB_DATABASE_LOADED, - Source<WebDataService>(this), - NotificationService::NoDetails()); + NotificationService::current()->Notify( + chrome::NOTIFICATION_WEB_DATABASE_LOADED, Source<WebDataService>(this), + NotificationService::NoDetails()); } void WebDataService::ShutdownDatabase() { @@ -935,7 +935,7 @@ void WebDataService::AddFormElementsImpl( // This is sent here so that work resulting from this notification will be // done on the DB thread, and not the UI thread. NotificationService::current()->Notify( - NotificationType::AUTOFILL_ENTRIES_CHANGED, + chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(this), Details<AutofillChangeList>(&changes)); } @@ -971,7 +971,7 @@ void WebDataService::RemoveFormElementsAddedBetweenImpl( // This is sent here so that work resulting from this notification // will be done on the DB thread, and not the UI thread. NotificationService::current()->Notify( - NotificationType::AUTOFILL_ENTRIES_CHANGED, + chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(this), Details<AutofillChangeList>(&changes)); } @@ -998,7 +998,7 @@ void WebDataService::RemoveFormValueForElementNameImpl( // Post the notifications including the list of affected keys. NotificationService::current()->Notify( - NotificationType::AUTOFILL_ENTRIES_CHANGED, + chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(this), Details<AutofillChangeList>(&changes)); } @@ -1021,7 +1021,7 @@ void WebDataService::AddAutofillProfileImpl( AutofillProfileChange change(AutofillProfileChange::ADD, profile.guid(), &profile); NotificationService::current()->Notify( - NotificationType::AUTOFILL_PROFILE_CHANGED, + chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(this), Details<AutofillProfileChange>(&change)); } @@ -1055,7 +1055,7 @@ void WebDataService::UpdateAutofillProfileImpl( AutofillProfileChange change(AutofillProfileChange::UPDATE, profile.guid(), &profile); NotificationService::current()->Notify( - NotificationType::AUTOFILL_PROFILE_CHANGED, + chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(this), Details<AutofillProfileChange>(&change)); } @@ -1084,7 +1084,7 @@ void WebDataService::RemoveAutofillProfileImpl( // Send GUID-based notification. AutofillProfileChange change(AutofillProfileChange::REMOVE, guid, NULL); NotificationService::current()->Notify( - NotificationType::AUTOFILL_PROFILE_CHANGED, + chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(this), Details<AutofillProfileChange>(&change)); } @@ -1121,7 +1121,7 @@ void WebDataService::EmptyMigrationTrashImpl( AutofillProfileChange change(AutofillProfileChange::REMOVE, *iter, NULL); NotificationService::current()->Notify( - NotificationType::AUTOFILL_PROFILE_CHANGED, + chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(this), Details<AutofillProfileChange>(&change)); } @@ -1137,7 +1137,7 @@ void WebDataService::EmptyMigrationTrashImpl( AutofillProfileChange change(AutofillProfileChange::UPDATE, (*iter)->guid(), *iter); NotificationService::current()->Notify( - NotificationType::AUTOFILL_PROFILE_CHANGED, + chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(this), Details<AutofillProfileChange>(&change)); } @@ -1169,7 +1169,7 @@ void WebDataService::AddCreditCardImpl( AutofillCreditCardChange change(AutofillCreditCardChange::ADD, credit_card.guid(), &credit_card); NotificationService::current()->Notify( - NotificationType::AUTOFILL_CREDIT_CARD_CHANGED, + chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, Source<WebDataService>(this), Details<AutofillCreditCardChange>(&change)); } @@ -1202,7 +1202,7 @@ void WebDataService::UpdateCreditCardImpl( AutofillCreditCardChange change(AutofillCreditCardChange::UPDATE, credit_card.guid(), &credit_card); NotificationService::current()->Notify( - NotificationType::AUTOFILL_CREDIT_CARD_CHANGED, + chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, Source<WebDataService>(this), Details<AutofillCreditCardChange>(&change)); } @@ -1224,7 +1224,7 @@ void WebDataService::RemoveCreditCardImpl( AutofillCreditCardChange change(AutofillCreditCardChange::REMOVE, guid, NULL); NotificationService::current()->Notify( - NotificationType::AUTOFILL_CREDIT_CARD_CHANGED, + chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, Source<WebDataService>(this), Details<AutofillCreditCardChange>(&change)); } @@ -1260,7 +1260,7 @@ void WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl( AutofillProfileChange change(AutofillProfileChange::REMOVE, *iter, NULL); NotificationService::current()->Notify( - NotificationType::AUTOFILL_PROFILE_CHANGED, + chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(this), Details<AutofillProfileChange>(&change)); } @@ -1270,7 +1270,7 @@ void WebDataService::RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl( AutofillCreditCardChange change(AutofillCreditCardChange::REMOVE, *iter, NULL); NotificationService::current()->Notify( - NotificationType::AUTOFILL_CREDIT_CARD_CHANGED, + chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, Source<WebDataService>(this), Details<AutofillCreditCardChange>(&change)); } diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc index da66435..0f7d861 100644 --- a/chrome/browser/webdata/web_data_service_unittest.cc +++ b/chrome/browser/webdata/web_data_service_unittest.cc @@ -24,13 +24,13 @@ #include "chrome/browser/webdata/autofill_entry.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/browser/webdata/web_data_service_test_util.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/guid.h" #include "chrome/test/thread_observer_helper.h" #include "content/browser/browser_thread.h" #include "content/common/notification_details.h" #include "content/common/notification_service.h" -#include "content/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/form_field.h" @@ -56,13 +56,13 @@ class AutofillDBThreadObserverHelper : public DBThreadObserverHelper { protected: virtual void RegisterObservers() { registrar_.Add(&observer_, - NotificationType::AUTOFILL_ENTRIES_CHANGED, + chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, NotificationService::AllSources()); registrar_.Add(&observer_, - NotificationType::AUTOFILL_PROFILE_CHANGED, + chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, NotificationService::AllSources()); registrar_.Add(&observer_, - NotificationType::AUTOFILL_CREDIT_CARD_CHANGED, + chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, NotificationService::AllSources()); } }; @@ -161,7 +161,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillAdd) { // passing the correct list of autofill keys in the details. EXPECT_CALL( *observer_helper_->observer(), - Observe(NotificationType(NotificationType::AUTOFILL_ENTRIES_CHANGED), + Observe(int(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillChangeList>::ptr, Pointee(ElementsAreArray(expected_changes))))). @@ -207,7 +207,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillRemoveOne) { }; EXPECT_CALL( *observer_helper_->observer(), - Observe(NotificationType(NotificationType::AUTOFILL_ENTRIES_CHANGED), + Observe(int(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillChangeList>::ptr, Pointee(ElementsAreArray(expected_changes))))). @@ -240,7 +240,7 @@ TEST_F(WebDataServiceAutofillTest, FormFillRemoveMany) { }; EXPECT_CALL( *observer_helper_->observer(), - Observe(NotificationType(NotificationType::AUTOFILL_ENTRIES_CHANGED), + Observe(int(chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillChangeList>::ptr, Pointee(ElementsAreArray(expected_changes))))). @@ -259,7 +259,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileAdd) { AutofillProfileChange::ADD, profile.guid(), &profile); EXPECT_CALL( *observer_helper_->observer(), - Observe(NotificationType(NotificationType::AUTOFILL_PROFILE_CHANGED), + Observe(int(chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillProfileChange>::ptr, Pointee(expected_change)))). @@ -302,7 +302,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileRemove) { AutofillProfileChange::REMOVE, profile.guid(), NULL); EXPECT_CALL( *observer_helper_->observer(), - Observe(NotificationType(NotificationType::AUTOFILL_PROFILE_CHANGED), + Observe(int(chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillProfileChange>::ptr, Pointee(expected_change)))). @@ -350,7 +350,7 @@ TEST_F(WebDataServiceAutofillTest, ProfileUpdate) { EXPECT_CALL( *observer_helper_->observer(), - Observe(NotificationType(NotificationType::AUTOFILL_PROFILE_CHANGED), + Observe(int(chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillProfileChange>::ptr, Pointee(expected_change)))). @@ -380,7 +380,7 @@ TEST_F(WebDataServiceAutofillTest, CreditAdd) { EXPECT_CALL( *observer_helper_->observer(), Observe( - NotificationType(NotificationType::AUTOFILL_CREDIT_CARD_CHANGED), + int(chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillCreditCardChange>::ptr, Pointee(expected_change)))). @@ -423,7 +423,7 @@ TEST_F(WebDataServiceAutofillTest, CreditCardRemove) { EXPECT_CALL( *observer_helper_->observer(), Observe( - NotificationType(NotificationType::AUTOFILL_CREDIT_CARD_CHANGED), + int(chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillCreditCardChange>::ptr, Pointee(expected_change)))). @@ -471,7 +471,7 @@ TEST_F(WebDataServiceAutofillTest, CreditUpdate) { EXPECT_CALL( *observer_helper_->observer(), Observe( - NotificationType(NotificationType::AUTOFILL_CREDIT_CARD_CHANGED), + int(chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillCreditCardChange>::ptr, Pointee(expected_change)))). @@ -533,7 +533,7 @@ TEST_F(WebDataServiceAutofillTest, AutofillRemoveModifiedBetween) { AutofillProfileChange::REMOVE, profile.guid(), NULL); EXPECT_CALL( *observer_helper_->observer(), - Observe(NotificationType(NotificationType::AUTOFILL_PROFILE_CHANGED), + Observe(int(chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillProfileChange>::ptr, Pointee(expected_profile_change)))). @@ -545,7 +545,7 @@ TEST_F(WebDataServiceAutofillTest, AutofillRemoveModifiedBetween) { EXPECT_CALL( *observer_helper_->observer(), Observe( - NotificationType(NotificationType::AUTOFILL_CREDIT_CARD_CHANGED), + int(chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED), Source<WebDataService>(wds_.get()), Property(&Details<const AutofillCreditCardChange>::ptr, Pointee(expected_card_change)))). diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 2b26917..5520b94 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -37,6 +37,7 @@ 'common/child_process_logging_linux.cc', 'common/child_process_logging_mac.mm', 'common/child_process_logging_win.cc', + 'common/chrome_notification_types.h', 'common/chrome_version_info.cc', 'common/chrome_version_info_linux.cc', 'common/chrome_version_info_mac.mm', diff --git a/chrome/common/chrome_notification_types.h b/chrome/common/chrome_notification_types.h new file mode 100644 index 0000000..e3ed879 --- /dev/null +++ b/chrome/common/chrome_notification_types.h @@ -0,0 +1,933 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_CHROME_NOTIFICATION_TYPES_H_ +#define CHROME_COMMON_CHROME_NOTIFICATION_TYPES_H_ +#pragma once + +#include "content/common/content_notification_types.h" + +namespace chrome { + +enum { + NOTIFICATION_CHROME_START = content::NOTIFICATION_CONTENT_END, + + // Browser-window ---------------------------------------------------------- + + // This message is sent after a window has been opened. The source is a + // Source<Browser> containing the affected Browser. No details are + // expected. + NOTIFICATION_BROWSER_OPENED = NOTIFICATION_CHROME_START, + + // This message is sent soon after BROWSER_OPENED, and indicates that + // the Browser's |window_| is now non-NULL. The source is a Source<Browser> + // containing the affected Browser. No details are expected. + NOTIFICATION_BROWSER_WINDOW_READY, + + // This message is sent when a browser is closing. The source is a + // Source<Browser> containing the affected Browser. Details is a boolean + // that if true indicates that the application will be closed as a result of + // this browser window closure (i.e. this was the last opened browser + // window on win/linux). This is sent prior to BROWSER_CLOSED, and may be + // sent more than once for a particular browser. + NOTIFICATION_BROWSER_CLOSING, + + // This message is sent after a window has been closed. The source is a + // Source<Browser> containing the affected Browser. Details is a boolean + // that if true indicates that the last browser window has closed - this + // does not indicate that the application is exiting (observers should + // listen for APP_TERMINATING if they want to detect when the application + // will shut down). Note that the boolean pointed to by details is only + // valid for the duration of this call. + NOTIFICATION_BROWSER_CLOSED, + + // Indicates that a top window has been closed. The source is the HWND + // that was closed, no details are expected. + NOTIFICATION_WINDOW_CLOSED, + + // Sent when an info bubble has been created but not yet shown. The source + // is the InfoBubble. + NOTIFICATION_INFO_BUBBLE_CREATED, + + // Sent when the language (English, French...) for a page has been detected. + // The details Details<std::string> contain the ISO 639-1 language code and + // the source is Source<TabContents>. + NOTIFICATION_TAB_LANGUAGE_DETERMINED, + + // Sent when a page has been translated. The source is the tab for that page + // (Source<TabContents>) and the details are the language the page was + // originally in and the language it was translated to + // (std::pair<std::string, std::string>). + NOTIFICATION_PAGE_TRANSLATED, + + // Sent after the renderer returns a snapshot of tab contents. + // The source (Source<TabContentsWrapper>) is the RenderViewHost for which + // the snapshot was generated and the details (Details<const SkBitmap>) is + // the actual snapshot. + NOTIFICATION_TAB_SNAPSHOT_TAKEN, + + // The user has changed the browser theme. The source is a + // Source<ThemeService>. There are no details. + NOTIFICATION_BROWSER_THEME_CHANGED, + + // Sent when the renderer returns focus to the browser, as part of focus + // traversal. The source is the browser, there are no details. + NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, + + // Application-modal dialogs ----------------------------------------------- + + // Sent after an application-modal dialog has been shown. The source + // is the dialog. + NOTIFICATION_APP_MODAL_DIALOG_SHOWN, + + // This message is sent when a new InfoBar has been added to a + // TabContentsWrapper. The source is a Source<TabContentsWrapper> with a + // pointer to the TabContentsWrapper the InfoBar was added to. The details + // is a Details<InfoBarDelegate> with a pointer to the delegate that was + // added. + NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, + + // This message is sent when an InfoBar is about to be removed from a + // TabContentsWrapper. The source is a Source<TabContentsWrapper> with a + // pointer to the TabContentsWrapper the InfoBar was removed from. The + // details is a Details<std::pair<InfoBarDelegate*, bool> > with a pointer + // to the removed delegate and whether the removal should be animated. + NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, + + // This message is sent when an InfoBar is replacing another infobar in a + // TabContentsWrapper. The source is a Source<TabContentsWrapper> with a + // pointer to the TabContentsWrapper the InfoBar was removed from. The + // details is a Details<std::pair<InfoBarDelegate*, InfoBarDelegate*> > with + // pointers to the old and new delegates, respectively. + NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED, + + // This is sent when an externally hosted tab is created. The details + // contain the ExternalTabContainer that contains the tab + NOTIFICATION_EXTERNAL_TAB_CREATED, + + // This is sent when an externally hosted tab is closed. No details are + // expected. + NOTIFICATION_EXTERNAL_TAB_CLOSED, + + // Indicates that the new page tab has finished loading. This is used for + // performance testing to see how fast we can load it after startup, and is + // only called once for the lifetime of the browser. The source is unused. + // Details is an integer: the number of milliseconds elapsed between + // starting and finishing all painting. + NOTIFICATION_INITIAL_NEW_TAB_UI_LOAD, + + // Used to fire notifications about how long various events took to + // complete. E.g., this is used to get more fine grained timings from the + // new tab page. Details is a MetricEventDurationDetails. + NOTIFICATION_METRIC_EVENT_DURATION, + + // This notification is sent when TabContents::SetAppExtension is invoked. + // The source is the ExtensionTabHelper SetAppExtension was invoked on. + NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, + + // Stuff inside the tabs --------------------------------------------------- + + // This message is sent after a constrained window has been closed. The + // source is a Source<ConstrainedWindow> with a pointer to the closed child + // window. (The pointer isn't usable, except for identification.) No + // details are expected. + NOTIFICATION_CWINDOW_CLOSED, + + // Notification from TabContents that we have received a response from the + // renderer in response to a dom automation controller action. + NOTIFICATION_DOM_OPERATION_RESPONSE, + + // Sent when the bookmark bubble hides. The source is the profile, the + // details unused. + NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN, + + // This notification is sent when the result of a find-in-page search is + // available with the browser process. The source is a Source<TabContents> + // with a pointer to the TabContents. Details encompass a + // FindNotificationDetail object that tells whether the match was found or + // not found. + NOTIFICATION_FIND_RESULT_AVAILABLE, + + // This is sent when the users preference for when the bookmark bar should + // be shown changes. The source is the profile, and the details are + // NoDetails. + NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, + + // Sent just before the installation confirm dialog is shown. The source + // is the ExtensionInstallUI, the details are NoDetails. + NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, + + // Used to monitor web cache usage by notifying whenever the + // CacheManagerHost observes new UsageStats. The source will be the + // RenderProcessHost that corresponds to the new statistics. Details are a + // UsageStats object sent by the renderer, and should be copied - ptr not + // guaranteed to be valid after the notification. + NOTIFICATION_WEB_CACHE_STATS_OBSERVED, + + // BackgroundContents ------------------------------------------------------ + + // A new background contents was opened by script. The source is the parent + // profile and the details are BackgroundContentsOpenedDetails. + NOTIFICATION_BACKGROUND_CONTENTS_OPENED, + + // The background contents navigated to a new location. The source is the + // parent Profile, and the details are the BackgroundContents that was + // navigated. + NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, + + // The background contents were closed by someone invoking window.close() + // or the parent application was uninstalled. + // The source is the parent profile, and the details are the + // BackgroundContents. + NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, + + // The background contents is being deleted. The source is the + // parent Profile, and the details are the BackgroundContents being deleted. + NOTIFICATION_BACKGROUND_CONTENTS_DELETED, + + // The background contents has crashed. The source is the parent Profile, + // and the details are the BackgroundContents. + NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED, + + // This is sent when network interception is disabled for a plugin, or the + // plugin is unloaded. This should only be sent/received on the browser IO + // thread or the plugin thread. The source is the plugin that is disabling + // interception. No details are expected. + NOTIFICATION_CHROME_PLUGIN_UNLOADED, + + // This is sent when a login prompt is shown. The source is the + // Source<NavigationController> for the tab in which the prompt is shown. + // Details are a LoginNotificationDetails which provide the LoginHandler + // that should be given authentication. + NOTIFICATION_AUTH_NEEDED, + + // This is sent when authentication credentials have been supplied (either + // by the user or by an automation service), but before we've actually + // received another response from the server. The source is the + // Source<NavigationController> for the tab in which the prompt was shown. + // Details are an AuthSuppliedLoginNotificationDetails which provide the + // LoginHandler that should be given authentication as well as the supplied + // username and password. + NOTIFICATION_AUTH_SUPPLIED, + + // This is sent when an authentication request has been dismissed without + // supplying credentials (either by the user or by an automation service). + // The source is the Source<NavigationController> for the tab in which the + // prompt was shown. Details are a LoginNotificationDetails which provide + // the LoginHandler that should be cancelled. + NOTIFICATION_AUTH_CANCELLED, + + // Saved Pages ------------------------------------------------------------- + + // Sent when a SavePackage finishes successfully. The source is the + // SavePackage, and Details are a GURL containing address of downloaded + // page. + NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, + + // History ----------------------------------------------------------------- + + // Sent when a history service is created on the main thread. This is sent + // after history is created, but before it has finished loading. Use + // HISTORY_LOADED is you need to know when loading has completed. + // The source is the profile that the history service belongs to, and the + // details is the pointer to the newly created HistoryService object. + NOTIFICATION_HISTORY_CREATED, + + // Sent when a history service has finished loading. The source is the + // profile that the history service belongs to, and the details is the + // HistoryService. + NOTIFICATION_HISTORY_LOADED, + + // Sent when a URL that has been typed has been added or modified. This is + // used by the in-memory URL database (used by autocomplete) to track + // changes to the main history system. + // + // The source is the profile owning the history service that changed, and + // the details is history::URLsModifiedDetails that lists the modified or + // added URLs. + NOTIFICATION_HISTORY_TYPED_URLS_MODIFIED, + + // Sent when the user visits a URL. + // + // The source is the profile owning the history service that changed, and + // the details is history::URLVisitedDetails. + NOTIFICATION_HISTORY_URL_VISITED, + + // Sent when one or more URLs are deleted. + // + // The source is the profile owning the history service that changed, and + // the details is history::URLsDeletedDetails that lists the deleted URLs. + NOTIFICATION_HISTORY_URLS_DELETED, + + // Sent when a keyword search term is updated. The source is the Profile and + // the details are history::KeywordSearchTermDetails + NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED, + + // Sent by history when the favicon of a URL changes. The source is the + // profile, and the details is history::FaviconChangeDetails (see + // history_notifications.h). + NOTIFICATION_FAVICON_CHANGED, + + // Sent by FaviconTabHelper when a tab's favicon has been successfully + // updated. + NOTIFICATION_FAVICON_UPDATED, + + // Sent after an incognito profile has been created. The details are none + // and the source is the new profile. + NOTIFICATION_OTR_PROFILE_CREATED, + + // Sent before a Profile is destroyed. The details are + // none and the source is a Profile*. + NOTIFICATION_PROFILE_DESTROYED, + + // TopSites ---------------------------------------------------------------- + + // Sent by TopSites when it finishes loading. The source is the profile the + // details the TopSites. + NOTIFICATION_TOP_SITES_LOADED, + + // Sent by TopSites when it has finished updating its most visited URLs + // cache after querying the history service. The source is the TopSites and + // the details a CancelableRequestProvider::Handle from the history service + // query. + // Used only in testing. + NOTIFICATION_TOP_SITES_UPDATED, + + // Sent by TopSites when the either one of the most visited urls changed, or + // one of the images changes. The source is the TopSites, the details not + // used. + NOTIFICATION_TOP_SITES_CHANGED, + + // Thumbnails--------------------------------------------------------------- + + // Sent by the ThumbnailGenerator whenever a render widget host + // updates its backing store. The source is the + // ThumbnailGenerator, and the details are the RenderWidgetHost + // that notified the ThumbnailGenerator that its backing store was + // updated. + NOTIFICATION_THUMBNAIL_GENERATOR_SNAPSHOT_CHANGED, + + // Bookmarks --------------------------------------------------------------- + + // Sent when the starred state of a URL changes. A URL is starred if there + // is at least one bookmark for it. The source is a Profile and the details + // is history::URLsStarredDetails that contains the list of URLs and + // whether they were starred or unstarred. + NOTIFICATION_URLS_STARRED, + + // Sent when the bookmark bar model finishes loading. This source is the + // Profile, and the details aren't used. + NOTIFICATION_BOOKMARK_MODEL_LOADED, + + // Sent when the bookmark bubble is shown for a particular URL. The source + // is the profile, the details the URL. + NOTIFICATION_BOOKMARK_BUBBLE_SHOWN, + + // Non-history storage services -------------------------------------------- + + // Notification that the TemplateURLService has finished loading from the + // database. The source is the TemplateURLService, and the details are + // NoDetails. + NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, + + // Sent when a TemplateURL is removed from the model. The source is the + // Profile, and the details the id of the TemplateURL being removed. + NOTIFICATION_TEMPLATE_URL_REMOVED, + + // Notification triggered when a web application has been installed or + // uninstalled. Any application view should reload its data. The source is + // the profile. No details are provided. + NOTIFICATION_WEB_APP_INSTALL_CHANGED, + + // This is sent to a pref observer when a pref is changed. The source is the + // PrefService and the details a std::string of the changed path. + NOTIFICATION_PREF_CHANGED, + + // This is broadcast after the preference subsystem has completed + // asynchronous initalization of a PrefService. + NOTIFICATION_PREF_INITIALIZATION_COMPLETED, + + // Sent when a default request context has been created, so calling + // Profile::GetDefaultRequestContext() will not return NULL. This is sent + // on the thread where Profile::GetRequestContext() is first called, which + // should be the UI thread. + NOTIFICATION_DEFAULT_REQUEST_CONTEXT_AVAILABLE, + + // The state of a web resource has been changed. A resource may have been + // added, removed, or altered. Source is WebResourceService, and the + // details are NoDetails. + NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, + + // Autocomplete ------------------------------------------------------------ + + // Sent by the autocomplete controller when done. The source is the + // AutocompleteController, the details not used. + NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, + + // This is sent when an item of the Omnibox popup is selected. The source + // is the profile. + NOTIFICATION_OMNIBOX_OPENED_URL, + + // Sent by the omnibox when it is destroyed. + NOTIFICATION_OMNIBOX_DESTROYED, + + // Sent by the omnibox when it is focused. + NOTIFICATION_OMNIBOX_FOCUSED, + + // Sent when the main Google URL has been updated. Some services cache + // this value and need to update themselves when it changes. See + // google_util::GetGoogleURLAndUpdateIfNecessary(). + NOTIFICATION_GOOGLE_URL_UPDATED, + + // Printing ---------------------------------------------------------------- + + // Notification from PrintJob that an event occurred. It can be that a page + // finished printing or that the print job failed. Details is + // PrintJob::EventDetails. Source is a PrintJob. + NOTIFICATION_PRINT_JOB_EVENT, + + // Sent when a PrintJob has been released. + // Source is the TabContentsWrapper that holds the print job. + NOTIFICATION_PRINT_JOB_RELEASED, + + // Shutdown ---------------------------------------------------------------- + + // Sent on the browser IO thread when an net::URLRequestContext is released + // by its owning Profile. The source is a pointer to the + // net::URLRequestContext. + NOTIFICATION_URL_REQUEST_CONTEXT_RELEASED, + + // Sent when WM_ENDSESSION has been received, after the browsers have been + // closed but before browser process has been shutdown. The source/details + // are all source and no details. + NOTIFICATION_SESSION_END, + + // User Scripts ------------------------------------------------------------ + + // Sent when there are new user scripts available. The details are a + // pointer to SharedMemory containing the new scripts. + NOTIFICATION_USER_SCRIPTS_UPDATED, + + // User Style Sheet -------------------------------------------------------- + + // Sent when the user style sheet has changed. + NOTIFICATION_USER_STYLE_SHEET_UPDATED, + + // Extensions -------------------------------------------------------------- + + // Sent when a CrxInstaller finishes. Source is the CrxInstaller that + // finished. No details. + NOTIFICATION_CRX_INSTALLER_DONE, + + // Sent when the known installed extensions have all been loaded. In + // testing scenarios this can happen multiple times if extensions are + // unloaded and reloaded. The source is a Profile. + NOTIFICATION_EXTENSIONS_READY, + + // Sent when a new extension is loaded. The details are an Extension, and + // the source is a Profile. + NOTIFICATION_EXTENSION_LOADED, + + // Sent when attempting to load a new extension, but they are disabled. The + // details are an Extension*, and the source is a Profile*. + NOTIFICATION_EXTENSION_UPDATE_DISABLED, + + // Sent when an extension is about to be installed so we can (in the case of + // themes) alert the user with a loading dialog. The source is the download + // manager and the details are the download url. + NOTIFICATION_EXTENSION_READY_FOR_INSTALL, + + // Sent when an extension install turns out to not be a theme. + NOTIFICATION_NO_THEME_DETECTED, + + // Sent when new extensions are installed. The details are an Extension, and + // the source is a Profile. + NOTIFICATION_EXTENSION_INSTALLED, + + // An error occured during extension install. The details are a string with + // details about why the install failed. + NOTIFICATION_EXTENSION_INSTALL_ERROR, + + // Sent when an extension install is not allowed, as indicated by + // PendingExtensionInfo::ShouldAllowInstall. The details are an Extension, + // and the source is a Profile. + NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED, + + // Sent when an extension has been uninstalled. The details are + // an UninstalledExtensionInfo struct and the source is a Profile. + NOTIFICATION_EXTENSION_UNINSTALLED, + + // Sent when an extension uninstall is not allowed because the extension is + // not user manageable. The details are an Extension, and the source is a + // Profile. + NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, + + // Sent when an extension is unloaded. This happens when an extension is + // uninstalled or disabled. The details are an UnloadedExtensionInfo, and + // the source is a Profile. + // + // Note that when this notification is sent, ExtensionService has already + // removed the extension from its internal state. + NOTIFICATION_EXTENSION_UNLOADED, + + // Sent after a new ExtensionHost is created. The details are + // an ExtensionHost* and the source is an ExtensionProcessManager*. + NOTIFICATION_EXTENSION_HOST_CREATED, + + // Sent before an ExtensionHost is destroyed. The details are + // an ExtensionHost* and the source is a Profile*. + NOTIFICATION_EXTENSION_HOST_DESTROYED, + + // Sent by an ExtensionHost when it finished its initial page load. + // The details are an ExtensionHost* and the source is a Profile*. + NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, + + // Sent by an ExtensionHost when its render view requests closing through + // window.close(). The details are an ExtensionHost* and the source is a + // Profile*. + NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, + + // Sent after an extension render process is created and fully functional. + // The details are an ExtensionHost*. + NOTIFICATION_EXTENSION_PROCESS_CREATED, + + // Sent when extension render process ends (whether it crashes or closes). + // The details are an ExtensionHost* and the source is a Profile*. Not sent + // during browser shutdown. + NOTIFICATION_EXTENSION_PROCESS_TERMINATED, + + // Sent when a background page is ready so other components can load. + NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, + + // Sent when a pop-up extension view is ready, so that notification may + // be sent to pending callbacks. Note that this notification is sent + // after all onload callbacks have been invoked in the main frame. + // The details is the ExtensionHost* hosted within the popup, and the source + // is a Profile*. + NOTIFICATION_EXTENSION_POPUP_VIEW_READY, + + // Sent when a browser action's state has changed. The source is the + // ExtensionAction* that changed. There are no details. + NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, + + // Sent when the count of page actions has changed. Note that some of them + // may not apply to the current page. The source is a LocationBar*. There + // are no details. + NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, + + // Sent when a browser action's visibility has changed. The source is the + // ExtensionPrefs* that changed. The details are a Extension*. + NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, + + // Sent when a page action's visibility has changed. The source is the + // ExtensionAction* that changed. The details are a TabContents*. + NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, + + // Sent by an extension to notify the browser about the results of a unit + // test. + NOTIFICATION_EXTENSION_TEST_PASSED, + NOTIFICATION_EXTENSION_TEST_FAILED, + + // Sent by extension test javascript code, typically in a browser test. The + // sender is a std::string representing the extension id, and the details + // are a std::string with some message. This is particularly useful when you + // want to have C++ code wait for javascript code to do something. + NOTIFICATION_EXTENSION_TEST_MESSAGE, + + // Sent when an bookmarks extensions API function was successfully invoked. + // The source is the id of the extension that invoked the function, and the + // details are a pointer to the const BookmarksFunction in question. + NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, + + // Sent when an omnibox extension has sent back omnibox suggestions. The + // source is the profile, and the details are an ExtensionOmniboxSuggestions + // object. + NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY, + + // Sent when the user accepts the input in an extension omnibox keyword + // session. The source is the profile. + NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, + + // Sent when an omnibox extension has updated the default suggestion. The + // source is the profile. + NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, + + // Sent when an extension changes a preference value. The source is the + // profile, and the details are an ExtensionPrefStore::ExtensionPrefDetails + // object. + NOTIFICATION_EXTENSION_PREF_CHANGED, + + // Sent when the extension updater starts checking for updates to installed + // extensions. The source is a Profile, and there are no details. + NOTIFICATION_EXTENSION_UPDATING_STARTED, + + // Sent when the extension updater is finished checking for updates to + // installed extensions. The source is a Profile, and there are no details. + // NOTE: It's possible that there are extension updates still being + // installed by the extension service at the time this notification fires. + NOTIFICATION_EXTENSION_UPDATING_FINISHED, + + // The extension updater found an update and will attempt to download and + // install it. The source is a Profile, and the details are an extension id + // (const std::string). + NOTIFICATION_EXTENSION_UPDATE_FOUND, + + // An installed app changed notification state (added or removed + // notifications). The source is a Profile, and the details are a string + // with the extension id of the app. + NOTIFICATION_APP_NOTIFICATION_STATE_CHANGED, + + // Desktop Notifications --------------------------------------------------- + + // This notification is sent when a balloon is connected to a renderer + // process to render the balloon contents. The source is a + // Source<BalloonHost> with a pointer to the the balloon. A + // NOTIFY_BALLOON_DISCONNECTED is guaranteed before the source pointer + // becomes junk. No details expected. + NOTIFICATION_NOTIFY_BALLOON_CONNECTED, + + // This message is sent after a balloon is disconnected from the renderer + // process. The source is a Source<BalloonHost> with a pointer to the + // balloon host (the pointer is usable). No details are expected. + NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, + + // Web Database Service ---------------------------------------------------- + + // This notification is sent whenever autofill entries are + // changed. The detail of this notification is a list of changes + // represented by a vector of AutofillChange. Each change + // includes a change type (add, update, or remove) as well as the + // key of the entry that was affected. + NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, + + // Sent when an AutofillProfile has been added/removed/updated in the + // WebDatabase. The detail is an AutofillProfileChange. + NOTIFICATION_AUTOFILL_PROFILE_CHANGED, + + // Sent when an Autofill CreditCard has been added/removed/updated in the + // WebDatabase. The detail is an AutofillCreditCardChange. + NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, + + // This notification is sent whenever the web database service has finished + // loading the web database. No details are expected. + NOTIFICATION_WEB_DATABASE_LOADED, + + // Upgrade notifications --------------------------------------------------- + + // Sent when Chrome detects that it has been upgraded behind the scenes. + // NOTE: The detection mechanism is asynchronous, so this event may arrive + // quite some time after the upgrade actually happened. No details are + // expected. + NOTIFICATION_UPGRADE_DETECTED, + + // Sent when Chrome believes an update has been installed and available for + // long enough with the user shutting down to let it take effect. See + // upgrade_detector.cc for details on how long it waits. No details are + // expected. + NOTIFICATION_UPGRADE_RECOMMENDED, + + // Software incompatibility notifications ---------------------------------- + + // Sent when Chrome has finished compiling the list of loaded modules (and + // other modules of interest). No details are expected. + NOTIFICATION_MODULE_LIST_ENUMERATED, + + // Sent when Chrome is done scanning the module list and when the user has + // acknowledged the module incompatibility. No details are expected. + NOTIFICATION_MODULE_INCOMPATIBILITY_BADGE_CHANGE, + + // Accessibility Notifications --------------------------------------------- + + // Notification that a window in the browser UI (not the web content) + // was opened, for propagating to an accessibility extension. + // Details will be an AccessibilityWindowInfo. + NOTIFICATION_ACCESSIBILITY_WINDOW_OPENED, + + // Notification that a window in the browser UI was closed. + // Details will be an AccessibilityWindowInfo. + NOTIFICATION_ACCESSIBILITY_WINDOW_CLOSED, + + // Notification that a control in the browser UI was focused. + // Details will be an AccessibilityControlInfo. + NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, + + // Notification that a control in the browser UI had its action taken, + // like pressing a button or toggling a checkbox. + // Details will be an AccessibilityControlInfo. + NOTIFICATION_ACCESSIBILITY_CONTROL_ACTION, + + // Notification that text box in the browser UI had text change. + // Details will be an AccessibilityControlInfo. + NOTIFICATION_ACCESSIBILITY_TEXT_CHANGED, + + // Notification that a pop-down menu was opened, for propagating + // to an accessibility extension. + // Details will be an AccessibilityMenuInfo. + NOTIFICATION_ACCESSIBILITY_MENU_OPENED, + + // Notification that a pop-down menu was closed, for propagating + // to an accessibility extension. + // Details will be an AccessibilityMenuInfo. + NOTIFICATION_ACCESSIBILITY_MENU_CLOSED, + + // Content Settings -------------------------------------------------------- + + // Sent when content settings change. The source is a HostContentSettings + // object, the details are ContentSettingsNotificationsDetails. + NOTIFICATION_CONTENT_SETTINGS_CHANGED, + + // Sent when the collect cookies dialog is shown. The source is a + // TabSpecificContentSettings object, there are no details. + NOTIFICATION_COLLECTED_COOKIES_SHOWN, + + // Sent when the default setting for desktop notifications has changed. + // The source is the DesktopNotificationService, the details are None. + NOTIFICATION_DESKTOP_NOTIFICATION_DEFAULT_CHANGED, + + // Sent when a non-default setting in the the notification content settings + // map has changed. The source is the DesktopNotificationService, the + // details are None. + NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED, + + // Sent when the geolocation settings change. The source is the + // GeolocationContentSettingsMap object, the details are + // ContentSettingsNotificationsDetails. + NOTIFICATION_GEOLOCATION_SETTINGS_CHANGED, + + // Sent when content settings change for a tab. The source is a TabContents + // object, the details are None. + NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED, + + // Sync -------------------------------------------------------------------- + + // Sent when the syncer is blocked configuring. + NOTIFICATION_SYNC_CONFIGURE_BLOCKED, + + // The sync service has started the configuration process. + NOTIFICATION_SYNC_CONFIGURE_START, + + // The sync service is finished the configuration process. + NOTIFICATION_SYNC_CONFIGURE_DONE, + + // The session service has been saved. This notification type is only sent + // if there were new SessionService commands to save, and not for no-op save + // operations. + NOTIFICATION_SESSION_SERVICE_SAVED, + + // A foreign session has been updated. If a new tab page is open, the + // foreign session handler needs to update the new tab page's foreign + // session data. + NOTIFICATION_FOREIGN_SESSION_UPDATED, + + // Foreign sessions has been disabled. New tabs should not display foreign + // session data. + NOTIFICATION_FOREIGN_SESSION_DISABLED, + + // Cookies ----------------------------------------------------------------- + + // Sent when a cookie changes. The source is a Profile object, the details + // are a ChromeCookieDetails object. + NOTIFICATION_COOKIE_CHANGED, + + // Sidebar ----------------------------------------------------------------- + + // Sent when the sidebar state is changed. + // The source is a SidebarManager instance, the details are the changed + // SidebarContainer object. + NOTIFICATION_SIDEBAR_CHANGED, + + // Token Service ----------------------------------------------------------- + + // When the token service has a new token available for a service, one of + // these notifications is issued per new token. + // The source is a TokenService on the Profile. The details are a + // TokenAvailableDetails object. + NOTIFICATION_TOKEN_AVAILABLE, + + // When there aren't any additional tokens left to load, this notification + // is sent. + // The source is a TokenService on the profile. There are no details. + NOTIFICATION_TOKEN_LOADING_FINISHED, + + // If a token request failed, one of these is issued per failed request. + // The source is a TokenService on the Profile. The details are a + // TokenRequestFailedDetails object. + NOTIFICATION_TOKEN_REQUEST_FAILED, + + // When a service has a new token they got from a frontend that the + // TokenService should know about, fire this notification. The details + // are a TokenAvailableDetails object. + NOTIFICATION_TOKEN_UPDATED, + + // Sent when a user signs into Google services such as sync. + // The source is the Profile. The details are a GoogleServiceSignin object. + NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, + + // Sent when a user fails to sign into Google services such as sync. + // The source is the Profile. The details are a GoogleServiceAuthError + // object. + NOTIFICATION_GOOGLE_SIGNIN_FAILED, + + // Autofill Notifications -------------------------------------------------- + + // Sent when a popup with Autofill suggestions is shown in the renderer. + // The source is the corresponding RenderViewHost. There are not details. + NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, + + // Sent when a form is previewed or filled with Autofill suggestions. + // The source is the corresponding RenderViewHost. There are not details. + NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, + + // Download Notifications -------------------------------------------------- + + // Sent when a download is initiated. It is possible that the download will + // not actually begin due to the DownloadRequestLimiter cancelling it + // prematurely. + // The source is the corresponding RenderViewHost. There are no details. + NOTIFICATION_DOWNLOAD_INITIATED, + + // Sent when a page generation to MHTML has finished. + // The source is the corresponding RenderViewHost. The details is a + // MHTMLGenerationManager::NotificationDetails. + NOTIFICATION_MHTML_GENERATED, + + // Misc -------------------------------------------------------------------- + +#if defined(OS_CHROMEOS) + // Sent when a chromium os user logs in. + NOTIFICATION_LOGIN_USER_CHANGED, + + // Sent when user image is updated. + NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, + + // Sent when a chromium os user attempts to log in. The source is + // all and the details are AuthenticationNotificationDetails. + NOTIFICATION_LOGIN_AUTHENTICATION, + + // Sent when a panel state changed. + NOTIFICATION_PANEL_STATE_CHANGED, + + // Sent when the window manager's layout mode has changed. + NOTIFICATION_LAYOUT_MODE_CHANGED, + + // Sent when the wizard's content view is destroyed. The source and details + // are not used. + NOTIFICATION_WIZARD_CONTENT_VIEW_DESTROYED, + + // Sent when the screen lock state has changed. The source is + // ScreenLocker and the details is a bool specifing that the + // screen is locked. When details is a false, the source object + // is being deleted, so the receiver shouldn't use the screen locker + // object. + NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, + + // Sent when the network state has changed on UI thread. + // The source is AllSources and the details is NetworkStateDetails defined + // in chrome/browser/chromeos/network_state_notifier.h. + // TODO(oshima): Port this to all platforms. + NOTIFICATION_NETWORK_STATE_CHANGED, + + // Sent when an attempt to acquire the public key of the owner of a chromium + // os device has succeeded. + NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED, + + // Sent when an attempt to acquire the public key of the owner of a chromium + // os device has failed. + NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED, + + // Sent after UserManager checked ownership status of logged in user. + NOTIFICATION_OWNERSHIP_CHECKED, + + // This is sent to a ChromeOS settings observer when a system setting is + // changed. The source is the CrosSettings and the details a std::string of + // the changed setting. + NOTIFICATION_SYSTEM_SETTING_CHANGED, + + // Sent by SIM unlock dialog when it has finished with the process of + // updating RequirePin setting. RequirePin setting might have been changed + // to a new value or update might have been canceled. + // In either case notification is sent and details contain a bool + // that represents current value. + NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED, + + // Sent by SIM unlock dialog when it has finished the EnterPin or + // EnterPuk dialog, either because the user cancelled, or entered a + // PIN or PUK. + NOTIFICATION_ENTER_PIN_ENDED, + +#endif + +#if defined(TOOLKIT_VIEWS) + // Sent when a bookmark's context menu is shown. Used to notify + // tests that the context menu has been created and shown. + NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, +#endif + + // Sent when the tab's closeable state has changed due to increase/decrease + // in number of tabs in browser or increase/decrease in number of browsers. + // Details<bool> contain the closeable flag while source is AllSources. + // This is only sent from ChromeOS's TabCloseableStateWatcher. + NOTIFICATION_TAB_CLOSEABLE_STATE_CHANGED, + + // Sent each time the InstantController is updated. + NOTIFICATION_INSTANT_CONTROLLER_UPDATED, + + // Sent each time the InstantController shows the InstantLoader. + NOTIFICATION_INSTANT_CONTROLLER_SHOWN, + + // Sent when the instant loader determines whether the page supports the + // instant API or not. The details is a boolean indicating if the page + // supports instant. The source is not used. + NOTIFICATION_INSTANT_SUPPORT_DETERMINED, + + // Password Store ---------------------------------------------------------- + // This notification is sent whenenever login entries stored in the password + // store are changed. The detail of this notification is a list of changes + // represented by a vector of PasswordStoreChange. Each change includes a + // change type (ADD, UPDATE, or REMOVE) as well as the + // |webkit_glue::PasswordForm|s that were affected. + NOTIFICATION_LOGINS_CHANGED, + + // Sent when the applications in the NTP app launcher have been reordered. + NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, + +#if defined(OS_CHROMEOS) + // Sent when WebSocketProxy started accepting connections. + NOTIFICATION_WEB_SOCKET_PROXY_STARTED, +#endif + + // Sent when a new web store promo has been loaded. + NOTIFICATION_WEB_STORE_PROMO_LOADED, + +#if defined(TOUCH_UI) + // Sent when an API for hiding the keyboard is invoked from JavaScript code. + NOTIFICATION_HIDE_KEYBOARD_INVOKED, + + // Sent when an API for set height of the keyboard is invoked from + // JavaScript code. + NOTIFICATION_SET_KEYBOARD_HEIGHT_INVOKED, + + // Sent when an editable element is touched, such as text box, password + // field, and omnibox. + NOTIFICATION_EDITABLE_ELEMENT_TOUCHED, +#endif + + // Protocol Handler Registry ----------------------------------------------- + // Sent when a ProtocolHandlerRegistry is changed. + NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, + + // Sent when the cached profile info has changed. + NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, + + // Note:- + // Currently only Content and Chrome define and use notifications. + // Custom notifications not belonging to Content and Chrome should start + // from here. + NOTIFICATION_CHROME_END, +}; + +} // namespace chrome + + +#endif // CHROME_COMMON_CHROME_NOTIFICATION_TYPES_H_ diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc index 0fe410a..f8f882d 100644 --- a/chrome/test/in_process_browser_test.cc +++ b/chrome/test/in_process_browser_test.cc @@ -34,8 +34,8 @@ #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/main_function_params.h" -#include "content/common/notification_type.h" #include "content/renderer/mock_content_renderer_client.h" #include "net/base/mock_host_resolver.h" #include "net/test/test_server.h" diff --git a/chrome/test/live_sync/live_autofill_sync_test.cc b/chrome/test/live_sync/live_autofill_sync_test.cc index 54aaa85..d4afc2b 100644 --- a/chrome/test/live_sync/live_autofill_sync_test.cc +++ b/chrome/test/live_sync/live_autofill_sync_test.cc @@ -12,6 +12,7 @@ #include "chrome/browser/sync/profile_sync_test_util.h" #include "chrome/browser/webdata/autofill_entry.h" #include "chrome/browser/webdata/web_database.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/test/thread_observer_helper.h" #include "webkit/glue/form_field.h" @@ -63,10 +64,10 @@ class AutofillDBThreadObserverHelper : public DBThreadObserverHelper { protected: virtual void RegisterObservers() { registrar_.Add(&observer_, - NotificationType::AUTOFILL_ENTRIES_CHANGED, + chrome::NOTIFICATION_AUTOFILL_ENTRIES_CHANGED, NotificationService::AllSources()); registrar_.Add(&observer_, - NotificationType::AUTOFILL_PROFILE_CHANGED, + chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, NotificationService::AllSources()); } }; diff --git a/chrome/test/plugin/pdf_browsertest.cc b/chrome/test/plugin/pdf_browsertest.cc index 0894841..cd4b41b 100644 --- a/chrome/test/plugin/pdf_browsertest.cc +++ b/chrome/test/plugin/pdf_browsertest.cc @@ -16,8 +16,8 @@ #include "chrome/test/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/content_notification_types.h" #include "content/common/notification_observer.h" -#include "content/common/notification_type.h" #include "net/test/test_server.h" #include "ui/base/clipboard/clipboard.h" #include "ui/gfx/codec/png_codec.h" @@ -81,7 +81,7 @@ class PDFBrowserTest : public InProcessBrowserTest, TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); wrapper->CaptureSnapshot(); ui_test_utils::RegisterAndWait(this, - NotificationType::TAB_SNAPSHOT_TAKEN, + chrome::TAB_SNAPSHOT_TAKEN, Source<TabContentsWrapper>(wrapper)); ASSERT_FALSE(snapshot_different_) << "Rendering didn't match, see result " "at " << snapshot_filename_.value().c_str(); @@ -106,10 +106,10 @@ class PDFBrowserTest : public InProcessBrowserTest, private: // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::TAB_SNAPSHOT_TAKEN) { + if (type == chrome::TAB_SNAPSHOT_TAKEN) { MessageLoopForUI::current()->Quit(); FilePath reference = ui_test_utils::GetTestFilePath( GetPDFTestDir(), @@ -172,7 +172,7 @@ class PDFBrowserTest : public InProcessBrowserTest, reinterpret_cast<char*>(&png_data[0]), png_data.size()); } } - } else if (type == NotificationType::LOAD_STOP) { + } else if (type == chrome::LOAD_STOP) { load_stop_notification_count_++; } } @@ -185,7 +185,7 @@ class PDFBrowserTest : public InProcessBrowserTest, std::string expected_filename_; // If the snapshot is different, holds the location where it's saved. FilePath snapshot_filename_; - // How many times we've seen NotificationType::LOAD_STOP. + // How many times we've seen chrome::LOAD_STOP. int load_stop_notification_count_; scoped_ptr<net::TestServer> pdf_test_server_; @@ -276,7 +276,7 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, FLAKY_SLOW_Loading) { &(browser()->GetSelectedTabContents()->controller()); NotificationRegistrar registrar; registrar.Add(this, - NotificationType::LOAD_STOP, + chrome::LOAD_STOP, Source<NavigationController>(controller)); std::string base_url = std::string("files/"); @@ -303,7 +303,7 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, FLAKY_SLOW_Loading) { while (true) { int last_count = load_stop_notification_count(); - // We might get extraneous NotificationType::LOAD_STOP notifications when + // We might get extraneous chrome::LOAD_STOP notifications when // doing async loading. This happens when the first loader is cancelled // and before creating a byte-range request loader. bool complete = false; diff --git a/chrome/test/test_notification_tracker.cc b/chrome/test/test_notification_tracker.cc index 719af2f..0daf899 100644 --- a/chrome/test/test_notification_tracker.cc +++ b/chrome/test/test_notification_tracker.cc @@ -7,11 +7,11 @@ #include "content/common/notification_service.h" TestNotificationTracker::Event::Event() - : type(NotificationType::ALL), + : type(content::NOTIFICATION_ALL), source(NotificationService::AllSources()), details(NotificationService::NoDetails()) { } -TestNotificationTracker::Event::Event(NotificationType t, +TestNotificationTracker::Event::Event(int t, NotificationSource s, NotificationDetails d) : type(t), @@ -25,7 +25,7 @@ TestNotificationTracker::TestNotificationTracker() { TestNotificationTracker::~TestNotificationTracker() { } -void TestNotificationTracker::ListenFor(NotificationType type, +void TestNotificationTracker::ListenFor(int type, const NotificationSource& source) { registrar_.Add(this, type, source); } @@ -34,7 +34,7 @@ void TestNotificationTracker::Reset() { events_.clear(); } -bool TestNotificationTracker::Check1AndReset(NotificationType type) { +bool TestNotificationTracker::Check1AndReset(int type) { if (size() != 1) { Reset(); return false; @@ -44,8 +44,8 @@ bool TestNotificationTracker::Check1AndReset(NotificationType type) { return success; } -bool TestNotificationTracker::Check2AndReset(NotificationType type1, - NotificationType type2) { +bool TestNotificationTracker::Check2AndReset(int type1, + int type2) { if (size() != 2) { Reset(); return false; @@ -55,9 +55,9 @@ bool TestNotificationTracker::Check2AndReset(NotificationType type1, return success; } -bool TestNotificationTracker::Check3AndReset(NotificationType type1, - NotificationType type2, - NotificationType type3) { +bool TestNotificationTracker::Check3AndReset(int type1, + int type2, + int type3) { if (size() != 3) { Reset(); return false; @@ -69,7 +69,7 @@ bool TestNotificationTracker::Check3AndReset(NotificationType type1, return success; } -void TestNotificationTracker::Observe(NotificationType type, +void TestNotificationTracker::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { events_.push_back(Event(type, source, details)); diff --git a/chrome/test/test_notification_tracker.h b/chrome/test/test_notification_tracker.h index 21932c9..fcb7ddf 100644 --- a/chrome/test/test_notification_tracker.h +++ b/chrome/test/test_notification_tracker.h @@ -20,9 +20,9 @@ class TestNotificationTracker : public NotificationObserver { // Records one received notification. struct Event { Event(); - Event(NotificationType t, NotificationSource s, NotificationDetails d); + Event(int t, NotificationSource s, NotificationDetails d); - NotificationType type; + int type; NotificationSource source; NotificationDetails details; }; @@ -34,11 +34,11 @@ class TestNotificationTracker : public NotificationObserver { virtual ~TestNotificationTracker(); // Makes this object listen for the given notification with the given source. - void ListenFor(NotificationType type, const NotificationSource& source); + void ListenFor(int type, const NotificationSource& source); // Makes this object listen for notifications of the given type coming from // any source. - void ListenForAll(NotificationType type); + void ListenForAll(int type); // Clears the list of events. void Reset(); @@ -52,12 +52,12 @@ class TestNotificationTracker : public NotificationObserver { // Check1AndReset(NOTIFY_A); // <do stuff> // Check2AndReset(NOTIFY_B, NOTIFY_C) - bool Check1AndReset(NotificationType type); - bool Check2AndReset(NotificationType type1, - NotificationType type2); - bool Check3AndReset(NotificationType type1, - NotificationType type2, - NotificationType type3); + bool Check1AndReset(int type); + bool Check2AndReset(int type1, + int type2); + bool Check3AndReset(int type1, + int type2, + int type3); // Returns the number of notifications received since the last reset. size_t size() const { return events_.size(); } @@ -67,7 +67,7 @@ class TestNotificationTracker : public NotificationObserver { const Event& at(size_t i) const { return events_[i]; } protected: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); private: diff --git a/chrome/test/test_tab_strip_model_observer.cc b/chrome/test/test_tab_strip_model_observer.cc index 41a2f71..9a209c6 100644 --- a/chrome/test/test_tab_strip_model_observer.cc +++ b/chrome/test/test_tab_strip_model_observer.cc @@ -43,24 +43,24 @@ void TestTabStripModelObserver::WaitForObservation() { void TestTabStripModelObserver::TabInsertedAt( TabContentsWrapper* contents, int index, bool foreground) { NavigationController* controller = &contents->controller(); - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::LOAD_START, + registrar_.Add(this, content::NOTIFICATION_LOAD_START, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(controller)); } void TestTabStripModelObserver::Observe( - NotificationType type, const NotificationSource& source, + int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::NAV_ENTRY_COMMITTED || - type == NotificationType::LOAD_START) { + if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED || + type == content::NOTIFICATION_LOAD_START) { if (!navigation_started_) { load_start_observer_->OnLoadStart(); navigation_started_ = true; } - } else if (type == NotificationType::LOAD_STOP) { + } else if (type == content::NOTIFICATION_LOAD_STOP) { if (navigation_started_ && ++navigations_completed_ == number_of_navigations_) { navigation_started_ = false; diff --git a/chrome/test/test_tab_strip_model_observer.h b/chrome/test/test_tab_strip_model_observer.h index a41e5dfe..c384e45 100644 --- a/chrome/test/test_tab_strip_model_observer.h +++ b/chrome/test/test_tab_strip_model_observer.h @@ -47,7 +47,7 @@ class TestTabStripModelObserver : public TabStripModelObserver, bool foreground) OVERRIDE; // NotificationObserver: - virtual void Observe(NotificationType type, const NotificationSource& source, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; NotificationRegistrar registrar_; diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc index 175bbd6..2738406 100644 --- a/chrome/test/testing_profile.cc +++ b/chrome/test/testing_profile.cc @@ -44,6 +44,7 @@ #include "chrome/browser/ui/find_bar/find_bar_state.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" #include "chrome/test/bookmark_load_observer.h" #include "chrome/test/test_url_request_context_getter.h" @@ -168,7 +169,7 @@ TestingProfile::TestingProfile() TestingProfile::~TestingProfile() { NotificationService::current()->Notify( - NotificationType::PROFILE_DESTROYED, + chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(static_cast<Profile*>(this)), NotificationService::NoDetails()); @@ -306,7 +307,7 @@ void TestingProfile::BlockUntilBookmarkModelLoaded() { void TestingProfile::BlockUntilTopSitesLoaded() { if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) GetTopSites()->HistoryLoaded(); - ui_test_utils::WaitForNotification(NotificationType::TOP_SITES_LOADED); + ui_test_utils::WaitForNotification(chrome::NOTIFICATION_TOP_SITES_LOADED); } void TestingProfile::CreateTemplateURLFetcher() { diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc index 4c2be21..8ed4303 100644 --- a/chrome/test/ui_test_utils.cc +++ b/chrome/test/ui_test_utils.cc @@ -30,6 +30,7 @@ #include "chrome/browser/ui/find_bar/find_notification_details.h" #include "chrome/browser/ui/find_bar/find_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/extensions/extension_action.h" #include "chrome/test/automation/javascript_execution_controller.h" @@ -39,7 +40,6 @@ #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/notification_type.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -65,11 +65,11 @@ class NavigationNotificationObserver : public NotificationObserver { number_of_navigations_(number_of_navigations), running_(false), done_(false) { - registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, + registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::LOAD_START, + registrar_.Add(this, content::NOTIFICATION_LOAD_START, Source<NavigationController>(controller)); - registrar_.Add(this, NotificationType::LOAD_STOP, + registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(controller)); } @@ -80,13 +80,13 @@ class NavigationNotificationObserver : public NotificationObserver { } } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::NAV_ENTRY_COMMITTED || - type == NotificationType::LOAD_START) { + if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED || + type == content::NOTIFICATION_LOAD_START) { navigation_started_ = true; - } else if (type == NotificationType::LOAD_STOP) { + } else if (type == content::NOTIFICATION_LOAD_STOP) { if (navigation_started_ && ++navigations_completed_ == number_of_navigations_) { navigation_started_ = false; @@ -123,15 +123,15 @@ class DOMOperationObserver : public NotificationObserver { public: explicit DOMOperationObserver(RenderViewHost* render_view_host) : did_respond_(false) { - registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, + registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, Source<RenderViewHost>(render_view_host)); ui_test_utils::RunMessageLoop(); } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - DCHECK(type == NotificationType::DOM_OPERATION_RESPONSE); + DCHECK(type == chrome::NOTIFICATION_DOM_OPERATION_RESPONSE); Details<DomOperationNotificationDetails> dom_op_details(details); response_ = dom_op_details->json(); did_respond_ = true; @@ -159,7 +159,7 @@ class FindInPageNotificationObserver : public NotificationObserver { number_of_matches_(0) { current_find_request_id_ = parent_tab->find_tab_helper()->current_find_request_id(); - registrar_.Add(this, NotificationType::FIND_RESULT_AVAILABLE, + registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, Source<TabContents>(parent_tab_->tab_contents())); ui_test_utils::RunMessageLoop(); } @@ -168,9 +168,9 @@ class FindInPageNotificationObserver : public NotificationObserver { int number_of_matches() const { return number_of_matches_; } - virtual void Observe(NotificationType type, const NotificationSource& source, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type == NotificationType::FIND_RESULT_AVAILABLE) { + if (type == chrome::NOTIFICATION_FIND_RESULT_AVAILABLE) { Details<FindNotificationDetails> find_details(details); if (find_details->request_id() == current_find_request_id_) { // We get multiple responses and one of those will contain the ordinal. @@ -343,13 +343,14 @@ void WaitForNavigations(NavigationController* controller, void WaitForNewTab(Browser* browser) { TestNotificationObserver observer; - RegisterAndWait(&observer, NotificationType::TAB_ADDED, + RegisterAndWait(&observer, content::NOTIFICATION_TAB_ADDED, Source<Browser>(browser)); } void WaitForBrowserActionUpdated(ExtensionAction* browser_action) { TestNotificationObserver observer; - RegisterAndWait(&observer, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, + RegisterAndWait(&observer, + chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, Source<ExtensionAction>(browser_action)); } @@ -359,13 +360,13 @@ void WaitForLoadStop(TabContents* tab) { if (!tab->is_loading() && !tab->render_manager()->pending_render_view_host()) return; TestNotificationObserver observer; - RegisterAndWait(&observer, NotificationType::LOAD_STOP, + RegisterAndWait(&observer, content::NOTIFICATION_LOAD_STOP, Source<NavigationController>(&tab->controller())); } Browser* WaitForNewBrowser() { TestNotificationObserver observer; - RegisterAndWait(&observer, NotificationType::BROWSER_WINDOW_READY, + RegisterAndWait(&observer, chrome::NOTIFICATION_BROWSER_WINDOW_READY, NotificationService::AllSources()); return Source<Browser>(observer.source()).ptr(); } @@ -417,7 +418,7 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete( if (browser_test_flags & BROWSER_TEST_WAIT_FOR_BROWSER) browser = WaitForBrowserNotInSet(initial_browsers); if (browser_test_flags & BROWSER_TEST_WAIT_FOR_TAB) - WaitForNotification(NotificationType::TAB_ADDED); + WaitForNotification(content::NOTIFICATION_TAB_ADDED); if (!(browser_test_flags & BROWSER_TEST_WAIT_FOR_NAVIGATION)) { // Some other flag caused the wait prior to this. return; @@ -551,7 +552,7 @@ GURL GetFileUrlWithQuery(const FilePath& path, AppModalDialog* WaitForAppModalDialog() { TestNotificationObserver observer; - RegisterAndWait(&observer, NotificationType::APP_MODAL_DIALOG_SHOWN, + RegisterAndWait(&observer, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, NotificationService::AllSources()); return Source<AppModalDialog>(observer.source()).ptr(); } @@ -560,19 +561,19 @@ void CrashTab(TabContents* tab) { RenderProcessHost* rph = tab->render_view_host()->process(); base::KillProcess(rph->GetHandle(), 0, false); TestNotificationObserver observer; - RegisterAndWait(&observer, NotificationType::RENDERER_PROCESS_CLOSED, + RegisterAndWait(&observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(rph)); } void WaitForFocusChange(TabContents* tab_contents) { TestNotificationObserver observer; - RegisterAndWait(&observer, NotificationType::FOCUS_CHANGED_IN_PAGE, + RegisterAndWait(&observer, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, Source<TabContents>(tab_contents)); } void WaitForFocusInBrowser(Browser* browser) { TestNotificationObserver observer; - RegisterAndWait(&observer, NotificationType::FOCUS_RETURNED_TO_BROWSER, + RegisterAndWait(&observer, chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, Source<Browser>(browser)); } @@ -586,19 +587,19 @@ int FindInPage(TabContentsWrapper* tab_contents, const string16& search_string, return observer.number_of_matches(); } -void WaitForNotification(NotificationType type) { +void WaitForNotification(int type) { TestNotificationObserver observer; RegisterAndWait(&observer, type, NotificationService::AllSources()); } -void WaitForNotificationFrom(NotificationType type, +void WaitForNotificationFrom(int type, const NotificationSource& source) { TestNotificationObserver observer; RegisterAndWait(&observer, type, source); } void RegisterAndWait(NotificationObserver* observer, - NotificationType type, + int type, const NotificationSource& source) { NotificationRegistrar registrar; registrar.Add(observer, type, source); @@ -619,7 +620,7 @@ void WaitForHistoryToLoad(Browser* browser) { HistoryService* history_service = browser->profile()->GetHistoryService(Profile::EXPLICIT_ACCESS); if (!history_service->BackendLoaded()) - WaitForNotification(NotificationType::HISTORY_LOADED); + WaitForNotification(chrome::NOTIFICATION_HISTORY_LOADED); } bool GetNativeWindow(const Browser* browser, gfx::NativeWindow* native_window) { @@ -680,7 +681,7 @@ bool SendKeyPressAndWait(const Browser* browser, bool shift, bool alt, bool command, - NotificationType type, + int type, const NotificationSource& source) { WindowedNotificationObserver observer(type, source); @@ -832,7 +833,7 @@ TestNotificationObserver::TestNotificationObserver() TestNotificationObserver::~TestNotificationObserver() {} -void TestNotificationObserver::Observe(NotificationType type, +void TestNotificationObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { source_ = source; @@ -841,7 +842,7 @@ void TestNotificationObserver::Observe(NotificationType type, } WindowedNotificationObserver::WindowedNotificationObserver( - NotificationType notification_type, + int notification_type, const NotificationSource& source) : seen_(false), running_(false), @@ -875,7 +876,7 @@ void WindowedNotificationObserver::WaitFor(const NotificationSource& source) { ui_test_utils::RunMessageLoop(); } -void WindowedNotificationObserver::Observe(NotificationType type, +void WindowedNotificationObserver::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { if (waiting_for_ == source || @@ -896,7 +897,7 @@ TitleWatcher::TitleWatcher(TabContents* tab_contents, quit_loop_on_observation_(false) { EXPECT_TRUE(tab_contents != NULL); notification_registrar_.Add(this, - NotificationType::TAB_CONTENTS_TITLE_UPDATED, + content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED, Source<TabContents>(tab_contents)); } @@ -911,10 +912,10 @@ bool TitleWatcher::Wait() { return title_observed_; } -void TitleWatcher::Observe(NotificationType type, +void TitleWatcher::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { - if (type != NotificationType::TAB_CONTENTS_TITLE_UPDATED) + if (type != content::NOTIFICATION_TAB_CONTENTS_TITLE_UPDATED) return; TabContents* source_contents = Source<TabContents>(source).ptr(); @@ -928,13 +929,13 @@ void TitleWatcher::Observe(NotificationType type, } DOMMessageQueue::DOMMessageQueue() { - registrar_.Add(this, NotificationType::DOM_OPERATION_RESPONSE, + registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, NotificationService::AllSources()); } DOMMessageQueue::~DOMMessageQueue() {} -void DOMMessageQueue::Observe(NotificationType type, +void DOMMessageQueue::Observe(int type, const NotificationSource& source, const NotificationDetails& details) { Details<DomOperationNotificationDetails> dom_op_details(details); diff --git a/chrome/test/ui_test_utils.h b/chrome/test/ui_test_utils.h index c7c126c..a01cdae 100644 --- a/chrome/test/ui_test_utils.h +++ b/chrome/test/ui_test_utils.h @@ -37,7 +37,6 @@ class FilePath; class GURL; class MessageLoop; class NavigationController; -class NotificationType; class Profile; class RenderViewHost; class RenderWidgetHost; @@ -217,17 +216,17 @@ bool IsViewFocused(const Browser* browser, ViewID vid); void ClickOnView(const Browser* browser, ViewID vid); // Blocks until a notification for given |type| is received. -void WaitForNotification(NotificationType type); +void WaitForNotification(int type); // Blocks until a notification for given |type| from the specified |source| // is received. -void WaitForNotificationFrom(NotificationType type, +void WaitForNotificationFrom(int type, const NotificationSource& source); // Register |observer| for the given |type| and |source| and run // the message loop until the observer posts a quit task. void RegisterAndWait(NotificationObserver* observer, - NotificationType type, + int type, const NotificationSource& source); // Blocks until |model| finishes loading. @@ -268,7 +267,7 @@ bool SendKeyPressAndWait(const Browser* browser, bool shift, bool alt, bool command, - NotificationType type, + int type, const NotificationSource& source) WARN_UNUSED_RESULT; // Run a message loop only for the specified amount of time. @@ -364,7 +363,7 @@ class TestNotificationObserver : public NotificationObserver { } // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); @@ -390,7 +389,7 @@ class WindowedNotificationObserver : public NotificationObserver { // Register to listen for notifications of the given type from either a // specific source, or from all sources if |source| is // NotificationService::AllSources(). - WindowedNotificationObserver(NotificationType notification_type, + WindowedNotificationObserver(int notification_type, const NotificationSource& source); virtual ~WindowedNotificationObserver(); @@ -420,7 +419,7 @@ class WindowedNotificationObserver : public NotificationObserver { void WaitFor(const NotificationSource& source); // NotificationObserver: - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; @@ -442,7 +441,7 @@ template <class U> class WindowedNotificationObserverWithDetails : public WindowedNotificationObserver { public: - WindowedNotificationObserverWithDetails(NotificationType notification_type, + WindowedNotificationObserverWithDetails(int notification_type, const NotificationSource& source) : WindowedNotificationObserver(notification_type, source) {} @@ -456,7 +455,7 @@ class WindowedNotificationObserverWithDetails return true; } - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) { const U* details_ptr = Details<U>(details).ptr(); @@ -486,7 +485,7 @@ class TitleWatcher : public NotificationObserver { private: // NotificationObserver - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details) OVERRIDE; @@ -509,7 +508,7 @@ bool SendKeyPressAndWaitWithDetails( bool shift, bool alt, bool command, - NotificationType type, + int type, const NotificationSource& source, const Details<U>& details) WARN_UNUSED_RESULT; @@ -521,7 +520,7 @@ bool SendKeyPressAndWaitWithDetails( bool shift, bool alt, bool command, - NotificationType type, + int type, const NotificationSource& source, const Details<U>& details) { WindowedNotificationObserverWithDetails<U> observer(type, source); @@ -559,7 +558,7 @@ class DOMMessageQueue : public NotificationObserver { bool WaitForMessage(std::string* message) WARN_UNUSED_RESULT; // Overridden NotificationObserver methods. - virtual void Observe(NotificationType type, + virtual void Observe(int type, const NotificationSource& source, const NotificationDetails& details); |