summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/alternate_nav_url_fetcher.cc15
-rw-r--r--chrome/browser/alternate_nav_url_fetcher.h2
-rw-r--r--chrome/browser/autocomplete/autocomplete.cc9
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.cc9
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup.cc22
-rw-r--r--chrome/browser/autocomplete/autocomplete_unittest.cc9
-rw-r--r--chrome/browser/automation/automation_autocomplete_edit_tracker.h6
-rw-r--r--chrome/browser/automation/automation_browser_tracker.h6
-rw-r--r--chrome/browser/automation/automation_constrained_window_tracker.h8
-rw-r--r--chrome/browser/automation/automation_provider.cc138
-rw-r--r--chrome/browser/automation/automation_provider.h3
-rw-r--r--chrome/browser/automation/automation_tab_tracker.h23
-rw-r--r--chrome/browser/automation/automation_window_tracker.h8
-rw-r--r--chrome/browser/bookmarks/bookmark_model.cc27
-rw-r--r--chrome/browser/bookmarks/bookmark_model.h2
-rw-r--r--chrome/browser/bookmarks/bookmark_model_unittest.cc5
-rw-r--r--chrome/browser/browser.cc51
-rw-r--r--chrome/browser/browser.h2
-rw-r--r--chrome/browser/browser_accessibility_manager.cc6
-rw-r--r--chrome/browser/browser_accessibility_manager.h2
-rw-r--r--chrome/browser/browser_list.cc21
-rw-r--r--chrome/browser/browser_process.h10
-rw-r--r--chrome/browser/browsing_data_remover.cc7
-rw-r--r--chrome/browser/browsing_data_remover.h10
-rw-r--r--chrome/browser/cache_manager_host.cc8
-rw-r--r--chrome/browser/cert_store.cc6
-rw-r--r--chrome/browser/cert_store.h2
-rw-r--r--chrome/browser/chrome_plugin_browsing_context.cc5
-rw-r--r--chrome/browser/chrome_plugin_browsing_context.h9
-rw-r--r--chrome/browser/chrome_plugin_host.cc2
-rw-r--r--chrome/browser/debugger/debugger_host_impl.cpp5
-rw-r--r--chrome/browser/debugger/debugger_node.cc17
-rw-r--r--chrome/browser/debugger/debugger_node.h11
-rw-r--r--chrome/browser/debugger/debugger_window.cc4
-rw-r--r--chrome/browser/dom_ui/history_ui.cc7
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc9
-rw-r--r--chrome/browser/download/download_manager.cc14
-rw-r--r--chrome/browser/download/download_request_manager.cc16
-rw-r--r--chrome/browser/extensions/extensions_service.cc6
-rw-r--r--chrome/browser/extensions/user_script_master.cc3
-rw-r--r--chrome/browser/extensions/user_script_master_unittest.cc12
-rw-r--r--chrome/browser/external_tab_container.cc22
-rw-r--r--chrome/browser/external_tab_container.h2
-rw-r--r--chrome/browser/google_url_tracker.cc9
-rw-r--r--chrome/browser/google_url_tracker.h8
-rw-r--r--chrome/browser/history/expire_history_backend.cc9
-rw-r--r--chrome/browser/history/expire_history_backend.h2
-rw-r--r--chrome/browser/history/expire_history_backend_unittest.cc8
-rw-r--r--chrome/browser/history/history.cc12
-rw-r--r--chrome/browser/history/history.h3
-rw-r--r--chrome/browser/history/history_backend.cc16
-rw-r--r--chrome/browser/history/history_backend_unittest.cc1
-rw-r--r--chrome/browser/history/in_memory_history_backend.cc24
-rw-r--r--chrome/browser/history/in_memory_history_backend.h11
-rw-r--r--chrome/browser/history/starred_url_database.cc1
-rw-r--r--chrome/browser/history_model.cc93
-rw-r--r--chrome/browser/history_model.h11
-rwxr-xr-xchrome/browser/importer/importer.cc17
-rw-r--r--chrome/browser/importer/importer.h2
-rw-r--r--chrome/browser/jsmessage_box_handler_win.cc10
-rw-r--r--chrome/browser/jsmessage_box_handler_win.h2
-rw-r--r--chrome/browser/login_prompt.cc4
-rw-r--r--chrome/browser/metrics/metrics_service.cc94
-rw-r--r--chrome/browser/metrics/metrics_service.h11
-rw-r--r--chrome/browser/metrics/user_metrics.cc8
-rw-r--r--chrome/browser/modal_html_dialog_delegate.cc14
-rw-r--r--chrome/browser/modal_html_dialog_delegate.h2
-rw-r--r--chrome/browser/navigation_controller_unittest.cc170
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc18
-rw-r--r--chrome/browser/net/chrome_url_request_context.h2
-rw-r--r--chrome/browser/net/dns_global.cc12
-rw-r--r--chrome/browser/plugin_process_host.cc24
-rw-r--r--chrome/browser/printing/print_job.cc41
-rw-r--r--chrome/browser/printing/print_job.h2
-rw-r--r--chrome/browser/printing/print_job_manager.cc19
-rw-r--r--chrome/browser/printing/print_job_manager.h12
-rw-r--r--chrome/browser/printing/print_job_unittest.cc7
-rw-r--r--chrome/browser/printing/print_job_worker.cc4
-rw-r--r--chrome/browser/printing/print_view_manager.cc15
-rw-r--r--chrome/browser/printing/print_view_manager.h11
-rw-r--r--chrome/browser/printing/printed_document.cc4
-rw-r--r--chrome/browser/profile.cc18
-rw-r--r--chrome/browser/profile.h11
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc24
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.h2
-rw-r--r--chrome/browser/renderer_host/render_process_host.cc2
-rw-r--r--chrome/browser/renderer_host/render_widget_host.cc9
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc19
-rw-r--r--chrome/browser/repost_form_warning_dialog.cc22
-rw-r--r--chrome/browser/repost_form_warning_dialog.h11
-rw-r--r--chrome/browser/resource_message_filter.cc11
-rw-r--r--chrome/browser/resource_message_filter.h2
-rw-r--r--chrome/browser/rlz/rlz.cc4
-rw-r--r--chrome/browser/search_engines/template_url_model.cc20
-rw-r--r--chrome/browser/search_engines/template_url_model.h2
-rw-r--r--chrome/browser/sessions/session_restore.cc19
-rw-r--r--chrome/browser/sessions/session_service.cc27
-rw-r--r--chrome/browser/sessions/session_service.h2
-rw-r--r--chrome/browser/ssl/ssl_blocking_page.cc4
-rw-r--r--chrome/browser/ssl/ssl_blocking_page.h2
-rw-r--r--chrome/browser/ssl/ssl_manager.cc28
-rw-r--r--chrome/browser/ssl/ssl_manager.h2
-rw-r--r--chrome/browser/ssl/ssl_policy.cc6
-rw-r--r--chrome/browser/tab_contents/interstitial_page.cc19
-rw-r--r--chrome/browser/tab_contents/navigation_controller.cc18
-rw-r--r--chrome/browser/tab_contents/render_view_host_manager.cc4
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc48
-rw-r--r--chrome/browser/tab_contents/web_contents.cc103
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc9
-rw-r--r--chrome/browser/tabs/tab_strip_model.h2
-rw-r--r--chrome/browser/task_manager_resource_providers.cc36
-rw-r--r--chrome/browser/task_manager_resource_providers.h21
-rw-r--r--chrome/browser/views/blocked_popup_container.cc3
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc25
-rw-r--r--chrome/browser/views/bookmark_bubble_view.cc4
-rw-r--r--chrome/browser/views/constrained_window_impl.cc3
-rw-r--r--chrome/browser/views/download_started_animation.cc23
-rw-r--r--chrome/browser/views/download_started_animation.h11
-rw-r--r--chrome/browser/views/download_tab_view.cc15
-rw-r--r--chrome/browser/views/find_bar_win.cc3
-rw-r--r--chrome/browser/views/find_bar_win_unittest.cc5
-rw-r--r--chrome/browser/views/frame/browser_view.cc5
-rw-r--r--chrome/browser/views/infobars/infobar_container.cc15
-rw-r--r--chrome/browser/views/infobars/infobar_container.h2
-rw-r--r--chrome/browser/views/options/options_page_view.cc3
-rw-r--r--chrome/browser/views/options/options_page_view.h2
-rw-r--r--chrome/browser/views/tab_contents_container_view.cc16
-rw-r--r--chrome/browser/views/tab_contents_container_view.h2
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.cc17
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.h2
-rw-r--r--chrome/browser/views/toolbar_view.cc2
-rw-r--r--chrome/common/chrome_plugin_lib.cc2
-rw-r--r--chrome/common/chrome_plugin_util.cc9
-rw-r--r--chrome/common/chrome_plugin_util.h2
-rw-r--r--chrome/common/net/url_request_intercept_job.cc7
-rw-r--r--chrome/common/net/url_request_intercept_job.h2
-rw-r--r--chrome/common/notification_registrar.cc19
-rw-r--r--chrome/common/notification_registrar.h14
-rw-r--r--chrome/common/notification_service.cc59
-rw-r--r--chrome/common/notification_service.h27
-rw-r--r--chrome/common/notification_service_unittest.cc72
-rw-r--r--chrome/common/notification_type.h557
-rw-r--r--chrome/common/notification_types.h525
-rw-r--r--chrome/common/pref_member.cc5
-rw-r--r--chrome/common/pref_member.h3
-rw-r--r--chrome/common/pref_member_unittest.cc3
-rw-r--r--chrome/common/pref_service.cc2
-rw-r--r--chrome/common/pref_service_unittest.cc4
-rw-r--r--chrome/renderer/render_widget.cc2
-rw-r--r--chrome/test/in_process_browser_test.cc6
-rw-r--r--chrome/test/in_process_browser_test.h2
-rw-r--r--chrome/test/test_notification_tracker.cc4
-rw-r--r--chrome/test/testing_browser_process.h7
-rw-r--r--chrome/test/ui_test_utils.cc11
-rw-r--r--chrome/views/focus_manager.cc12
-rw-r--r--chrome/views/focus_manager.h11
-rw-r--r--chrome/views/native_control.cc2
-rw-r--r--chrome/views/root_view.cc8
-rw-r--r--chrome/views/root_view_win.cc1
-rw-r--r--chrome/views/view_storage.cc13
-rw-r--r--chrome/views/view_storage.h11
-rw-r--r--chrome/views/view_unittest.cc9
-rw-r--r--chrome/views/widget_win.cc3
-rw-r--r--chrome/views/window.cc7
164 files changed, 1819 insertions, 1541 deletions
diff --git a/chrome/browser/alternate_nav_url_fetcher.cc b/chrome/browser/alternate_nav_url_fetcher.cc
index d7642b6..a124a1c 100644
--- a/chrome/browser/alternate_nav_url_fetcher.cc
+++ b/chrome/browser/alternate_nav_url_fetcher.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/resource_bundle.h"
#include "generated_resources.h"
@@ -20,24 +21,24 @@ AlternateNavURLFetcher::AlternateNavURLFetcher(
state_(NOT_STARTED),
navigated_to_entry_(false),
infobar_contents_(NULL) {
- registrar_.Add(this, NOTIFY_NAV_ENTRY_PENDING,
+ registrar_.Add(this, NotificationType::NAV_ENTRY_PENDING,
NotificationService::AllSources());
}
void AlternateNavURLFetcher::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_NAV_ENTRY_PENDING:
+ switch (type.value) {
+ case NotificationType::NAV_ENTRY_PENDING:
controller_ = Source<NavigationController>(source).ptr();
DCHECK(controller_->GetPendingEntry());
// Unregister for this notification now that we're pending, and start
// listening for the corresponding commit. We also need to listen for the
// tab close command since that means the load will never commit!
- registrar_.Remove(this, NOTIFY_NAV_ENTRY_PENDING,
+ registrar_.Remove(this, NotificationType::NAV_ENTRY_PENDING,
NotificationService::AllSources());
- registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(controller_));
DCHECK_EQ(NOT_STARTED, state_);
@@ -48,9 +49,9 @@ void AlternateNavURLFetcher::Observe(NotificationType type,
fetcher_->Start();
break;
- case NOTIFY_NAV_ENTRY_COMMITTED:
+ case NotificationType::NAV_ENTRY_COMMITTED:
// The page was navigated, we can show the infobar now if necessary.
- registrar_.Remove(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(controller_));
navigated_to_entry_ = true;
ShowInfobarIfPossible();
diff --git a/chrome/browser/alternate_nav_url_fetcher.h b/chrome/browser/alternate_nav_url_fetcher.h
index 4fb204f..1bb978d 100644
--- a/chrome/browser/alternate_nav_url_fetcher.h
+++ b/chrome/browser/alternate_nav_url_fetcher.h
@@ -9,8 +9,8 @@
#include "chrome/browser/net/url_fetcher.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
-#include "chrome/common/notification_service.h"
class NavigationController;
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index 3100319..1281813 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <algorithm>
-
#include "chrome/browser/autocomplete/autocomplete.h"
+#include <algorithm>
+
#include "base/string_util.h"
#include "chrome/browser/autocomplete/history_url_provider.h"
#include "chrome/browser/autocomplete/history_contents_provider.h"
@@ -18,6 +18,7 @@
#include "chrome/browser/profile.h"
#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "googleurl/src/gurl.h"
@@ -691,7 +692,7 @@ void AutocompleteController::UpdateLatestResult(bool is_synchronous_pass) {
result_.CopyFrom(latest_result_);
NotificationService::current()->Notify(
- NOTIFY_AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE,
+ NotificationType::AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE,
Source<AutocompleteController>(this), NotificationService::NoDetails());
}
@@ -719,7 +720,7 @@ void AutocompleteController::CommitResult() {
result_.CopyFrom(latest_result_);
NotificationService::current()->Notify(
- NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED,
+ NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED,
Source<AutocompleteController>(this), NotificationService::NoDetails());
}
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index 4928b16..6dcbc9e 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -31,6 +31,7 @@
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/gfx/utils.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/os_exchange_data.h"
#include "chrome/common/win_util.h"
#include "googleurl/src/url_util.h"
@@ -284,7 +285,7 @@ void AutocompleteEditModel::SendOpenNotification(size_t selected_line,
else if (!has_temporary_text_)
log->inline_autocompleted_length = inline_autocomplete_text_.length();
NotificationService::current()->Notify(
- NOTIFY_OMNIBOX_OPENED_URL, Source<Profile>(profile_),
+ NotificationType::OMNIBOX_OPENED_URL, Source<Profile>(profile_),
Details<AutocompleteLog>(log.get()));
}
@@ -782,8 +783,10 @@ AutocompleteEditView::AutocompleteEditView(
}
AutocompleteEditView::~AutocompleteEditView() {
- NotificationService::current()->Notify(NOTIFY_AUTOCOMPLETE_EDIT_DESTROYED,
- Source<AutocompleteEditView>(this), NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::AUTOCOMPLETE_EDIT_DESTROYED,
+ Source<AutocompleteEditView>(this),
+ NotificationService::NoDetails());
}
void AutocompleteEditView::SaveStateToTab(TabContents* tab) {
diff --git a/chrome/browser/autocomplete/autocomplete_popup.cc b/chrome/browser/autocomplete/autocomplete_popup.cc
index d2437a3..c8c3f79 100644
--- a/chrome/browser/autocomplete/autocomplete_popup.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/views/location_bar_view.h"
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/resource_bundle.h"
#include "third_party/icu38/public/common/unicode/ubidi.h"
@@ -662,11 +663,14 @@ AutocompletePopupModel::AutocompletePopupModel(
hovered_line_(kNoMatch),
selected_line_(kNoMatch),
inside_synchronous_query_(false) {
- registrar_.Add(this, NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED,
- Source<AutocompleteController>(controller_.get()));
- registrar_.Add(this,
- NOTIFY_AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE,
- Source<AutocompleteController>(controller_.get()));
+ registrar_.Add(
+ this,
+ NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED,
+ Source<AutocompleteController>(controller_.get()));
+ registrar_.Add(
+ this,
+ NotificationType::AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE,
+ Source<AutocompleteController>(controller_.get()));
}
AutocompletePopupModel::~AutocompletePopupModel() {
@@ -880,7 +884,7 @@ void AutocompletePopupModel::Move(int count) {
// aren't out of sync. The better fix here is to roll the controller back to
// be in sync with what the popup is showing.
if (is_open() && !controller_->done()) {
- Observe(NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED,
+ Observe(NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED,
Source<AutocompleteController>(controller_.get()),
NotificationService::NoDetails());
}
@@ -929,8 +933,8 @@ void AutocompletePopupModel::Observe(NotificationType type,
return;
const AutocompleteResult& result = controller_->result();
- switch (type) {
- case NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED: {
+ switch (type.value) {
+ case NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED: {
selected_line_ = (result.default_match() == result.end()) ?
kNoMatch : (result.default_match() - result.begin());
// If we're going to trim the window size to no longer include the hovered
@@ -943,7 +947,7 @@ void AutocompletePopupModel::Observe(NotificationType type,
}
// FALL THROUGH
- case NOTIFY_AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE: {
+ case NotificationType::AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE: {
// Update the edit with the possibly new data for this match.
// NOTE: This must be done after the code above, so that our internal
// state will be consistent when the edit calls back to
diff --git a/chrome/browser/autocomplete/autocomplete_unittest.cc b/chrome/browser/autocomplete/autocomplete_unittest.cc
index 9127659..7e9800c 100644
--- a/chrome/browser/autocomplete/autocomplete_unittest.cc
+++ b/chrome/browser/autocomplete/autocomplete_unittest.cc
@@ -7,6 +7,7 @@
#include "base/string_util.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/common/notification_registrar.h"
+#include "chrome/common/notification_service.h"
#include "testing/gtest/include/gtest/gtest.h"
// identifiers for known autocomplete providers
@@ -118,11 +119,13 @@ class AutocompleteProviderTest : public testing::Test,
};
void AutocompleteProviderTest::SetUp() {
- registrar_.Add(this, NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED,
- NotificationService::AllSources());
registrar_.Add(this,
- NOTIFY_AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE,
+ NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED,
NotificationService::AllSources());
+ registrar_.Add(
+ this,
+ NotificationType::AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE,
+ NotificationService::AllSources());
ResetController(false);
}
diff --git a/chrome/browser/automation/automation_autocomplete_edit_tracker.h b/chrome/browser/automation/automation_autocomplete_edit_tracker.h
index 81f0ecd..e6d4cbd 100644
--- a/chrome/browser/automation/automation_autocomplete_edit_tracker.h
+++ b/chrome/browser/automation/automation_autocomplete_edit_tracker.h
@@ -12,7 +12,7 @@ class AutomationAutocompleteEditTracker:
public AutomationResourceTracker<AutocompleteEditView*> {
public:
explicit AutomationAutocompleteEditTracker(IPC::Message::Sender* automation)
- : AutomationResourceTracker(automation) { }
+ : AutomationResourceTracker(automation) { }
virtual ~AutomationAutocompleteEditTracker() {
ClearAllMappings();
@@ -20,13 +20,13 @@ class AutomationAutocompleteEditTracker:
virtual void AddObserver(AutocompleteEditView* resource) {
NotificationService::current()->AddObserver(
- this, NOTIFY_AUTOCOMPLETE_EDIT_DESTROYED,
+ this, NotificationType::AUTOCOMPLETE_EDIT_DESTROYED,
Source<AutocompleteEditView>(resource));
}
virtual void RemoveObserver(AutocompleteEditView* resource) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_AUTOCOMPLETE_EDIT_DESTROYED,
+ this, NotificationType::AUTOCOMPLETE_EDIT_DESTROYED,
Source<AutocompleteEditView>(resource));
}
};
diff --git a/chrome/browser/automation/automation_browser_tracker.h b/chrome/browser/automation/automation_browser_tracker.h
index a06ae10d..4cbc62b 100644
--- a/chrome/browser/automation/automation_browser_tracker.h
+++ b/chrome/browser/automation/automation_browser_tracker.h
@@ -13,7 +13,7 @@
class AutomationBrowserTracker : public AutomationResourceTracker<Browser*> {
public:
AutomationBrowserTracker(IPC::Message::Sender* automation)
- : AutomationResourceTracker(automation) { }
+ : AutomationResourceTracker(automation) { }
virtual ~AutomationBrowserTracker() {
ClearAllMappings();
@@ -21,12 +21,12 @@ public:
virtual void AddObserver(Browser* resource) {
NotificationService::current()->AddObserver(
- this, NOTIFY_BROWSER_CLOSED, Source<Browser>(resource));
+ this, NotificationType::BROWSER_CLOSED, Source<Browser>(resource));
}
virtual void RemoveObserver(Browser* resource) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_BROWSER_CLOSED, Source<Browser>(resource));
+ this, NotificationType::BROWSER_CLOSED, Source<Browser>(resource));
}
};
diff --git a/chrome/browser/automation/automation_constrained_window_tracker.h b/chrome/browser/automation/automation_constrained_window_tracker.h
index 093fb4f..0986f4a 100644
--- a/chrome/browser/automation/automation_constrained_window_tracker.h
+++ b/chrome/browser/automation/automation_constrained_window_tracker.h
@@ -14,7 +14,7 @@ class AutomationConstrainedWindowTracker
: public AutomationResourceTracker<ConstrainedWindow*> {
public:
AutomationConstrainedWindowTracker(IPC::Message::Sender* automation)
- : AutomationResourceTracker(automation) {}
+ : AutomationResourceTracker(automation) {}
virtual ~AutomationConstrainedWindowTracker() {
ClearAllMappings();
@@ -22,12 +22,14 @@ public:
virtual void AddObserver(ConstrainedWindow* resource) {
NotificationService::current()->AddObserver(
- this, NOTIFY_CWINDOW_CLOSED, Source<ConstrainedWindow>(resource));
+ this, NotificationType::CWINDOW_CLOSED,
+ Source<ConstrainedWindow>(resource));
}
virtual void RemoveObserver(ConstrainedWindow* resource) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_CWINDOW_CLOSED, Source<ConstrainedWindow>(resource));
+ this, NotificationType::CWINDOW_CLOSED,
+ Source<ConstrainedWindow>(resource));
}
};
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 0b52891..a613f78 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -47,9 +47,9 @@ class InitialLoadObserver : public NotificationObserver {
automation_(automation) {
if (outstanding_tab_count_ > 0) {
NotificationService* service = NotificationService::current();
- registrar_.Add(this, NOTIFY_LOAD_START,
+ registrar_.Add(this, NotificationType::LOAD_START,
NotificationService::AllSources());
- registrar_.Add(this, NOTIFY_LOAD_STOP,
+ registrar_.Add(this, NotificationType::LOAD_STOP,
NotificationService::AllSources());
}
}
@@ -65,10 +65,10 @@ class InitialLoadObserver : public NotificationObserver {
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_LOAD_START) {
+ if (type == NotificationType::LOAD_START) {
if (outstanding_tab_count_ > loading_tabs_.size())
loading_tabs_.insert(source.map_key());
- } else if (type == NOTIFY_LOAD_STOP) {
+ } else if (type == NotificationType::LOAD_STOP) {
if (outstanding_tab_count_ > finished_tabs_.size()) {
if (loading_tabs_.find(source.map_key()) != loading_tabs_.end())
finished_tabs_.insert(source.map_key());
@@ -96,9 +96,9 @@ class NewTabUILoadObserver : public NotificationObserver {
public:
explicit NewTabUILoadObserver(AutomationProvider* automation)
: automation_(automation) {
- NotificationService::current()->
- AddObserver(this, NOTIFY_INITIAL_NEW_TAB_UI_LOAD,
- NotificationService::AllSources());
+ NotificationService::current()->AddObserver(
+ this, NotificationType::INITIAL_NEW_TAB_UI_LOAD,
+ NotificationService::AllSources());
}
~NewTabUILoadObserver() {
@@ -106,15 +106,15 @@ class NewTabUILoadObserver : public NotificationObserver {
}
void Unregister() {
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_INITIAL_NEW_TAB_UI_LOAD,
- NotificationService::AllSources());
+ NotificationService::current()->RemoveObserver(
+ this, NotificationType::INITIAL_NEW_TAB_UI_LOAD,
+ NotificationService::AllSources());
}
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_INITIAL_NEW_TAB_UI_LOAD) {
+ if (type == NotificationType::INITIAL_NEW_TAB_UI_LOAD) {
Details<int> load_time(details);
automation_->Send(
new AutomationMsg_InitialNewTabUILoadComplete(0, *load_time.ptr()));
@@ -141,7 +141,7 @@ class NavigationControllerRestoredObserver : public NotificationObserver {
} else {
registered_ = true;
NotificationService* service = NotificationService::current();
- service->AddObserver(this, NOTIFY_LOAD_STOP,
+ service->AddObserver(this, NotificationType::LOAD_STOP,
NotificationService::AllSources());
}
}
@@ -163,7 +163,7 @@ class NavigationControllerRestoredObserver : public NotificationObserver {
private:
void Unregister() {
NotificationService* service = NotificationService::current();
- service->RemoveObserver(this, NOTIFY_LOAD_STOP,
+ service->RemoveObserver(this, NotificationType::LOAD_STOP,
NotificationService::AllSources());
registered_ = false;
}
@@ -197,15 +197,15 @@ class NavigationNotificationObserver : public NotificationObserver {
controller_(controller),
navigation_started_(false) {
NotificationService* service = NotificationService::current();
- service->AddObserver(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ service->AddObserver(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(controller_));
- service->AddObserver(this, NOTIFY_LOAD_START,
+ service->AddObserver(this, NotificationType::LOAD_START,
Source<NavigationController>(controller_));
- service->AddObserver(this, NOTIFY_LOAD_STOP,
+ service->AddObserver(this, NotificationType::LOAD_STOP,
Source<NavigationController>(controller_));
- service->AddObserver(this, NOTIFY_AUTH_NEEDED,
+ service->AddObserver(this, NotificationType::AUTH_NEEDED,
Source<NavigationController>(controller_));
- service->AddObserver(this, NOTIFY_AUTH_SUPPLIED,
+ service->AddObserver(this, NotificationType::AUTH_SUPPLIED,
Source<NavigationController>(controller_));
}
@@ -226,15 +226,15 @@ class NavigationNotificationObserver : public NotificationObserver {
void Unregister() {
NotificationService* service = NotificationService::current();
- service->RemoveObserver(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ service->RemoveObserver(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(controller_));
- service->RemoveObserver(this, NOTIFY_LOAD_START,
+ service->RemoveObserver(this, NotificationType::LOAD_START,
Source<NavigationController>(controller_));
- service->RemoveObserver(this, NOTIFY_LOAD_STOP,
+ service->RemoveObserver(this, NotificationType::LOAD_STOP,
Source<NavigationController>(controller_));
- service->RemoveObserver(this, NOTIFY_AUTH_NEEDED,
+ service->RemoveObserver(this, NotificationType::AUTH_NEEDED,
Source<NavigationController>(controller_));
- service->RemoveObserver(this, NOTIFY_AUTH_SUPPLIED,
+ service->RemoveObserver(this, NotificationType::AUTH_SUPPLIED,
Source<NavigationController>(controller_));
}
@@ -246,23 +246,24 @@ class NavigationNotificationObserver : public NotificationObserver {
// 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 NOTIFY_NAV_ENTRY_COMMITTED until after we authenticate, so we need the
- // NOTIFY_LOAD_START.
- if (type == NOTIFY_NAV_ENTRY_COMMITTED || type == NOTIFY_LOAD_START) {
+ // 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) {
navigation_started_ = true;
- } else if (type == NOTIFY_LOAD_STOP) {
+ } else if (type == NotificationType::LOAD_STOP) {
if (navigation_started_) {
navigation_started_ = false;
ConditionMet(&completed_response_);
}
- } else if (type == NOTIFY_AUTH_SUPPLIED) {
+ } else if (type == NotificationType::AUTH_SUPPLIED) {
// 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 == NOTIFY_AUTH_NEEDED) {
+ } else if (type == NotificationType::AUTH_NEEDED) {
if (navigation_started_) {
// Remember the login handler that wants authentication.
LoginHandler* handler =
@@ -336,8 +337,8 @@ class TabAppendedNotificationObserver : public TabStripNotificationObserver {
public:
TabAppendedNotificationObserver(Browser* parent,
AutomationProvider* automation, int32 routing_id)
- : TabStripNotificationObserver(parent, NOTIFY_TAB_PARENTED, automation,
- routing_id) {
+ : TabStripNotificationObserver(parent, NotificationType::TAB_PARENTED,
+ automation, routing_id) {
}
virtual void ObserveTab(NavigationController* controller) {
@@ -362,10 +363,10 @@ class TabClosedNotificationObserver : public TabStripNotificationObserver {
int32 routing_id,
bool wait_until_closed)
: TabStripNotificationObserver(parent,
- wait_until_closed ? NOTIFY_TAB_CLOSED :
- NOTIFY_TAB_CLOSING,
- automation,
- routing_id) {
+ wait_until_closed ? NotificationType::TAB_CLOSED :
+ NotificationType::TAB_CLOSING,
+ automation,
+ routing_id) {
}
virtual void ObserveTab(NavigationController* controller) {
@@ -380,14 +381,14 @@ class BrowserClosedNotificationObserver : public NotificationObserver {
int32 routing_id)
: automation_(automation),
routing_id_(routing_id) {
- NotificationService::current()->
- AddObserver(this, NOTIFY_BROWSER_CLOSED, Source<Browser>(browser));
+ NotificationService::current()->AddObserver(this,
+ NotificationType::BROWSER_CLOSED, Source<Browser>(browser));
}
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_BROWSER_CLOSED);
+ DCHECK(type == NotificationType::BROWSER_CLOSED);
Details<bool> close_app(details);
automation_->Send(
new AutomationMsg_CloseBrowserResponse(routing_id_,
@@ -410,9 +411,10 @@ class FindInPageNotificationObserver : public NotificationObserver {
parent_tab_(parent_tab),
routing_id_(routing_id),
active_match_ordinal_(-1) {
- NotificationService::current()->
- AddObserver(this, NOTIFY_FIND_RESULT_AVAILABLE,
- Source<TabContents>(parent_tab_));
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::FIND_RESULT_AVAILABLE,
+ Source<TabContents>(parent_tab_));
}
~FindInPageNotificationObserver() {
@@ -421,13 +423,13 @@ class FindInPageNotificationObserver : public NotificationObserver {
void Unregister() {
NotificationService::current()->
- RemoveObserver(this, NOTIFY_FIND_RESULT_AVAILABLE,
+ RemoveObserver(this, NotificationType::FIND_RESULT_AVAILABLE,
Source<TabContents>(parent_tab_));
}
virtual void Observe(NotificationType type, const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_FIND_RESULT_AVAILABLE) {
+ if (type == NotificationType::FIND_RESULT_AVAILABLE) {
Details<FindNotificationDetails> find_details(details);
if (find_details->request_id() == kFindInPageRequestId) {
// We get multiple responses and one of those will contain the ordinal.
@@ -471,19 +473,19 @@ class DomOperationNotificationObserver : public NotificationObserver {
explicit DomOperationNotificationObserver(AutomationProvider* automation)
: automation_(automation) {
NotificationService::current()->
- AddObserver(this, NOTIFY_DOM_OPERATION_RESPONSE,
+ AddObserver(this, NotificationType::DOM_OPERATION_RESPONSE,
NotificationService::AllSources());
}
~DomOperationNotificationObserver() {
NotificationService::current()->
- RemoveObserver(this, NOTIFY_DOM_OPERATION_RESPONSE,
+ RemoveObserver(this, NotificationType::DOM_OPERATION_RESPONSE,
NotificationService::AllSources());
}
virtual void Observe(NotificationType type, const NotificationSource& source,
const NotificationDetails& details) {
- if (NOTIFY_DOM_OPERATION_RESPONSE == type) {
+ if (NotificationType::DOM_OPERATION_RESPONSE == type) {
Details<DomOperationNotificationDetails> dom_op_details(details);
automation_->Send(new AutomationMsg_DomOperationResponse(
dom_op_details->automation_id(),
@@ -498,20 +500,22 @@ class DomInspectorNotificationObserver : public NotificationObserver {
public:
explicit DomInspectorNotificationObserver(AutomationProvider* automation)
: automation_(automation) {
- NotificationService::current()->
- AddObserver(this, NOTIFY_DOM_INSPECT_ELEMENT_RESPONSE,
- NotificationService::AllSources());
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::DOM_INSPECT_ELEMENT_RESPONSE,
+ NotificationService::AllSources());
}
~DomInspectorNotificationObserver() {
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_DOM_INSPECT_ELEMENT_RESPONSE,
- NotificationService::AllSources());
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::DOM_INSPECT_ELEMENT_RESPONSE,
+ NotificationService::AllSources());
}
virtual void Observe(NotificationType type, const NotificationSource& source,
const NotificationDetails& details) {
- if (NOTIFY_DOM_INSPECT_ELEMENT_RESPONSE == type) {
+ if (NotificationType::DOM_INSPECT_ELEMENT_RESPONSE == type) {
Details<int> dom_inspect_details(details);
automation_->ReceivedInspectElementResponse(*(dom_inspect_details.ptr()));
}
@@ -528,24 +532,26 @@ class DocumentPrintedNotificationObserver : public NotificationObserver {
: automation_(automation),
routing_id_(routing_id),
success_(false) {
- NotificationService::current()->
- AddObserver(this, NOTIFY_PRINT_JOB_EVENT,
- NotificationService::AllSources());
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::PRINT_JOB_EVENT,
+ NotificationService::AllSources());
}
~DocumentPrintedNotificationObserver() {
automation_->Send(
new AutomationMsg_PrintNowResponse(routing_id_, success_));
automation_->RemoveNavigationStatusListener(this);
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_PRINT_JOB_EVENT,
- NotificationService::AllSources());
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::PRINT_JOB_EVENT,
+ NotificationService::AllSources());
}
virtual void Observe(NotificationType type, const NotificationSource& source,
const NotificationDetails& details) {
using namespace printing;
- DCHECK(type == NOTIFY_PRINT_JOB_EVENT);
+ DCHECK(type == NotificationType::PRINT_JOB_EVENT);
switch (Details<JobEventDetails>(details)->type()) {
case JobEventDetails::JOB_DONE: {
// Succeeded.
@@ -2381,12 +2387,16 @@ WebContents* AutomationProvider::GetWebContentsForHandle(
TestingAutomationProvider::TestingAutomationProvider(Profile* profile)
: AutomationProvider(profile) {
BrowserList::AddObserver(this);
- NotificationService::current()->AddObserver(this, NOTIFY_SESSION_END,
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::SESSION_END,
NotificationService::AllSources());
}
TestingAutomationProvider::~TestingAutomationProvider() {
- NotificationService::current()->RemoveObserver(this, NOTIFY_SESSION_END,
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::SESSION_END,
NotificationService::AllSources());
BrowserList::RemoveObserver(this);
}
@@ -2401,7 +2411,7 @@ void TestingAutomationProvider::OnBrowserRemoving(const Browser* browser) {
// want the automation provider (and hence the process) to go away when the
// last browser goes away.
if (BrowserList::size() == 1) {
- // If you change this, update Observer for NOTIFY_SESSION_END below.
+ // If you change this, update Observer for NotificationType::SESSION_END below.
MessageLoop::current()->PostTask(FROM_HERE,
NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider));
}
@@ -2410,7 +2420,7 @@ void TestingAutomationProvider::OnBrowserRemoving(const Browser* browser) {
void TestingAutomationProvider::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_SESSION_END);
+ DCHECK(type == NotificationType::SESSION_END);
// OnBrowserRemoving 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 OnBrowserRemoving.
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 841bfce..d36fa34 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -24,7 +24,7 @@
#include "chrome/browser/history/history.h"
#include "chrome/common/ipc_channel_proxy.h"
#include "chrome/common/ipc_message.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/views/event.h"
class LoginHandler;
@@ -443,4 +443,5 @@ class TestingAutomationProvider : public AutomationProvider,
void OnRemoveProvider(); // Called via PostTask
};
+
#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_H_
diff --git a/chrome/browser/automation/automation_tab_tracker.h b/chrome/browser/automation/automation_tab_tracker.h
index a221ae4..d119915 100644
--- a/chrome/browser/automation/automation_tab_tracker.h
+++ b/chrome/browser/automation/automation_tab_tracker.h
@@ -10,12 +10,13 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/common/notification_registrar.h"
+#include "chrome/common/notification_type.h"
class AutomationTabTracker
: public AutomationResourceTracker<NavigationController*> {
public:
AutomationTabTracker(IPC::Message::Sender* automation)
- : AutomationResourceTracker(automation) {}
+ : AutomationResourceTracker(automation) {}
virtual ~AutomationTabTracker() {
ClearAllMappings();
@@ -24,35 +25,35 @@ public:
virtual void AddObserver(NavigationController* resource) {
// This tab could either be a regular tab or an external tab
// Register for both notifications.
- registrar_.Add(this, NOTIFY_TAB_CLOSING,
+ registrar_.Add(this, NotificationType::TAB_CLOSING,
Source<NavigationController>(resource));
- registrar_.Add(this, NOTIFY_EXTERNAL_TAB_CLOSED,
+ registrar_.Add(this, NotificationType::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, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(resource));
}
virtual void RemoveObserver(NavigationController* resource) {
- registrar_.Remove(this, NOTIFY_TAB_CLOSING,
+ registrar_.Remove(this, NotificationType::TAB_CLOSING,
Source<NavigationController>(resource));
- registrar_.Remove(this, NOTIFY_EXTERNAL_TAB_CLOSED,
+ registrar_.Remove(this, NotificationType::EXTERNAL_TAB_CLOSED,
Source<NavigationController>(resource));
- registrar_.Remove(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(resource));
}
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_NAV_ENTRY_COMMITTED:
+ switch (type.value) {
+ case NotificationType::NAV_ENTRY_COMMITTED:
last_navigation_times_[Source<NavigationController>(source).ptr()] =
base::Time::Now();
return;
- case NOTIFY_EXTERNAL_TAB_CLOSED:
- case NOTIFY_TAB_CLOSING:
+ case NotificationType::EXTERNAL_TAB_CLOSED:
+ case NotificationType::TAB_CLOSING:
std::map<NavigationController*, base::Time>::iterator iter =
last_navigation_times_.find(
Source<NavigationController>(source).ptr());
diff --git a/chrome/browser/automation/automation_window_tracker.h b/chrome/browser/automation/automation_window_tracker.h
index 32ecead..9d95e5d 100644
--- a/chrome/browser/automation/automation_window_tracker.h
+++ b/chrome/browser/automation/automation_window_tracker.h
@@ -11,20 +11,20 @@
class AutomationWindowTracker
: public AutomationResourceTracker<HWND> {
public:
- AutomationWindowTracker(IPC::Message::Sender* automation) :
- AutomationResourceTracker(automation) { }
+ AutomationWindowTracker(IPC::Message::Sender* automation)
+ : AutomationResourceTracker(automation) { }
virtual ~AutomationWindowTracker() {
ClearAllMappings();
}
virtual void AddObserver(HWND resource) {
NotificationService::current()->AddObserver(
- this, NOTIFY_WINDOW_CLOSED, Source<HWND>(resource));
+ this, NotificationType::WINDOW_CLOSED, Source<HWND>(resource));
}
virtual void RemoveObserver(HWND resource) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_WINDOW_CLOSED, Source<HWND>(resource));
+ this, NotificationType::WINDOW_CLOSED, Source<HWND>(resource));
}
};
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index afb42df..4280808 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/bookmarks/bookmark_storage.h"
#include "chrome/browser/profile.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/scoped_vector.h"
#include "generated_resources.h"
@@ -87,12 +88,12 @@ BookmarkModel::BookmarkModel(Profile* profile)
BookmarkModel::~BookmarkModel() {
if (profile_ && store_.get()) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_FAVICON_CHANGED, Source<Profile>(profile_));
+ this, NotificationType::FAVICON_CHANGED, Source<Profile>(profile_));
}
if (waiting_for_history_load_) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_HISTORY_LOADED, Source<Profile>(profile_));
+ this, NotificationType::HISTORY_LOADED, Source<Profile>(profile_));
}
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
@@ -118,7 +119,7 @@ void BookmarkModel::Load() {
// Listen for changes to favicons so that we can update the favicon of the
// node appropriately.
NotificationService::current()->AddObserver(
- this, NOTIFY_FAVICON_CHANGED, Source<Profile>(profile_));
+ this,NotificationType::FAVICON_CHANGED, Source<Profile>(profile_));
// Load the bookmarks. BookmarkStorage notifies us when done.
store_ = new BookmarkStorage(profile_, this);
@@ -324,7 +325,7 @@ void BookmarkModel::ResetDateGroupModified(BookmarkNode* node) {
void BookmarkModel::ClearStore() {
if (profile_ && store_.get()) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_FAVICON_CHANGED, Source<Profile>(profile_));
+ this, NotificationType::FAVICON_CHANGED, Source<Profile>(profile_));
}
store_ = NULL;
}
@@ -408,7 +409,7 @@ void BookmarkModel::OnBookmarkStorageLoadedBookmarks(
waiting_for_history_load_ = true;
NotificationService::current()->AddObserver(
- this, NOTIFY_HISTORY_LOADED, Source<Profile>(profile_));
+ this, NotificationType::HISTORY_LOADED, Source<Profile>(profile_));
} else {
OnHistoryDone();
}
@@ -445,7 +446,7 @@ void BookmarkModel::DoneLoading() {
// And generic notification.
NotificationService::current()->Notify(
- NOTIFY_BOOKMARK_MODEL_LOADED,
+ NotificationType::BOOKMARK_MODEL_LOADED,
Source<Profile>(profile_),
NotificationService::NoDetails());
}
@@ -491,7 +492,8 @@ void BookmarkModel::RemoveAndDeleteNode(BookmarkNode* delete_me) {
history->URLsNoLongerBookmarked(details.changed_urls);
}
- NotificationService::current()->Notify(NOTIFY_URLS_STARRED,
+ NotificationService::current()->Notify(
+ NotificationType::URLS_STARRED,
Source<Profile>(profile_),
Details<history::URLsStarredDetails>(&details));
}
@@ -511,7 +513,8 @@ BookmarkNode* BookmarkModel::AddNode(BookmarkNode* parent,
if (node->GetType() == history::StarredEntry::URL && !was_bookmarked) {
history::URLsStarredDetails details(true);
details.changed_urls.insert(node->GetURL());
- NotificationService::current()->Notify(NOTIFY_URLS_STARRED,
+ NotificationService::current()->Notify(
+ NotificationType::URLS_STARRED,
Source<Profile>(profile_),
Details<history::URLsStarredDetails>(&details));
}
@@ -626,8 +629,8 @@ void BookmarkModel::CancelPendingFavIconLoadRequests(BookmarkNode* node) {
void BookmarkModel::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_FAVICON_CHANGED: {
+ switch (type.value) {
+ case NotificationType::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();
@@ -646,11 +649,11 @@ void BookmarkModel::Observe(NotificationType type,
break;
}
- case NOTIFY_HISTORY_LOADED: {
+ case NotificationType::HISTORY_LOADED: {
if (waiting_for_history_load_) {
waiting_for_history_load_ = false;
NotificationService::current()->RemoveObserver(
- this, NOTIFY_HISTORY_LOADED, Source<Profile>(profile_));
+ this,NotificationType::HISTORY_LOADED, Source<Profile>(profile_));
OnHistoryDone();
} else {
NOTREACHED();
diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h
index 6f33274..52cbe46 100644
--- a/chrome/browser/bookmarks/bookmark_model.h
+++ b/chrome/browser/bookmarks/bookmark_model.h
@@ -17,7 +17,7 @@
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_types.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/views/tree_node_model.h"
#include "googleurl/src/gurl.h"
#include "skia/include/SkBitmap.h"
diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc
index 1ef384c..0264c3a 100644
--- a/chrome/browser/bookmarks/bookmark_model_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc
@@ -9,6 +9,7 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/notification_registrar.h"
+#include "chrome/common/notification_service.h"
#include "chrome/test/testing_profile.h"
#include "chrome/views/tree_node_model.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -413,13 +414,13 @@ namespace {
class StarredListener : public NotificationObserver {
public:
StarredListener() : notification_count_(0), details_(false) {
- registrar_.Add(this, NOTIFY_URLS_STARRED, Source<Profile>(NULL));
+ registrar_.Add(this, NotificationType::URLS_STARRED, Source<Profile>(NULL));
}
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_URLS_STARRED) {
+ if (type == NotificationType::URLS_STARRED) {
notification_count_++;
details_ = *(Details<history::URLsStarredDetails>(details).ptr());
}
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 1ad5d8b..d686f1f 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/tab_contents/tab_contents_type.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@@ -179,7 +180,9 @@ Browser::Browser(Type type, Profile* profile)
tabstrip_model_.AddObserver(this);
NotificationService::current()->AddObserver(
- this, NOTIFY_SSL_STATE_CHANGED, NotificationService::AllSources());
+ this,
+ NotificationType::SSL_STATE_CHANGED,
+ NotificationService::AllSources());
InitCommandState();
BrowserList::AddBrowser(this);
@@ -222,7 +225,9 @@ Browser::~Browser() {
tab_restore_service->BrowserClosed(this);
NotificationService::current()->RemoveObserver(
- this, NOTIFY_SSL_STATE_CHANGED, NotificationService::AllSources());
+ this,
+ NotificationType::SSL_STATE_CHANGED,
+ NotificationService::AllSources());
if (profile_->IsOffTheRecord() &&
!BrowserList::IsOffTheRecordSessionActive()) {
@@ -1433,18 +1438,19 @@ void Browser::TabInsertedAt(TabContents* 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.
- NotificationService::current()->
- AddObserver(this, NOTIFY_WEB_CONTENTS_DISCONNECTED,
- Source<TabContents>(contents));
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::WEB_CONTENTS_DISCONNECTED,
+ Source<TabContents>(contents));
}
void Browser::TabClosingAt(TabContents* contents, int index) {
NavigationController* controller = contents->controller();
DCHECK(controller);
- NotificationService::current()->
- Notify(NOTIFY_TAB_CLOSING,
- Source<NavigationController>(controller),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::TAB_CLOSING,
+ Source<NavigationController>(controller),
+ NotificationService::NoDetails());
// Sever the TabContents' connection back to us.
contents->set_delegate(NULL);
@@ -1457,9 +1463,10 @@ void Browser::TabDetachedAt(TabContents* contents, int index) {
RemoveScheduledUpdatesFor(contents);
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_WEB_CONTENTS_DISCONNECTED,
- Source<TabContents>(contents));
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::WEB_CONTENTS_DISCONNECTED,
+ Source<TabContents>(contents));
}
void Browser::TabSelectedAt(TabContents* old_contents,
@@ -1681,12 +1688,14 @@ void Browser::ReplaceContents(TabContents* source, TabContents* new_contents) {
// Need to remove ourselves as an observer for disconnection on the replaced
// TabContents, since we only care to fire onbeforeunload handlers on active
// Tabs. Make sure an observer is added for the replacement TabContents.
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_WEB_CONTENTS_DISCONNECTED,
- Source<TabContents>(source));
- NotificationService::current()->
- AddObserver(this, NOTIFY_WEB_CONTENTS_DISCONNECTED,
- Source<TabContents>(new_contents));
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::WEB_CONTENTS_DISCONNECTED,
+ Source<TabContents>(source));
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::WEB_CONTENTS_DISCONNECTED,
+ Source<TabContents>(new_contents));
}
void Browser::AddNewContents(TabContents* source,
@@ -1910,8 +1919,8 @@ void Browser::FileSelected(const std::wstring& path, void* params) {
void Browser::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_WEB_CONTENTS_DISCONNECTED:
+ switch (type.value) {
+ case NotificationType::WEB_CONTENTS_DISCONNECTED:
if (is_attempting_to_close_browser_) {
// Need to do this asynchronously as it will close the tab, which is
// currently on the call stack above us.
@@ -1921,7 +1930,7 @@ void Browser::Observe(NotificationType type,
}
break;
- case NOTIFY_SSL_STATE_CHANGED:
+ case NotificationType::SSL_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
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 6e71de4..583bd87 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -19,7 +19,7 @@
#include "chrome/browser/command_updater.h"
#include "chrome/browser/sessions/session_id.h"
#include "chrome/browser/tabs/tab_strip_model.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/pref_member.h"
#include "base/gfx/rect.h"
#include "skia/include/SkBitmap.h"
diff --git a/chrome/browser/browser_accessibility_manager.cc b/chrome/browser/browser_accessibility_manager.cc
index 4eef338..4497b8e 100644
--- a/chrome/browser/browser_accessibility_manager.cc
+++ b/chrome/browser/browser_accessibility_manager.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/browser_accessibility.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_widget_host.h"
+#include "chrome/common/notification_service.h"
// The time in ms after which we give up and return an error when processing an
// accessibility message and no response has been received from the renderer.
@@ -20,7 +21,8 @@ BrowserAccessibilityManager* BrowserAccessibilityManager::GetInstance() {
BrowserAccessibilityManager::BrowserAccessibilityManager()
: instance_id_(0) {
NotificationService::current()->AddObserver(this,
- NOTIFY_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources());
+ NotificationType::RENDERER_PROCESS_TERMINATED,
+ NotificationService::AllSources());
}
BrowserAccessibilityManager::~BrowserAccessibilityManager() {
@@ -148,7 +150,7 @@ int BrowserAccessibilityManager::SetMembers(BrowserAccessibility* browser_acc,
void BrowserAccessibilityManager::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_RENDERER_PROCESS_TERMINATED);
+ DCHECK(type ==NotificationType::RENDERER_PROCESS_TERMINATED);
RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr();
DCHECK(rph);
RenderProcessHostMap::iterator it = render_process_host_map_.find(rph);
diff --git a/chrome/browser/browser_accessibility_manager.h b/chrome/browser/browser_accessibility_manager.h
index 8356bc4..c9c5ad5 100644
--- a/chrome/browser/browser_accessibility_manager.h
+++ b/chrome/browser/browser_accessibility_manager.h
@@ -9,7 +9,7 @@
#include <hash_map>
#include "base/singleton.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/render_messages.h"
class BrowserAccessibility;
diff --git a/chrome/browser/browser_list.cc b/chrome/browser/browser_list.cc
index de66406..02a1658 100644
--- a/chrome/browser/browser_list.cc
+++ b/chrome/browser/browser_list.cc
@@ -31,8 +31,9 @@ void BrowserList::AddBrowser(Browser* browser) {
g_browser_process->AddRefModule();
NotificationService::current()->Notify(
- NOTIFY_BROWSER_OPENED,
- Source<Browser>(browser), NotificationService::NoDetails());
+ NotificationType::BROWSER_OPENED,
+ Source<Browser>(browser),
+ NotificationService::NoDetails());
// Send out notifications after add has occurred. Do some basic checking to
// try to catch evil observers that change the list from under us.
@@ -49,7 +50,7 @@ void BrowserList::RemoveBrowser(Browser* browser) {
bool close_app = (browsers_.size() == 1);
NotificationService::current()->Notify(
- NOTIFY_BROWSER_CLOSED,
+ NotificationType::BROWSER_CLOSED,
Source<Browser>(browser), Details<bool>(&close_app));
// Send out notifications before anything changes. Do some basic checking to
@@ -65,9 +66,10 @@ void BrowserList::RemoveBrowser(Browser* browser) {
// If the last Browser object was destroyed, make sure we try to close any
// remaining dependent windows too.
if (browsers_.empty()) {
- NotificationService::current()->Notify(NOTIFY_ALL_APPWINDOWS_CLOSED,
- NotificationService::AllSources(),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::ALL_APPWINDOWS_CLOSED,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
}
g_browser_process->ReleaseModule();
@@ -142,9 +144,10 @@ void BrowserList::WindowsSessionEnding() {
// Send out notification. This is used during testing so that the test harness
// can properly shutdown before we exit.
- NotificationService::current()->Notify(NOTIFY_SESSION_END,
- NotificationService::AllSources(),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::SESSION_END,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
// And shutdown.
browser_shutdown::Shutdown();
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h
index 22b13d3..7343737 100644
--- a/chrome/browser/browser_process.h
+++ b/chrome/browser/browser_process.h
@@ -7,8 +7,8 @@
// will return NULL if the service is not available, so callers must check for
// this condition.
-#ifndef CHROME_BROWSER_BROWSER_PROCESS_H__
-#define CHROME_BROWSER_BROWSER_PROCESS_H__
+#ifndef CHROME_BROWSER_BROWSER_PROCESS_H_
+#define CHROME_BROWSER_BROWSER_PROCESS_H_
#include <string>
#include <vector>
@@ -25,7 +25,6 @@ class DownloadRequestManager;
class GoogleURLTracker;
class IconManager;
class MetricsService;
-class NotificationService;
class PrefService;
class ProfileManager;
class DebuggerWrapper;
@@ -142,10 +141,9 @@ class BrowserProcess {
// User-data-dir based profiles.
std::vector<std::wstring> user_data_dir_profiles_;
- DISALLOW_EVIL_CONSTRUCTORS(BrowserProcess);
+ DISALLOW_COPY_AND_ASSIGN(BrowserProcess);
};
extern BrowserProcess* g_browser_process;
-#endif // CHROME_BROWSER_BROWSER_PROCESS_H__
-
+#endif // CHROME_BROWSER_BROWSER_PROCESS_H_
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index 0e40380..00f805b 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -67,7 +67,7 @@ void BrowsingDataRemover::Remove(int remove_mask) {
if (keywords_model && !keywords_model->loaded()) {
waiting_for_keywords_ = true;
NotificationService::current()->AddObserver(
- this, TEMPLATE_URL_MODEL_LOADED,
+ this, NotificationType::TEMPLATE_URL_MODEL_LOADED,
Source<TemplateURLModel>(keywords_model));
keywords_model->Load();
} else if (keywords_model) {
@@ -156,11 +156,12 @@ void BrowsingDataRemover::Observe(NotificationType type,
// 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 == TEMPLATE_URL_MODEL_LOADED);
+ DCHECK(type == NotificationType::TEMPLATE_URL_MODEL_LOADED);
TemplateURLModel* model = Source<TemplateURLModel>(source).ptr();
if (model->profile() == profile_->GetOriginalProfile()) {
NotificationService::current()->RemoveObserver(
- this, TEMPLATE_URL_MODEL_LOADED,
+ this,
+ NotificationType::TEMPLATE_URL_MODEL_LOADED,
Source<TemplateURLModel>(model));
model->RemoveAutoGeneratedBetween(delete_begin_, delete_end_);
diff --git a/chrome/browser/browsing_data_remover.h b/chrome/browser/browsing_data_remover.h
index 5d48606..4affab2 100644
--- a/chrome/browser/browsing_data_remover.h
+++ b/chrome/browser/browsing_data_remover.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_BROWSING_DATA_REMOVER_H__
-#define CHROME_BROWSER_BROWSING_DATA_REMOVER_H__
+#ifndef CHROME_BROWSER_BROWSING_DATA_REMOVER_H_
+#define CHROME_BROWSER_BROWSING_DATA_REMOVER_H_
#include "base/observer_list.h"
#include "base/time.h"
#include "chrome/browser/cancelable_request.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
class MessageLoop;
class Profile;
@@ -102,7 +102,7 @@ class BrowsingDataRemover : public NotificationObserver {
// Used if we need to clear history.
CancelableRequestConsumer request_consumer_;
- DISALLOW_EVIL_CONSTRUCTORS(BrowsingDataRemover);
+ DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover);
};
-#endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H__
+#endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_
diff --git a/chrome/browser/cache_manager_host.cc b/chrome/browser/cache_manager_host.cc
index c295eef..143eddd 100644
--- a/chrome/browser/cache_manager_host.cc
+++ b/chrome/browser/cache_manager_host.cc
@@ -131,10 +131,10 @@ void CacheManagerHost::ObserveStats(int renderer_id,
CacheManager::UsageStats stats_details(stats);
// &stats_details is only valid during the notification.
// See notification_types.h.
- NotificationService::current()->
- Notify(NOTIFY_WEB_CACHE_STATS_OBSERVED,
- Source<RenderProcessHost>(RenderProcessHost::FromID(renderer_id)),
- Details<CacheManager::UsageStats>(&stats_details));
+ NotificationService::current()->Notify(
+ NotificationType::WEB_CACHE_STATS_OBSERVED,
+ Source<RenderProcessHost>(RenderProcessHost::FromID(renderer_id)),
+ Details<CacheManager::UsageStats>(&stats_details));
}
void CacheManagerHost::SetGlobalSizeLimit(size_t bytes) {
diff --git a/chrome/browser/cert_store.cc b/chrome/browser/cert_store.cc
index 36c5257..b84e059 100644
--- a/chrome/browser/cert_store.cc
+++ b/chrome/browser/cert_store.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/web_contents.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/stl_util-inl.h"
template <typename T>
@@ -38,7 +39,8 @@ CertStore::CertStore() : next_cert_id_(1) {
// TODO(tc): This notification observer never gets removed because the
// CertStore is never deleted.
NotificationService::current()->AddObserver(this,
- NOTIFY_RENDERER_PROCESS_TERMINATED, NotificationService::AllSources());
+ NotificationType::RENDERER_PROCESS_TERMINATED,
+ NotificationService::AllSources());
}
CertStore::~CertStore() {
@@ -133,7 +135,7 @@ void CertStore::RemoveCertsForRenderProcesHost(int process_id) {
void CertStore::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_RENDERER_PROCESS_TERMINATED);
+ DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED);
RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr();
DCHECK(rph);
RemoveCertsForRenderProcesHost(rph->host_id());
diff --git a/chrome/browser/cert_store.h b/chrome/browser/cert_store.h
index 8c793b2..db2c4a3 100644
--- a/chrome/browser/cert_store.h
+++ b/chrome/browser/cert_store.h
@@ -10,7 +10,7 @@
#include "base/lock.h"
#include "base/singleton.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "net/base/x509_certificate.h"
// The purpose of the cert store is to provide an easy way to store/retrieve
diff --git a/chrome/browser/chrome_plugin_browsing_context.cc b/chrome/browser/chrome_plugin_browsing_context.cc
index 3eaf410..8845c36 100644
--- a/chrome/browser/chrome_plugin_browsing_context.cc
+++ b/chrome/browser/chrome_plugin_browsing_context.cc
@@ -7,6 +7,7 @@
#include "base/message_loop.h"
#include "base/singleton.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/common/notification_service.h"
CPBrowsingContextManager* CPBrowsingContextManager::Instance() {
#ifndef NDEBUG
@@ -21,7 +22,7 @@ CPBrowsingContextManager* CPBrowsingContextManager::Instance() {
CPBrowsingContextManager::CPBrowsingContextManager() {
NotificationService::current()->AddObserver(
- this, NOTIFY_URL_REQUEST_CONTEXT_RELEASED,
+ this, NotificationType::URL_REQUEST_CONTEXT_RELEASED,
NotificationService::AllSources());
}
@@ -55,7 +56,7 @@ CPBrowsingContext CPBrowsingContextManager::Lookup(URLRequestContext* context) {
void CPBrowsingContextManager::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_URL_REQUEST_CONTEXT_RELEASED);
+ DCHECK(type == NotificationType::URL_REQUEST_CONTEXT_RELEASED);
URLRequestContext* context = Source<URLRequestContext>(source).ptr();
diff --git a/chrome/browser/chrome_plugin_browsing_context.h b/chrome/browser/chrome_plugin_browsing_context.h
index ad44e31..71e938b 100644
--- a/chrome/browser/chrome_plugin_browsing_context.h
+++ b/chrome/browser/chrome_plugin_browsing_context.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H__
-#define CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H__
+#ifndef CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_
+#define CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_
#include <map>
#include "base/id_map.h"
#include "chrome/common/chrome_plugin_api.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
class URLRequestContext;
@@ -55,5 +55,4 @@ class CPBrowsingContextManager : public NotificationObserver {
ReverseMap reverse_map_; // map of URLRequestContext -> CPBrowsingContext
};
-#endif // CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H__
-
+#endif // CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_
diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc
index 08c9545..e058477 100644
--- a/chrome/browser/chrome_plugin_host.cc
+++ b/chrome/browser/chrome_plugin_host.cc
@@ -488,7 +488,7 @@ static void NotifyGearsShortcutsChanged() {
// when gears provides the correct browser context, and when we
// can relate that to an actual profile.
NotificationService::current()->Notify(
- NOTIFY_WEB_APP_INSTALL_CHANGED,
+ NotificationType::WEB_APP_INSTALL_CHANGED,
Source<Profile>(NULL),
NotificationService::NoDetails());
}
diff --git a/chrome/browser/debugger/debugger_host_impl.cpp b/chrome/browser/debugger/debugger_host_impl.cpp
index 2f46feb..23afdfd 100644
--- a/chrome/browser/debugger/debugger_host_impl.cpp
+++ b/chrome/browser/debugger/debugger_host_impl.cpp
@@ -19,7 +19,8 @@ class TabContentsReference : public NotificationObserver {
NotificationService* service = NotificationService::current();
DCHECK(service);
- service->AddObserver(this, NOTIFY_TAB_CLOSING,
+ service->AddObserver(this,
+ NotificationType::TAB_CLOSING,
Source<NavigationController>(navigation_controller_));
observing_ = true;
}
@@ -50,7 +51,7 @@ class TabContentsReference : public NotificationObserver {
DCHECK(service);
service->RemoveObserver(
this,
- NOTIFY_TAB_CLOSING,
+ NotificationType::TAB_CLOSING,
Source<NavigationController>(navigation_controller_));
observing_ = false;
}
diff --git a/chrome/browser/debugger/debugger_node.cc b/chrome/browser/debugger/debugger_node.cc
index 8a28b49..a7f419c 100644
--- a/chrome/browser/debugger/debugger_node.cc
+++ b/chrome/browser/debugger/debugger_node.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/browser/debugger/debugger_shell.h"
+#include "chrome/common/notification_service.h"
DebuggerNode::DebuggerNode() : valid_(true), observing_(false), data_(NULL) {
}
@@ -159,13 +160,15 @@ BrowserNode::BrowserNode(Browser *b) {
NotificationService* service = NotificationService::current();
DCHECK(service);
- service->AddObserver(this, NOTIFY_BROWSER_CLOSED, Source<Browser>(b));
+ service->AddObserver(
+ this, NotificationType::BROWSER_CLOSED, Source<Browser>(b));
observing_ = true;
}
void BrowserNode::StopObserving(NotificationService *service) {
Browser *b = static_cast<Browser*>(data_);
- service->RemoveObserver(this, NOTIFY_BROWSER_CLOSED, Source<Browser>(b));
+ service->RemoveObserver(
+ this, NotificationType::BROWSER_CLOSED, Source<Browser>(b));
}
BrowserNode* BrowserNode::BrowserAtIndex(int index) {
@@ -242,7 +245,8 @@ TabListNode::TabListNode(Browser* b) {
NotificationService* service = NotificationService::current();
DCHECK(service);
- service->AddObserver(this, NOTIFY_BROWSER_CLOSED, Source<Browser>(b));
+ service->AddObserver(
+ this, NotificationType::BROWSER_CLOSED, Source<Browser>(b));
observing_ = true;
}
@@ -263,7 +267,8 @@ Browser* TabListNode::GetBrowser() {
void TabListNode::StopObserving(NotificationService *service) {
Browser *b = static_cast<Browser*>(data_);
- service->RemoveObserver(this, NOTIFY_BROWSER_CLOSED, Source<Browser>(b));
+ service->RemoveObserver(
+ this, NotificationType::BROWSER_CLOSED, Source<Browser>(b));
}
v8::Handle<v8::Value> TabListNode::IndexGetter(uint32_t index,
@@ -286,7 +291,7 @@ TabNode::TabNode(TabContents *c) {
NotificationService* service = NotificationService::current();
DCHECK(service);
- service->AddObserver(this, NOTIFY_TAB_CLOSING,
+ service->AddObserver(this, NotificationType::TAB_CLOSING,
Source<NavigationController>(c->controller()));
observing_ = true;
}
@@ -296,7 +301,7 @@ TabNode::~TabNode() {
void TabNode::StopObserving(NotificationService *service) {
NavigationController *c = static_cast<NavigationController*>(data_);
- service->RemoveObserver(this, NOTIFY_TAB_CLOSING,
+ service->RemoveObserver(this, NotificationType::TAB_CLOSING,
Source<NavigationController>(c));
}
diff --git a/chrome/browser/debugger/debugger_node.h b/chrome/browser/debugger/debugger_node.h
index 06dc390..0a38cd5 100644
--- a/chrome/browser/debugger/debugger_node.h
+++ b/chrome/browser/debugger/debugger_node.h
@@ -11,17 +11,18 @@
// For example, objects aren't being cached properly (browser.foo = 1 wouldn't
// be remembered), and setters aren't implemented to begin with.
-#ifndef CHROME_BROWSER_DEBUGGER_DEBUGGER_NODE_H__
-#define CHROME_BROWSER_DEBUGGER_DEBUGGER_NODE_H__
+#ifndef CHROME_BROWSER_DEBUGGER_DEBUGGER_NODE_H_
+#define CHROME_BROWSER_DEBUGGER_DEBUGGER_NODE_H_
#include "base/basictypes.h"
#include "base/ref_counted.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "v8/include/v8.h"
class Browser;
class TabContents;
class DebuggerShell;
+class NotificationService;
class WebContents;
class DebuggerNode : public NotificationObserver {
@@ -232,6 +233,4 @@ private:
T* data_;
};
-
-#endif // CHROME_BROWSER_DEBUGGER_DEBUGGER_NODE_H__
-
+#endif // CHROME_BROWSER_DEBUGGER_DEBUGGER_NODE_H_
diff --git a/chrome/browser/debugger/debugger_window.cc b/chrome/browser/debugger/debugger_window.cc
index 36ebf69..bd61c95 100644
--- a/chrome/browser/debugger/debugger_window.cc
+++ b/chrome/browser/debugger/debugger_window.cc
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/debugger/debugger_window.h"
+
#include "base/string_util.h"
+#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/debugger/debugger_host_impl.h"
#include "chrome/browser/debugger/debugger_view.h"
-#include "chrome/browser/debugger/debugger_window.h"
#include "chrome/browser/debugger/debugger_wrapper.h"
#include "chrome/browser/tab_contents/constrained_window.h"
#include "chrome/browser/tab_contents/tab_contents.h"
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc
index da36fc7..bab1852 100644
--- a/chrome/browser/dom_ui/history_ui.cc
+++ b/chrome/browser/dom_ui/history_ui.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/profile.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/time_format.h"
@@ -101,13 +102,13 @@ BrowsingHistoryHandler::BrowsingHistoryHandler(DOMUI* dom_ui)
// Get notifications when history is cleared.
NotificationService* service = NotificationService::current();
- service->AddObserver(this, NOTIFY_HISTORY_URLS_DELETED,
+ service->AddObserver(this, NotificationType::HISTORY_URLS_DELETED,
Source<Profile>(dom_ui_->get_profile()));
}
BrowsingHistoryHandler::~BrowsingHistoryHandler() {
NotificationService* service = NotificationService::current();
- service->RemoveObserver(this, NOTIFY_HISTORY_URLS_DELETED,
+ service->RemoveObserver(this, NotificationType::HISTORY_URLS_DELETED,
Source<Profile>(dom_ui_->get_profile()));
}
@@ -263,7 +264,7 @@ history::QueryOptions BrowsingHistoryHandler::CreateQueryOptions(int month,
void BrowsingHistoryHandler::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type != NOTIFY_HISTORY_URLS_DELETED) {
+ if (type != NotificationType::HISTORY_URLS_DELETED) {
NOTREACHED();
return;
}
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index b136bc7..fec1e35 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/views/keyword_editor_view.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/resource_bundle.h"
@@ -88,7 +89,7 @@ class PaintTimer : public RenderWidgetHost::PaintObserver {
base::TimeDelta load_time = last_paint_ - start_;
int load_time_ms = static_cast<int>(load_time.InMilliseconds());
NotificationService::current()->Notify(
- NOTIFY_INITIAL_NEW_TAB_UI_LOAD,
+ NotificationType::INITIAL_NEW_TAB_UI_LOAD,
NotificationService::AllSources(),
Details<int>(&load_time_ms));
UMA_HISTOGRAM_TIMES(L"NewTabUI load", load_time);
@@ -284,13 +285,13 @@ MostVisitedHandler::MostVisitedHandler(DOMUIHost* dom_ui_host)
// Get notifications when history is cleared.
NotificationService* service = NotificationService::current();
- service->AddObserver(this, NOTIFY_HISTORY_URLS_DELETED,
+ service->AddObserver(this, NotificationType::HISTORY_URLS_DELETED,
Source<Profile>(dom_ui_host_->profile()));
}
MostVisitedHandler::~MostVisitedHandler() {
NotificationService* service = NotificationService::current();
- service->RemoveObserver(this, NOTIFY_HISTORY_URLS_DELETED,
+ service->RemoveObserver(this, NotificationType::HISTORY_URLS_DELETED,
Source<Profile>(dom_ui_host_->profile()));
}
@@ -323,7 +324,7 @@ void MostVisitedHandler::OnSegmentUsageAvailable(
void MostVisitedHandler::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type != NOTIFY_HISTORY_URLS_DELETED) {
+ if (type != NotificationType::HISTORY_URLS_DELETED) {
NOTREACHED();
return;
}
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 44038b4..7547eec 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -1036,15 +1036,17 @@ void DownloadManager::DownloadUrl(const GURL& url,
}
void DownloadManager::NotifyAboutDownloadStart() {
- NotificationService::current()->
- Notify(NOTIFY_DOWNLOAD_START, NotificationService::AllSources(),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::DOWNLOAD_START,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
}
void DownloadManager::NotifyAboutDownloadStop() {
- NotificationService::current()->
- Notify(NOTIFY_DOWNLOAD_STOP, NotificationService::AllSources(),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::DOWNLOAD_STOP,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
}
void DownloadManager::GenerateExtension(
diff --git a/chrome/browser/download/download_request_manager.cc b/chrome/browser/download/download_request_manager.cc
index 9410cd3..af6a22c 100644
--- a/chrome/browser/download/download_request_manager.cc
+++ b/chrome/browser/download/download_request_manager.cc
@@ -161,8 +161,9 @@ DownloadRequestManager::TabDownloadState::TabDownloadState(
status_(DownloadRequestManager::ALLOW_ONE_DOWNLOAD),
dialog_delegate_(NULL) {
Source<NavigationController> notification_source(controller);
- registrar_.Add(this, NOTIFY_NAV_ENTRY_PENDING, notification_source);
- registrar_.Add(this, NOTIFY_TAB_CLOSED, notification_source);
+ registrar_.Add(this, NotificationType::NAV_ENTRY_PENDING,
+ notification_source);
+ registrar_.Add(this, NotificationType::TAB_CLOSED, notification_source);
NavigationEntry* active_entry = originating_controller ?
originating_controller->GetActiveEntry() : controller->GetActiveEntry();
@@ -219,14 +220,15 @@ void DownloadRequestManager::TabDownloadState::Observe(
NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if ((type != NOTIFY_NAV_ENTRY_PENDING && type != NOTIFY_TAB_CLOSED) ||
- Source<NavigationController>(source).ptr() != controller_) {
+ if ((type != NotificationType::NAV_ENTRY_PENDING &&
+ type != NotificationType::TAB_CLOSED) ||
+ Source<NavigationController>(source).ptr() != controller_) {
NOTREACHED();
return;
}
- switch(type) {
- case NOTIFY_NAV_ENTRY_PENDING: {
+ switch(type.value) {
+ case NotificationType::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
@@ -261,7 +263,7 @@ void DownloadRequestManager::TabDownloadState::Observe(
break;
}
- case NOTIFY_TAB_CLOSED:
+ case NotificationType::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/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 7440d6b..3038cab 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -93,7 +93,8 @@ void ExtensionsService::OnExtensionsLoadedFromDirectory(
user_script_master_->AddWatchedPath(install_directory_);
user_script_master_->StartScan();
- NotificationService::current()->Notify(NOTIFY_EXTENSIONS_LOADED,
+ NotificationService::current()->Notify(
+ NotificationType::EXTENSIONS_LOADED,
NotificationService::AllSources(),
Details<ExtensionList>(new_extensions));
@@ -124,7 +125,8 @@ void ExtensionsService::OnExtensionInstallError(const std::string& error) {
}
void ExtensionsService::OnExtensionInstalled(FilePath path) {
- NotificationService::current()->Notify(NOTIFY_EXTENSION_INSTALLED,
+ NotificationService::current()->Notify(
+ NotificationType::EXTENSION_INSTALLED,
NotificationService::AllSources(),
Details<FilePath>(&path));
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 66a8d70..3dafcbc 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -230,7 +230,8 @@ void UserScriptMaster::NewScriptsAvailable(base::SharedMemory* handle) {
// We've got scripts ready to go.
shared_memory_.swap(handle_deleter);
- NotificationService::current()->Notify(NOTIFY_USER_SCRIPTS_LOADED,
+ NotificationService::current()->Notify(
+ NotificationType::USER_SCRIPTS_LOADED,
NotificationService::AllSources(),
Details<base::SharedMemory>(handle));
}
diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc
index f0f2dc2..af60cb8 100644
--- a/chrome/browser/extensions/user_script_master_unittest.cc
+++ b/chrome/browser/extensions/user_script_master_unittest.cc
@@ -32,14 +32,16 @@ class UserScriptMasterTest : public testing::Test,
file_util::CreateDirectory(script_dir_);
// Register for all user script notifications.
- NotificationService::current()->AddObserver(this,
- NOTIFY_USER_SCRIPTS_LOADED,
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::USER_SCRIPTS_LOADED,
NotificationService::AllSources());
}
virtual void TearDown() {
- NotificationService::current()->RemoveObserver(this,
- NOTIFY_USER_SCRIPTS_LOADED,
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::USER_SCRIPTS_LOADED,
NotificationService::AllSources());
// Clean up test directory.
@@ -50,7 +52,7 @@ class UserScriptMasterTest : public testing::Test,
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_USER_SCRIPTS_LOADED);
+ DCHECK(type == NotificationType::USER_SCRIPTS_LOADED);
shared_memory_ = Details<base::SharedMemory>(details).ptr();
if (MessageLoop::current() == &message_loop_)
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc
index 565221d..9527e97 100644
--- a/chrome/browser/external_tab_container.cc
+++ b/chrome/browser/external_tab_container.cc
@@ -83,12 +83,12 @@ bool ExternalTabContainer::Init(Profile* profile, HWND parent,
NavigationController* controller = tab_contents_->controller();
DCHECK(controller);
- registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(controller));
- NotificationService::current()->
- Notify(NOTIFY_EXTERNAL_TAB_CREATED,
- Source<NavigationController>(controller),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::EXTERNAL_TAB_CREATED,
+ Source<NavigationController>(controller),
+ NotificationService::NoDetails());
// Now apply the parenting and style
if (parent)
@@ -110,10 +110,10 @@ void ExternalTabContainer::OnDestroy() {
NavigationController* controller = tab_contents_->controller();
DCHECK(controller);
- NotificationService::current()->
- Notify(NOTIFY_EXTERNAL_TAB_CLOSED,
- Source<NavigationController>(controller),
- Details<ExternalTabContainer>(this));
+ NotificationService::current()->Notify(
+ NotificationType::EXTERNAL_TAB_CLOSED,
+ Source<NavigationController>(controller),
+ Details<ExternalTabContainer>(this));
tab_contents_->set_delegate(NULL);
tab_contents_->CloseContents();
// WARNING: tab_contents_ has likely been deleted.
@@ -223,8 +223,8 @@ void ExternalTabContainer::ForwardMessageToExternalHost(
void ExternalTabContainer::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_NAV_ENTRY_COMMITTED:
+ switch (type.value) {
+ case NotificationType::NAV_ENTRY_COMMITTED:
if (automation_) {
const NavigationController::LoadCommittedDetails* commit =
Details<NavigationController::LoadCommittedDetails>(details).ptr();
diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h
index 9e631e4..b09f032 100644
--- a/chrome/browser/external_tab_container.h
+++ b/chrome/browser/external_tab_container.h
@@ -13,8 +13,8 @@
#include "base/basictypes.h"
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
-#include "chrome/common/notification_service.h"
#include "chrome/views/focus_manager.h"
#include "chrome/views/root_view.h"
#include "chrome/views/widget.h"
diff --git a/chrome/browser/google_url_tracker.cc b/chrome/browser/google_url_tracker.cc
index 6dfdbd6..cdc2a4cd 100644
--- a/chrome/browser/google_url_tracker.cc
+++ b/chrome/browser/google_url_tracker.cc
@@ -8,6 +8,7 @@
#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "net/base/load_flags.h"
@@ -24,7 +25,7 @@ GoogleURLTracker::GoogleURLTracker()
need_to_fetch_(false),
request_context_available_(!!Profile::GetDefaultRequestContext()) {
NotificationService::current()->AddObserver(this,
- NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE,
+ NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE,
NotificationService::AllSources());
// Because this function can be called during startup, when kicking off a URL
@@ -41,7 +42,7 @@ GoogleURLTracker::GoogleURLTracker()
GoogleURLTracker::~GoogleURLTracker() {
NotificationService::current()->RemoveObserver(this,
- NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE,
+ NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE,
NotificationService::AllSources());
}
@@ -155,7 +156,7 @@ void GoogleURLTracker::OnURLFetchComplete(const URLFetcher* source,
g_browser_process->local_state()->SetString(prefs::kLastKnownGoogleURL,
base_url_str);
google_url_ = base_url;
- NotificationService::current()->Notify(NOTIFY_GOOGLE_URL_UPDATED,
+ NotificationService::current()->Notify(NotificationType::GOOGLE_URL_UPDATED,
NotificationService::AllSources(),
NotificationService::NoDetails());
}
@@ -164,7 +165,7 @@ void GoogleURLTracker::OnURLFetchComplete(const URLFetcher* source,
void GoogleURLTracker::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK_EQ(NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE, type);
+ DCHECK_EQ(NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE, type.value);
request_context_available_ = true;
StartFetchIfDesirable();
}
diff --git a/chrome/browser/google_url_tracker.h b/chrome/browser/google_url_tracker.h
index b3f1795..18cd0c3 100644
--- a/chrome/browser/google_url_tracker.h
+++ b/chrome/browser/google_url_tracker.h
@@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#ifndef CHROME_BROWSER_GOOGLE_URL_TRACKER_H_
+#define CHROME_BROWSER_GOOGLE_URL_TRACKER_H_
+
#include "chrome/browser/net/url_fetcher.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
class PrefService;
@@ -98,6 +101,7 @@ class GoogleURLTracker : public URLFetcher::Delegate,
// default request context created, so we can
// actually do the fetch with the right data.
- DISALLOW_EVIL_CONSTRUCTORS(GoogleURLTracker);
+ DISALLOW_COPY_AND_ASSIGN(GoogleURLTracker);
};
+#endif // CHROME_BROWSER_GOOGLE_URL_TRACKER_H_ \ No newline at end of file
diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc
index 955b837..9fee1b2 100644
--- a/chrome/browser/history/expire_history_backend.cc
+++ b/chrome/browser/history/expire_history_backend.cc
@@ -15,7 +15,7 @@
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/text_database_manager.h"
#include "chrome/browser/history/thumbnail_database.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_type.h"
using base::Time;
using base::TimeDelta;
@@ -202,7 +202,7 @@ void ExpireHistoryBackend::BroadcastDeleteNotifications(
if (dependencies->deleted_urls[i].typed_count() > 0)
typed_urls_changed.push_back(dependencies->deleted_urls[i]);
}
- delegate_->BroadcastNotifications(NOTIFY_HISTORY_URLS_DELETED,
+ delegate_->BroadcastNotifications(NotificationType::HISTORY_URLS_DELETED,
deleted_details);
// Broadcast the typed URL changed modification (this updates the inline
@@ -215,8 +215,9 @@ void ExpireHistoryBackend::BroadcastDeleteNotifications(
if (!typed_urls_changed.empty()) {
URLsModifiedDetails* modified_details = new URLsModifiedDetails;
modified_details->changed_urls.swap(typed_urls_changed);
- delegate_->BroadcastNotifications(NOTIFY_HISTORY_TYPED_URLS_MODIFIED,
- modified_details);
+ delegate_->BroadcastNotifications(
+ NotificationType::HISTORY_TYPED_URLS_MODIFIED,
+ modified_details);
}
}
}
diff --git a/chrome/browser/history/expire_history_backend.h b/chrome/browser/history/expire_history_backend.h
index 5d26ddc..0e5ab44 100644
--- a/chrome/browser/history/expire_history_backend.h
+++ b/chrome/browser/history/expire_history_backend.h
@@ -13,11 +13,11 @@
#include "base/time.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/history/text_database_manager.h"
-#include "chrome/common/notification_types.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
class BookmarkService;
class GURL;
+class NotificationType;
namespace history {
diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc
index 305a094..8d392a4 100644
--- a/chrome/browser/history/expire_history_backend_unittest.cc
+++ b/chrome/browser/history/expire_history_backend_unittest.cc
@@ -303,14 +303,15 @@ void ExpireHistoryTest::EnsureURLInfoGone(const URLRow& row) {
bool found_delete_notification = false;
bool found_typed_changed_notification = false;
for (size_t i = 0; i < notifications_.size(); i++) {
- if (notifications_[i].first == NOTIFY_HISTORY_URLS_DELETED) {
+ if (notifications_[i].first == NotificationType::HISTORY_URLS_DELETED) {
const URLsDeletedDetails* deleted_details =
reinterpret_cast<URLsDeletedDetails*>(notifications_[i].second);
if (deleted_details->urls.find(row.url()) !=
deleted_details->urls.end()) {
found_delete_notification = true;
}
- } else if (notifications_[i].first == NOTIFY_HISTORY_TYPED_URLS_MODIFIED) {
+ } else if (notifications_[i].first ==
+ NotificationType::HISTORY_TYPED_URLS_MODIFIED) {
// See if we got a typed URL changed notification.
const URLsModifiedDetails* modified_details =
reinterpret_cast<URLsModifiedDetails*>(notifications_[i].second);
@@ -319,7 +320,8 @@ void ExpireHistoryTest::EnsureURLInfoGone(const URLRow& row) {
if (modified_details->changed_urls[cur_url].url() == row.url())
found_typed_changed_notification = true;
}
- } else if (notifications_[i].first == NOTIFY_HISTORY_URL_VISITED) {
+ } else if (notifications_[i].first ==
+ NotificationType::HISTORY_URL_VISITED) {
// See if we got a visited URL notification.
const URLVisitedDetails* visited_details =
reinterpret_cast<URLVisitedDetails*>(notifications_[i].second);
diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc
index 6e55160..1274d09 100644
--- a/chrome/browser/history/history.cc
+++ b/chrome/browser/history/history.cc
@@ -100,7 +100,8 @@ HistoryService::HistoryService()
backend_loaded_(false) {
if (NotificationService::current()) { // Is NULL when running generate_profile.
NotificationService::current()->AddObserver(
- this, NOTIFY_HISTORY_URLS_DELETED, Source<Profile>(profile_));
+ this, NotificationType::HISTORY_URLS_DELETED,
+ Source<Profile>(profile_));
}
}
@@ -109,7 +110,7 @@ HistoryService::HistoryService(Profile* profile)
profile_(profile),
backend_loaded_(false) {
NotificationService::current()->AddObserver(
- this, NOTIFY_HISTORY_URLS_DELETED, Source<Profile>(profile_));
+ this, NotificationType::HISTORY_URLS_DELETED, Source<Profile>(profile_));
}
HistoryService::~HistoryService() {
@@ -119,7 +120,8 @@ HistoryService::~HistoryService() {
// Unregister for notifications.
if (NotificationService::current()) { // Is NULL when running generate_profile.
NotificationService::current()->RemoveObserver(
- this, NOTIFY_HISTORY_URLS_DELETED, Source<Profile>(profile_));
+ this, NotificationType::HISTORY_URLS_DELETED,
+ Source<Profile>(profile_));
}
}
@@ -527,7 +529,7 @@ HistoryService::Handle HistoryService::GetVisitCountToHost(
void HistoryService::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type != NOTIFY_HISTORY_URLS_DELETED) {
+ if (type != NotificationType::HISTORY_URLS_DELETED) {
NOTREACHED();
return;
}
@@ -653,7 +655,7 @@ void HistoryService::BroadcastNotifications(
void HistoryService::OnDBLoaded() {
LOG(INFO) << "History backend finished loading";
backend_loaded_ = true;
- NotificationService::current()->Notify(NOTIFY_HISTORY_LOADED,
+ NotificationService::current()->Notify(NotificationType::HISTORY_LOADED,
Source<Profile>(profile_),
Details<HistoryService>(this));
}
diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h
index b0351c9..ddf9b16 100644
--- a/chrome/browser/history/history.h
+++ b/chrome/browser/history/history.h
@@ -21,7 +21,7 @@
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/search_engines/template_url.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/ref_counted_util.h"
@@ -33,7 +33,6 @@ class HistoryURLProvider;
struct HistoryURLProviderParams;
class InMemoryURLDatabase;
class MainPagesRequest;
-enum NotificationType;
class PageUsageData;
class PageUsageRequest;
class Profile;
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 670555b..c899700 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -20,7 +20,7 @@
#include "chrome/browser/history/in_memory_history_backend.h"
#include "chrome/browser/history/page_usage_data.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_type.h"
#include "chrome/common/sqlite_utils.h"
#include "googleurl/src/gurl.h"
#include "net/base/registry_controlled_domain.h"
@@ -635,7 +635,7 @@ std::pair<URLID, VisitID> HistoryBackend::AddPageVisit(
if (visit_id) {
URLVisitedDetails* details = new URLVisitedDetails;
details->row = url_info;
- BroadcastNotifications(NOTIFY_HISTORY_URL_VISITED, details);
+ BroadcastNotifications(NotificationType::HISTORY_URL_VISITED, details);
}
return std::make_pair(url_id, visit_id);
@@ -715,7 +715,8 @@ 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(NOTIFY_HISTORY_TYPED_URLS_MODIFIED, modified);
+ BroadcastNotifications(NotificationType::HISTORY_TYPED_URLS_MODIFIED,
+ modified);
ScheduleCommit();
}
@@ -770,7 +771,8 @@ void HistoryBackend::SetPageTitle(const GURL& url,
if (changed_urls[i].typed_count() > 0)
modified->changed_urls.push_back(changed_urls[i]);
}
- BroadcastNotifications(NOTIFY_HISTORY_TYPED_URLS_MODIFIED, modified);
+ BroadcastNotifications(NotificationType::HISTORY_TYPED_URLS_MODIFIED,
+ modified);
}
// Update the full text index.
@@ -1329,7 +1331,7 @@ void HistoryBackend::SetImportedFavicons(
// Send the notification about the changed favicon URLs.
FavIconChangeDetails* changed_details = new FavIconChangeDetails;
changed_details->urls.swap(favicons_changed);
- BroadcastNotifications(NOTIFY_FAVICON_CHANGED, changed_details);
+ BroadcastNotifications(NotificationType::FAVICON_CHANGED, changed_details);
}
}
@@ -1473,7 +1475,7 @@ 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(NOTIFY_FAVICON_CHANGED, changed_details);
+ BroadcastNotifications(NotificationType::FAVICON_CHANGED, changed_details);
ScheduleCommit();
}
@@ -1730,7 +1732,7 @@ void HistoryBackend::DeleteAllHistory() {
// will pick this up and clear itself.
URLsDeletedDetails* details = new URLsDeletedDetails;
details->all_history = true;
- BroadcastNotifications(NOTIFY_HISTORY_URLS_DELETED, details);
+ BroadcastNotifications(NotificationType::HISTORY_URLS_DELETED, details);
}
bool HistoryBackend::ClearAllThumbnailHistory(
diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc
index c8aa28c..b14da22 100644
--- a/chrome/browser/history/history_backend_unittest.cc
+++ b/chrome/browser/history/history_backend_unittest.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/history/history_backend.h"
#include "chrome/browser/history/in_memory_history_backend.h"
#include "chrome/browser/history/in_memory_database.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/thumbnail_score.h"
#include "chrome/tools/profiles/thumbnail-inl.h"
#include "googleurl/src/gurl.h"
diff --git a/chrome/browser/history/in_memory_history_backend.cc b/chrome/browser/history/in_memory_history_backend.cc
index 5e942d6..efcc317 100644
--- a/chrome/browser/history/in_memory_history_backend.cc
+++ b/chrome/browser/history/in_memory_history_backend.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/in_memory_database.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/notification_service.h"
namespace history {
@@ -25,9 +26,12 @@ InMemoryHistoryBackend::~InMemoryHistoryBackend() {
NotificationService* service = NotificationService::current();
Source<Profile> source(profile_);
- service->RemoveObserver(this, NOTIFY_HISTORY_URL_VISITED, source);
- service->RemoveObserver(this, NOTIFY_HISTORY_TYPED_URLS_MODIFIED, source);
- service->RemoveObserver(this, NOTIFY_HISTORY_URLS_DELETED, source);
+ service->RemoveObserver(this, NotificationType::HISTORY_URL_VISITED,
+ source);
+ service->RemoveObserver(this, NotificationType::HISTORY_TYPED_URLS_MODIFIED,
+ source);
+ service->RemoveObserver(this, NotificationType::HISTORY_URLS_DELETED,
+ source);
}
}
@@ -57,16 +61,16 @@ void InMemoryHistoryBackend::AttachToHistoryService(Profile* profile) {
// to remove these manually.
registered_for_notifications_ = true;
NotificationService* service = NotificationService::current();
- service->AddObserver(this, NOTIFY_HISTORY_URL_VISITED, source);
- service->AddObserver(this, NOTIFY_HISTORY_TYPED_URLS_MODIFIED, source);
- service->AddObserver(this, NOTIFY_HISTORY_URLS_DELETED, source);
+ service->AddObserver(this, NotificationType::HISTORY_URL_VISITED, source);
+ service->AddObserver(this, NotificationType::HISTORY_TYPED_URLS_MODIFIED, source);
+ service->AddObserver(this, NotificationType::HISTORY_URLS_DELETED, source);
}
void InMemoryHistoryBackend::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_HISTORY_URL_VISITED: {
+ switch (type.value) {
+ case NotificationType::HISTORY_URL_VISITED: {
Details<history::URLVisitedDetails> visited_details(details);
if (visited_details->row.typed_count() > 0) {
URLsModifiedDetails modified_details;
@@ -75,11 +79,11 @@ void InMemoryHistoryBackend::Observe(NotificationType type,
}
break;
}
- case NOTIFY_HISTORY_TYPED_URLS_MODIFIED:
+ case NotificationType::HISTORY_TYPED_URLS_MODIFIED:
OnTypedURLsModified(
*Details<history::URLsModifiedDetails>(details).ptr());
break;
- case NOTIFY_HISTORY_URLS_DELETED:
+ case NotificationType::HISTORY_URLS_DELETED:
OnURLsDeleted(*Details<history::URLsDeletedDetails>(details).ptr());
break;
default:
diff --git a/chrome/browser/history/in_memory_history_backend.h b/chrome/browser/history/in_memory_history_backend.h
index 57658b8..ed9dabd 100644
--- a/chrome/browser/history/in_memory_history_backend.h
+++ b/chrome/browser/history/in_memory_history_backend.h
@@ -10,14 +10,14 @@
// operations can be completed synchronously. It listenes for notifications
// from the "regular" history backend and keeps itself in sync.
-#ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H__
-#define CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H__
+#ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_
+#define CHROME_BROWSER_HISTORY_IN_MEMORY_HISTORY_BACKEND_H_
#include <string>
#include "base/basictypes.h"
#include "chrome/browser/history/history_notifications.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
class HistoryDatabase;
class Profile;
@@ -71,10 +71,9 @@ class InMemoryHistoryBackend : public NotificationObserver {
// may be destroyed before attaching to the main thread.
bool registered_for_notifications_;
- DISALLOW_EVIL_CONSTRUCTORS(InMemoryHistoryBackend);
+ DISALLOW_COPY_AND_ASSIGN(InMemoryHistoryBackend);
};
} // namespace history
-#endif // CHROME_BROWSER_IN_MEMORY_HISTORY_BACKEND_H__
-
+#endif // CHROME_BROWSER_IN_MEMORY_HISTORY_BACKEND_H_
diff --git a/chrome/browser/history/starred_url_database.cc b/chrome/browser/history/starred_url_database.cc
index 2a877c4..ecaa72c 100644
--- a/chrome/browser/history/starred_url_database.cc
+++ b/chrome/browser/history/starred_url_database.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/json_writer.h"
#include "base/string_util.h"
+#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_codec.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/history/history.h"
diff --git a/chrome/browser/history_model.cc b/chrome/browser/history_model.cc
index 49102a7..c9df37c 100644
--- a/chrome/browser/history_model.cc
+++ b/chrome/browser/history_model.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/profile.h"
+#include "chrome/common/notification_service.h"
using base::Time;
@@ -20,22 +21,26 @@ HistoryModel::HistoryModel(Profile* profile, const std::wstring& search_text)
search_text_(search_text),
search_depth_(0) {
// Register for notifications about URL starredness changing on this profile.
- NotificationService::current()->
- AddObserver(this, NOTIFY_URLS_STARRED,
- Source<Profile>(profile->GetOriginalProfile()));
- NotificationService::current()->
- AddObserver(this, NOTIFY_HISTORY_URLS_DELETED,
- Source<Profile>(profile->GetOriginalProfile()));
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::URLS_STARRED,
+ Source<Profile>(profile->GetOriginalProfile()));
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::HISTORY_URLS_DELETED,
+ Source<Profile>(profile->GetOriginalProfile()));
}
HistoryModel::~HistoryModel() {
// Unregister for notifications about URL starredness.
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_URLS_STARRED,
- Source<Profile>(profile_->GetOriginalProfile()));
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_HISTORY_URLS_DELETED,
- Source<Profile>(profile_->GetOriginalProfile()));
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::URLS_STARRED,
+ Source<Profile>(profile_->GetOriginalProfile()));
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::HISTORY_URLS_DELETED,
+ Source<Profile>(profile_->GetOriginalProfile()));
}
int HistoryModel::GetItemCount() {
@@ -202,40 +207,40 @@ void HistoryModel::Refresh() {
void HistoryModel::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_URLS_STARRED: { // Somewhere, a URL has been starred.
- Details<history::URLsStarredDetails> starred_state(details);
-
- // In the degenerate case when there are a lot of pages starred, this may
- // be unacceptably slow.
- std::set<GURL>::const_iterator i;
- bool changed = false;
- for (i = starred_state->changed_urls.begin();
- i != starred_state->changed_urls.end(); ++i) {
- changed |= UpdateStarredStateOfURL(*i, starred_state->starred);
+ switch (type.value) {
+ case NotificationType::URLS_STARRED: { // Somewhere a URL has been starred.
+ Details<history::URLsStarredDetails> starred_state(details);
+
+ // In the degenerate case when there are a lot of pages starred, this may
+ // be unacceptably slow.
+ std::set<GURL>::const_iterator i;
+ bool changed = false;
+ for (i = starred_state->changed_urls.begin();
+ i != starred_state->changed_urls.end(); ++i) {
+ changed |= UpdateStarredStateOfURL(*i, starred_state->starred);
+ }
+ if (changed && observer_)
+ observer_->ModelChanged(false);
+ break;
}
- if (changed && observer_)
- observer_->ModelChanged(false);
- break;
- }
- case NOTIFY_HISTORY_URLS_DELETED:
- // TODO(brettw) bug 1140015: This should actually update the current query
- // rather than re-querying. This should be much more efficient and
- // user-friendly.
- //
- // Note that we can special case when the "all_history" flag is set to just
- // clear the view.
- Refresh();
- break;
-
- // TODO(brettw) bug 1140015, 1140017, 1140020: Add a more observers to catch
- // title changes, new additions, etc.. Also, URLS_ADDED when that
- // notification exists.
-
- default:
- NOTREACHED();
- break;
+ case NotificationType::HISTORY_URLS_DELETED:
+ // TODO(brettw) bug 1140015: This should actually update the current query
+ // rather than re-querying. This should be much more efficient and
+ // user-friendly.
+ //
+ // Note that we can special case when the "all_history" flag is set to just
+ // clear the view.
+ Refresh();
+ break;
+
+ // TODO(brettw) bug 1140015, 1140017, 1140020: Add a more observers to catch
+ // title changes, new additions, etc.. Also, URLS_ADDED when that
+ // notification exists.
+
+ default:
+ NOTREACHED();
+ break;
}
}
diff --git a/chrome/browser/history_model.h b/chrome/browser/history_model.h
index 654c910..c9567ab 100644
--- a/chrome/browser/history_model.h
+++ b/chrome/browser/history_model.h
@@ -6,11 +6,11 @@
// view; that is, a list of visited pages. This object knows how to
// talk to the HistoryService to update its state.
-#ifndef CHROME_BROWSER_HISTORY_MODEL_H__
-#define CHROME_BROWSER_HISTORY_MODEL_H__
+#ifndef CHROME_BROWSER_HISTORY_MODEL_H_
+#define CHROME_BROWSER_HISTORY_MODEL_H_
#include "chrome/browser/base_history_model.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
typedef BaseHistoryModelObserver HistoryModelObserver;
@@ -85,8 +85,7 @@ class HistoryModel : public BaseHistoryModel,
// The time that the current query was started.
base::Time search_start_;
- DISALLOW_EVIL_CONSTRUCTORS(HistoryModel);
+ DISALLOW_COPY_AND_ASSIGN(HistoryModel);
};
-#endif // CHROME_BROWSER_HISTORY_MODEL_H__
-
+#endif // CHROME_BROWSER_HISTORY_MODEL_H_
diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc
index 6e68c98..33be3f2 100755
--- a/chrome/browser/importer/importer.cc
+++ b/chrome/browser/importer/importer.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/gfx/favicon_size.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/win_util.h"
@@ -54,7 +55,7 @@ void ProfileWriter::AddTemplateURLModelObserver(
NotificationObserver* observer) {
TemplateURLModel* model = profile_->GetTemplateURLModel();
NotificationService::current()->AddObserver(
- observer, TEMPLATE_URL_MODEL_LOADED,
+ observer, NotificationType::TEMPLATE_URL_MODEL_LOADED,
Source<TemplateURLModel>(model));
model->Load();
}
@@ -290,7 +291,7 @@ void ProfileWriter::ShowBookmarkBar() {
prefs->ScheduleSavePersistentPrefs(g_browser_process->file_thread());
Source<Profile> source(profile_);
NotificationService::current()->Notify(
- NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, source,
+ NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, source,
NotificationService::NoDetails());
}
}
@@ -421,7 +422,8 @@ ImporterHost::ImporterHost(MessageLoop* file_loop)
ImporterHost::~ImporterHost() {
STLDeleteContainerPointers(source_profiles_.begin(), source_profiles_.end());
- if (NULL != importer_) importer_->Release();
+ if (NULL != importer_)
+ importer_->Release();
}
void ImporterHost::Loaded(BookmarkModel* model) {
@@ -433,21 +435,22 @@ void ImporterHost::Loaded(BookmarkModel* model) {
void ImporterHost::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == TEMPLATE_URL_MODEL_LOADED);
+ DCHECK(type == NotificationType::TEMPLATE_URL_MODEL_LOADED);
TemplateURLModel* model = Source<TemplateURLModel>(source).ptr();
NotificationService::current()->RemoveObserver(
- this, TEMPLATE_URL_MODEL_LOADED,
+ this, NotificationType::TEMPLATE_URL_MODEL_LOADED,
Source<TemplateURLModel>(model));
waiting_for_template_url_model_ = false;
InvokeTaskIfDone();
}
void ImporterHost::ShowWarningDialog() {
- if (headless_)
+ if (headless_) {
OnLockViewEnd(false);
- else
+ } else {
views::Window::CreateChromeWindow(GetActiveWindow(), gfx::Rect(),
new ImporterLockView(this))->Show();
+ }
}
void ImporterHost::OnLockViewEnd(bool is_continue) {
diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h
index a94047d..ee5ac37 100644
--- a/chrome/browser/importer/importer.h
+++ b/chrome/browser/importer/importer.h
@@ -20,7 +20,7 @@
#endif
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/password_form.h"
diff --git a/chrome/browser/jsmessage_box_handler_win.cc b/chrome/browser/jsmessage_box_handler_win.cc
index 39d19cd..bf586e5 100644
--- a/chrome/browser/jsmessage_box_handler_win.cc
+++ b/chrome/browser/jsmessage_box_handler_win.cc
@@ -10,7 +10,7 @@
#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/views/message_box_view.h"
@@ -54,9 +54,9 @@ JavascriptMessageBoxHandler::JavascriptMessageBoxHandler(
// Make sure we get navigation notifications so we know when our parent
// contents will disappear or navigate to a different page.
- registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
NotificationService::AllSources());
- registrar_.Add(this, NOTIFY_TAB_CONTENTS_DESTROYED,
+ registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED,
NotificationService::AllSources());
}
@@ -189,11 +189,11 @@ void JavascriptMessageBoxHandler::Observe(NotificationType type,
if (!web_contents_)
return;
- if (type == NOTIFY_NAV_ENTRY_COMMITTED &&
+ if (type == NotificationType::NAV_ENTRY_COMMITTED &&
Source<NavigationController>(source).ptr() == web_contents_->controller())
web_contents_gone = true;
- if (type == NOTIFY_TAB_CONTENTS_DESTROYED &&
+ if (type == NotificationType::TAB_CONTENTS_DESTROYED &&
Source<TabContents>(source).ptr() ==
static_cast<TabContents*>(web_contents_))
web_contents_gone = true;
diff --git a/chrome/browser/jsmessage_box_handler_win.h b/chrome/browser/jsmessage_box_handler_win.h
index 432f59b..80beaa1 100644
--- a/chrome/browser/jsmessage_box_handler_win.h
+++ b/chrome/browser/jsmessage_box_handler_win.h
@@ -7,7 +7,7 @@
#include "chrome/browser/jsmessage_box_handler.h"
#include "chrome/common/ipc_message.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/views/app_modal_dialog_delegate.h"
diff --git a/chrome/browser/login_prompt.cc b/chrome/browser/login_prompt.cc
index 097763c..1ad5a17 100644
--- a/chrome/browser/login_prompt.cc
+++ b/chrome/browser/login_prompt.cc
@@ -270,11 +270,11 @@ class LoginHandlerImpl : public LoginHandler,
if (!WasAuthHandled(false)) {
LoginNotificationDetails details(this);
- service->Notify(NOTIFY_AUTH_NEEDED,
+ service->Notify(NotificationType::AUTH_NEEDED,
Source<NavigationController>(controller),
Details<LoginNotificationDetails>(&details));
} else {
- service->Notify(NOTIFY_AUTH_SUPPLIED,
+ service->Notify(NotificationType::AUTH_SUPPLIED,
Source<NavigationController>(controller),
NotificationService::NoDetails());
}
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index f2b3323..f3822e8 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -178,6 +178,7 @@
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/libxml_utils.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/installer/util/google_update_settings.h"
@@ -426,58 +427,58 @@ void MetricsService::Observe(NotificationType type,
if (!CanLogNotification(type, source, details))
return;
- switch (type) {
- case NOTIFY_USER_ACTION:
+ switch (type.value) {
+ case NotificationType::USER_ACTION:
current_log_->RecordUserAction(*Details<const wchar_t*>(details).ptr());
break;
- case NOTIFY_BROWSER_OPENED:
- case NOTIFY_BROWSER_CLOSED:
+ case NotificationType::BROWSER_OPENED:
+ case NotificationType::BROWSER_CLOSED:
LogWindowChange(type, source, details);
break;
- case NOTIFY_TAB_PARENTED:
- case NOTIFY_TAB_CLOSING:
+ case NotificationType::TAB_PARENTED:
+ case NotificationType::TAB_CLOSING:
LogWindowChange(type, source, details);
break;
- case NOTIFY_LOAD_STOP:
+ case NotificationType::LOAD_STOP:
LogLoadComplete(type, source, details);
break;
- case NOTIFY_LOAD_START:
+ case NotificationType::LOAD_START:
LogLoadStarted();
break;
- case NOTIFY_RENDERER_PROCESS_TERMINATED:
+ case NotificationType::RENDERER_PROCESS_TERMINATED:
if (!*Details<bool>(details).ptr())
LogRendererCrash();
break;
- case NOTIFY_RENDERER_PROCESS_HANG:
+ case NotificationType::RENDERER_PROCESS_HANG:
LogRendererHang();
break;
- case NOTIFY_RENDERER_PROCESS_IN_SBOX:
+ case NotificationType::RENDERER_PROCESS_IN_SBOX:
LogRendererInSandbox(*Details<bool>(details).ptr());
break;
- case NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED:
- case NOTIFY_PLUGIN_PROCESS_CRASHED:
- case NOTIFY_PLUGIN_INSTANCE_CREATED:
+ case NotificationType::PLUGIN_PROCESS_HOST_CONNECTED:
+ case NotificationType::PLUGIN_PROCESS_CRASHED:
+ case NotificationType::PLUGIN_INSTANCE_CREATED:
LogPluginChange(type, source, details);
break;
- case TEMPLATE_URL_MODEL_LOADED:
+ case NotificationType::TEMPLATE_URL_MODEL_LOADED:
LogKeywords(Source<TemplateURLModel>(source).ptr());
break;
- case NOTIFY_OMNIBOX_OPENED_URL:
+ case NotificationType::OMNIBOX_OPENED_URL:
current_log_->RecordOmniboxOpenedURL(
*Details<AutocompleteLog>(details).ptr());
break;
- case NOTIFY_BOOKMARK_MODEL_LOADED:
+ case NotificationType::BOOKMARK_MODEL_LOADED:
LogBookmarks(Source<Profile>(source)->GetBookmarkModel());
break;
@@ -706,24 +707,31 @@ void MetricsService::StopRecording(MetricsLog** log) {
}
void MetricsService::ListenerRegistration(bool start_listening) {
- AddOrRemoveObserver(this, NOTIFY_BROWSER_OPENED, start_listening);
- AddOrRemoveObserver(this, NOTIFY_BROWSER_CLOSED, start_listening);
- AddOrRemoveObserver(this, NOTIFY_USER_ACTION, start_listening);
- AddOrRemoveObserver(this, NOTIFY_TAB_PARENTED, start_listening);
- AddOrRemoveObserver(this, NOTIFY_TAB_CLOSING, start_listening);
- AddOrRemoveObserver(this, NOTIFY_LOAD_START, start_listening);
- AddOrRemoveObserver(this, NOTIFY_LOAD_STOP, start_listening);
- AddOrRemoveObserver(this, NOTIFY_RENDERER_PROCESS_IN_SBOX, start_listening);
- AddOrRemoveObserver(this, NOTIFY_RENDERER_PROCESS_TERMINATED,
+ AddOrRemoveObserver(this, NotificationType::BROWSER_OPENED, start_listening);
+ AddOrRemoveObserver(this, NotificationType::BROWSER_CLOSED, start_listening);
+ AddOrRemoveObserver(this, NotificationType::USER_ACTION, start_listening);
+ AddOrRemoveObserver(this, NotificationType::TAB_PARENTED, start_listening);
+ AddOrRemoveObserver(this, NotificationType::TAB_CLOSING, start_listening);
+ AddOrRemoveObserver(this, NotificationType::LOAD_START, start_listening);
+ AddOrRemoveObserver(this, NotificationType::LOAD_STOP, start_listening);
+ AddOrRemoveObserver(this, NotificationType::RENDERER_PROCESS_IN_SBOX,
start_listening);
- AddOrRemoveObserver(this, NOTIFY_RENDERER_PROCESS_HANG, start_listening);
- AddOrRemoveObserver(this, NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED,
+ AddOrRemoveObserver(this, NotificationType::RENDERER_PROCESS_TERMINATED,
+ start_listening);
+ AddOrRemoveObserver(this, NotificationType::RENDERER_PROCESS_HANG,
+ start_listening);
+ AddOrRemoveObserver(this, NotificationType::PLUGIN_PROCESS_HOST_CONNECTED,
+ start_listening);
+ AddOrRemoveObserver(this, NotificationType::PLUGIN_INSTANCE_CREATED,
+ start_listening);
+ AddOrRemoveObserver(this, NotificationType::PLUGIN_PROCESS_CRASHED,
+ start_listening);
+ AddOrRemoveObserver(this, NotificationType::TEMPLATE_URL_MODEL_LOADED,
+ start_listening);
+ AddOrRemoveObserver(this, NotificationType::OMNIBOX_OPENED_URL,
+ start_listening);
+ AddOrRemoveObserver(this, NotificationType::BOOKMARK_MODEL_LOADED,
start_listening);
- AddOrRemoveObserver(this, NOTIFY_PLUGIN_INSTANCE_CREATED, start_listening);
- AddOrRemoveObserver(this, NOTIFY_PLUGIN_PROCESS_CRASHED, start_listening);
- AddOrRemoveObserver(this, TEMPLATE_URL_MODEL_LOADED, start_listening);
- AddOrRemoveObserver(this, NOTIFY_OMNIBOX_OPENED_URL, start_listening);
- AddOrRemoveObserver(this, NOTIFY_BOOKMARK_MODEL_LOADED, start_listening);
}
// static
@@ -1451,14 +1459,14 @@ void MetricsService::LogWindowChange(NotificationType type,
}
DCHECK(controller_id != -1);
- switch (type) {
- case NOTIFY_TAB_PARENTED:
- case NOTIFY_BROWSER_OPENED:
+ switch (type.value) {
+ case NotificationType::TAB_PARENTED:
+ case NotificationType::BROWSER_OPENED:
window_type = MetricsLog::WINDOW_CREATE;
break;
- case NOTIFY_TAB_CLOSING:
- case NOTIFY_BROWSER_CLOSED:
+ case NotificationType::TAB_CLOSING:
+ case NotificationType::BROWSER_CLOSED:
window_map_.erase(window_map_.find(window_or_tab));
window_type = MetricsLog::WINDOW_DESTROY;
break;
@@ -1532,21 +1540,21 @@ void MetricsService::LogPluginChange(NotificationType type,
}
PluginStats& stats = plugin_stats_buffer_[plugin];
- switch (type) {
- case NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED:
+ switch (type.value) {
+ case NotificationType::PLUGIN_PROCESS_HOST_CONNECTED:
stats.process_launches++;
break;
- case NOTIFY_PLUGIN_INSTANCE_CREATED:
+ case NotificationType::PLUGIN_INSTANCE_CREATED:
stats.instances++;
break;
- case NOTIFY_PLUGIN_PROCESS_CRASHED:
+ case NotificationType::PLUGIN_PROCESS_CRASHED:
stats.process_crashes++;
break;
default:
- NOTREACHED() << "Unexpected notification type " << type;
+ NOTREACHED() << "Unexpected notification type " << type.value;
return;
}
}
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index 17669ee..64780d7 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -5,8 +5,8 @@
// This file defines a service that collects information about the user
// experience in order to help improve future versions of the app.
-#ifndef CHROME_BROWSER_METRICS_SERVICE_H__
-#define CHROME_BROWSER_METRICS_SERVICE_H__
+#ifndef CHROME_BROWSER_METRICS_SERVICE_H_
+#define CHROME_BROWSER_METRICS_SERVICE_H_
#include <list>
#include <map>
@@ -21,7 +21,7 @@
#include "base/values.h"
#include "chrome/browser/metrics/metrics_log.h"
#include "chrome/browser/net/url_fetcher.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "webkit/glue/webplugin.h"
class BookmarkModel;
@@ -457,8 +457,7 @@ class MetricsService : public NotificationObserver,
// Indicate that a timer for sending the next log has already been queued.
bool timer_pending_;
- DISALLOW_EVIL_CONSTRUCTORS(MetricsService);
+ DISALLOW_COPY_AND_ASSIGN(MetricsService);
};
-#endif // CHROME_BROWSER_METRICS_SERVICE_H__
-
+#endif // CHROME_BROWSER_METRICS_SERVICE_H_
diff --git a/chrome/browser/metrics/user_metrics.cc b/chrome/browser/metrics/user_metrics.cc
index 4049875..a000963 100644
--- a/chrome/browser/metrics/user_metrics.cc
+++ b/chrome/browser/metrics/user_metrics.cc
@@ -7,10 +7,10 @@
#include "chrome/common/notification_service.h"
void UserMetrics::RecordAction(const wchar_t* action, Profile* profile) {
- NotificationService::current()->
- Notify(NOTIFY_USER_ACTION,
- Source<Profile>(profile),
- Details<const wchar_t*>(&action));
+ NotificationService::current()->Notify(
+ NotificationType::USER_ACTION,
+ Source<Profile>(profile),
+ Details<const wchar_t*>(&action));
}
void UserMetrics::RecordComputedAction(const std::wstring& action,
diff --git a/chrome/browser/modal_html_dialog_delegate.cc b/chrome/browser/modal_html_dialog_delegate.cc
index 4afdd47..fa8549c 100644
--- a/chrome/browser/modal_html_dialog_delegate.cc
+++ b/chrome/browser/modal_html_dialog_delegate.cc
@@ -6,15 +6,16 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/renderer_host/render_view_host.h"
+#include "chrome/common/notification_service.h"
ModalHtmlDialogDelegate::ModalHtmlDialogDelegate(
const GURL& url, int width, int height, const std::string& json_arguments,
IPC::Message* sync_result, WebContents* contents)
- : contents_(contents),
- sync_response_(sync_result) {
+ : contents_(contents),
+ sync_response_(sync_result) {
// Listen for when the WebContents or its renderer dies.
NotificationService::current()->
- AddObserver(this, NOTIFY_WEB_CONTENTS_DISCONNECTED,
+ AddObserver(this, NotificationType::WEB_CONTENTS_DISCONNECTED,
Source<WebContents>(contents_));
// This information is needed to show the dialog HTML content.
@@ -31,7 +32,7 @@ ModalHtmlDialogDelegate::~ModalHtmlDialogDelegate() {
void ModalHtmlDialogDelegate::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_WEB_CONTENTS_DISCONNECTED);
+ DCHECK(type == NotificationType::WEB_CONTENTS_DISCONNECTED);
DCHECK(Source<WebContents>(source).ptr() == contents_);
RemoveObserver();
}
@@ -68,8 +69,9 @@ void ModalHtmlDialogDelegate::RemoveObserver() {
if (!contents_)
return;
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_WEB_CONTENTS_DISCONNECTED,
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::WEB_CONTENTS_DISCONNECTED,
Source<WebContents>(contents_));
contents_ = NULL; // No longer safe to access.
}
diff --git a/chrome/browser/modal_html_dialog_delegate.h b/chrome/browser/modal_html_dialog_delegate.h
index dd5e5d60..3231af3 100644
--- a/chrome/browser/modal_html_dialog_delegate.h
+++ b/chrome/browser/modal_html_dialog_delegate.h
@@ -8,7 +8,7 @@
#include <vector>
#include "chrome/browser/dom_ui/html_dialog_contents.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
// This class can only be used on the UI thread.
class ModalHtmlDialogDelegate
diff --git a/chrome/browser/navigation_controller_unittest.cc b/chrome/browser/navigation_controller_unittest.cc
index 1019d80..cfeb697 100644
--- a/chrome/browser/navigation_controller_unittest.cc
+++ b/chrome/browser/navigation_controller_unittest.cc
@@ -16,7 +16,7 @@
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/browser/tab_contents/tab_contents_factory.h"
#include "chrome/common/notification_registrar.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/stl_util-inl.h"
#include "chrome/test/test_notification_tracker.h"
#include "chrome/test/test_tab_contents.h"
@@ -230,11 +230,11 @@ class NavigationControllerHistoryTest : public NavigationControllerTest {
void RegisterForAllNavNotifications(TestNotificationTracker* tracker,
NavigationController* controller) {
- tracker->ListenFor(NOTIFY_NAV_ENTRY_COMMITTED,
+ tracker->ListenFor(NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(controller));
- tracker->ListenFor(NOTIFY_NAV_LIST_PRUNED,
+ tracker->ListenFor(NotificationType::NAV_LIST_PRUNED,
Source<NavigationController>(controller));
- tracker->ListenFor(NOTIFY_NAV_ENTRY_CHANGED,
+ tracker->ListenFor(NotificationType::NAV_ENTRY_CHANGED,
Source<NavigationController>(controller));
}
@@ -280,7 +280,8 @@ TEST_F(NavigationControllerTest, LoadURL) {
EXPECT_EQ(0, notifications.size());
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// The load should now be committed.
EXPECT_EQ(contents->controller()->GetEntryCount(), 1);
@@ -307,7 +308,8 @@ TEST_F(NavigationControllerTest, LoadURL) {
EXPECT_EQ(contents->GetMaxPageID(), 0);
contents->CompleteNavigationAsRenderer(1, url2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// The load should now be committed.
EXPECT_EQ(contents->controller()->GetEntryCount(), 2);
@@ -333,12 +335,14 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage) {
contents->controller()->LoadURL(url1, GURL(), PageTransition::TYPED);
EXPECT_EQ(0, notifications.size());
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->LoadURL(url1, GURL(), PageTransition::TYPED);
EXPECT_EQ(0, notifications.size());
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// We should not have produced a new session history entry.
EXPECT_EQ(contents->controller()->GetEntryCount(), 1);
@@ -361,7 +365,8 @@ TEST_F(NavigationControllerTest, LoadURL_Discarded) {
contents->controller()->LoadURL(url1, GURL(), PageTransition::TYPED);
EXPECT_EQ(0, notifications.size());
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->LoadURL(url2, GURL(), PageTransition::TYPED);
contents->controller()->DiscardNonCommittedEntries();
@@ -388,7 +393,8 @@ TEST_F(NavigationControllerTest, LoadURL_NoPending) {
contents->controller()->LoadURL(kExistingURL1, GURL(),
PageTransition::TYPED);
contents->CompleteNavigationAsRenderer(0, kExistingURL1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// Do a new navigation without making a pending one.
const GURL kNewURL(scheme1() + ":see");
@@ -396,7 +402,8 @@ TEST_F(NavigationControllerTest, LoadURL_NoPending) {
// There should no longer be any pending entry, and the third navigation we
// just made should be committed.
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(-1, contents->controller()->GetPendingEntryIndex());
EXPECT_EQ(1, contents->controller()->GetLastCommittedEntryIndex());
EXPECT_EQ(kNewURL, contents->controller()->GetActiveEntry()->url());
@@ -415,7 +422,8 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) {
contents->controller()->LoadURL(kExistingURL1, GURL(),
PageTransition::TYPED);
contents->CompleteNavigationAsRenderer(0, kExistingURL1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// Make a pending entry to somewhere new.
const GURL kExistingURL2(scheme1() + ":bee");
@@ -429,7 +437,8 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) {
// There should no longer be any pending entry, and the third navigation we
// just made should be committed.
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(-1, contents->controller()->GetPendingEntryIndex());
EXPECT_EQ(1, contents->controller()->GetLastCommittedEntryIndex());
EXPECT_EQ(kNewURL, contents->controller()->GetActiveEntry()->url());
@@ -447,13 +456,15 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) {
contents->controller()->LoadURL(kExistingURL1, GURL(),
PageTransition::TYPED);
contents->CompleteNavigationAsRenderer(0, kExistingURL1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
const GURL kExistingURL2(scheme1() + ":bee");
contents->controller()->LoadURL(kExistingURL2, GURL(),
PageTransition::TYPED);
contents->CompleteNavigationAsRenderer(1, kExistingURL2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// Now make a pending back/forward navigation. The zeroth entry should be
// pending.
@@ -469,7 +480,8 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) {
// There should no longer be any pending entry, and the third navigation we
// just made should be committed.
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(-1, contents->controller()->GetPendingEntryIndex());
EXPECT_EQ(2, contents->controller()->GetLastCommittedEntryIndex());
EXPECT_EQ(kNewURL, contents->controller()->GetActiveEntry()->url());
@@ -484,7 +496,8 @@ TEST_F(NavigationControllerTest, Reload) {
contents->controller()->LoadURL(url1, GURL(), PageTransition::TYPED);
EXPECT_EQ(0, notifications.size());
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->Reload(true);
EXPECT_EQ(0, notifications.size());
@@ -499,7 +512,8 @@ TEST_F(NavigationControllerTest, Reload) {
EXPECT_FALSE(contents->controller()->CanGoForward());
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// Now the reload is committed.
EXPECT_EQ(contents->controller()->GetEntryCount(), 1);
@@ -521,13 +535,15 @@ TEST_F(NavigationControllerTest, Reload_GeneratesNewPage) {
contents->controller()->LoadURL(url1, GURL(), PageTransition::TYPED);
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->Reload(true);
EXPECT_EQ(0, notifications.size());
contents->CompleteNavigationAsRenderer(1, url2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// Now the reload is committed.
EXPECT_EQ(contents->controller()->GetEntryCount(), 2);
@@ -546,11 +562,13 @@ TEST_F(NavigationControllerTest, Back) {
const GURL url1(scheme1() + ":foo1");
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
const GURL url2(scheme1() + ":foo2");
contents->CompleteNavigationAsRenderer(1, url2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->GoBack();
EXPECT_EQ(0, notifications.size());
@@ -565,7 +583,8 @@ TEST_F(NavigationControllerTest, Back) {
EXPECT_TRUE(contents->controller()->CanGoForward());
contents->CompleteNavigationAsRenderer(0, url2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// The back navigation completed successfully.
EXPECT_EQ(contents->controller()->GetEntryCount(), 2);
@@ -588,11 +607,13 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) {
contents->controller()->LoadURL(url1, GURL(), PageTransition::TYPED);
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->LoadURL(url2, GURL(), PageTransition::TYPED);
contents->CompleteNavigationAsRenderer(1, url2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->GoBack();
EXPECT_EQ(0, notifications.size());
@@ -607,7 +628,8 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) {
EXPECT_TRUE(contents->controller()->CanGoForward());
contents->CompleteNavigationAsRenderer(2, url3);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// The back navigation resulted in a completely new navigation.
// TODO(darin): perhaps this behavior will be confusing to users?
@@ -631,11 +653,13 @@ TEST_F(NavigationControllerTest, Back_NewPending) {
// First navigate two places so we have some back history.
contents->CompleteNavigationAsRenderer(0, kUrl1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
//contents->controller()->LoadURL(kUrl2, PageTransition::TYPED);
contents->CompleteNavigationAsRenderer(1, kUrl2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// Now start a new pending navigation and go back before it commits.
contents->controller()->LoadURL(kUrl3, GURL(), PageTransition::TYPED);
@@ -701,14 +725,17 @@ TEST_F(NavigationControllerTest, Forward) {
const GURL url2(scheme1() + ":foo2");
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->CompleteNavigationAsRenderer(1, url2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->GoBack();
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->GoForward();
@@ -722,7 +749,8 @@ TEST_F(NavigationControllerTest, Forward) {
EXPECT_FALSE(contents->controller()->CanGoForward());
contents->CompleteNavigationAsRenderer(1, url2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// The forward navigation completed successfully.
EXPECT_EQ(contents->controller()->GetEntryCount(), 2);
@@ -744,13 +772,16 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) {
const GURL url3(scheme1() + ":foo3");
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->CompleteNavigationAsRenderer(1, url2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->GoBack();
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->controller()->GoForward();
EXPECT_EQ(0, notifications.size());
@@ -765,8 +796,9 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) {
EXPECT_FALSE(contents->controller()->CanGoForward());
contents->CompleteNavigationAsRenderer(2, url3);
- EXPECT_TRUE(notifications.Check2AndReset(NOTIFY_NAV_LIST_PRUNED,
- NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check2AndReset(
+ NotificationType::NAV_LIST_PRUNED,
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(contents->controller()->GetEntryCount(), 2);
EXPECT_EQ(contents->controller()->GetLastCommittedEntryIndex(), 1);
@@ -785,7 +817,8 @@ TEST_F(NavigationControllerTest, NewSubframe) {
const GURL url1(scheme1() + ":foo1");
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
const GURL url2(scheme1() + ":foo2");
ViewHostMsg_FrameNavigate_Params params;
@@ -798,7 +831,8 @@ TEST_F(NavigationControllerTest, NewSubframe) {
NavigationController::LoadCommittedDetails details;
EXPECT_TRUE(contents->controller()->RendererDidNavigate(params, &details));
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(url1, details.previous_url);
EXPECT_FALSE(details.is_auto);
EXPECT_FALSE(details.is_in_page);
@@ -843,7 +877,8 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
const GURL url1(scheme1() + ":foo1");
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
const GURL url2(scheme1() + ":foo2");
ViewHostMsg_FrameNavigate_Params params;
@@ -871,7 +906,8 @@ TEST_F(NavigationControllerTest, BackSubframe) {
// Main page.
const GURL url1(scheme1() + ":foo1");
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// First manual subframe navigation.
const GURL url2(scheme1() + ":foo2");
@@ -886,7 +922,8 @@ TEST_F(NavigationControllerTest, BackSubframe) {
// This should generate a new entry.
NavigationController::LoadCommittedDetails details;
EXPECT_TRUE(contents->controller()->RendererDidNavigate(params, &details));
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(2, contents->controller()->GetEntryCount());
// Second manual subframe navigation should also make a new entry.
@@ -894,7 +931,8 @@ TEST_F(NavigationControllerTest, BackSubframe) {
params.page_id = 2;
params.url = url3;
EXPECT_TRUE(contents->controller()->RendererDidNavigate(params, &details));
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(3, contents->controller()->GetEntryCount());
EXPECT_EQ(2, contents->controller()->GetCurrentEntryIndex());
@@ -903,7 +941,8 @@ TEST_F(NavigationControllerTest, BackSubframe) {
params.url = url2;
params.page_id = 1;
EXPECT_TRUE(contents->controller()->RendererDidNavigate(params, &details));
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(3, contents->controller()->GetEntryCount());
EXPECT_EQ(1, contents->controller()->GetCurrentEntryIndex());
@@ -912,7 +951,8 @@ TEST_F(NavigationControllerTest, BackSubframe) {
params.url = url1;
params.page_id = 0;
EXPECT_TRUE(contents->controller()->RendererDidNavigate(params, &details));
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(3, contents->controller()->GetEntryCount());
EXPECT_EQ(0, contents->controller()->GetCurrentEntryIndex());
}
@@ -925,10 +965,12 @@ TEST_F(NavigationControllerTest, LinkClick) {
const GURL url2(scheme1() + ":foo2");
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
contents->CompleteNavigationAsRenderer(1, url2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// Should not have produced a new session history entry.
EXPECT_EQ(contents->controller()->GetEntryCount(), 2);
@@ -948,7 +990,8 @@ TEST_F(NavigationControllerTest, InPage) {
// which are the only ones that can have a ref.
const GURL url1(scheme1() + "://foo");
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// First navigation.
const GURL url2(scheme1() + "://foo#a");
@@ -963,7 +1006,8 @@ TEST_F(NavigationControllerTest, InPage) {
// This should generate a new entry.
NavigationController::LoadCommittedDetails details;
EXPECT_TRUE(contents->controller()->RendererDidNavigate(params, &details));
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(2, contents->controller()->GetEntryCount());
// Go back one.
@@ -973,7 +1017,8 @@ TEST_F(NavigationControllerTest, InPage) {
back_params.page_id = 0;
EXPECT_TRUE(contents->controller()->RendererDidNavigate(back_params,
&details));
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(2, contents->controller()->GetEntryCount());
EXPECT_EQ(0, contents->controller()->GetCurrentEntryIndex());
EXPECT_EQ(back_params.url, contents->controller()->GetActiveEntry()->url());
@@ -985,7 +1030,8 @@ TEST_F(NavigationControllerTest, InPage) {
forward_params.page_id = 1;
EXPECT_TRUE(contents->controller()->RendererDidNavigate(forward_params,
&details));
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(2, contents->controller()->GetEntryCount());
EXPECT_EQ(1, contents->controller()->GetCurrentEntryIndex());
EXPECT_EQ(forward_params.url,
@@ -1013,7 +1059,8 @@ TEST_F(NavigationControllerTest, SwitchTypes) {
const GURL url2(scheme2() + ":foo");
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
TestTabContents* initial_contents = contents;
contents->controller()->LoadURL(url2, GURL(), PageTransition::TYPED);
@@ -1022,7 +1069,8 @@ TEST_F(NavigationControllerTest, SwitchTypes) {
ASSERT_TRUE(initial_contents != contents);
contents->CompleteNavigationAsRenderer(1, url2);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
// A second navigation entry should have been committed even though the
// PageIDs are the same. PageIDs are scoped to the tab contents type.
@@ -1038,7 +1086,8 @@ TEST_F(NavigationControllerTest, SwitchTypes) {
contents->controller()->GoBack();
ASSERT_TRUE(initial_contents == contents); // switched again!
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
EXPECT_EQ(contents->controller()->GetEntryCount(), 2);
EXPECT_EQ(contents->controller()->GetLastCommittedEntryIndex(), 0);
@@ -1062,7 +1111,8 @@ TEST_F(NavigationControllerTest, SwitchTypes_Discard) {
const GURL url2(scheme2() + ":foo");
contents->CompleteNavigationAsRenderer(0, url1);
- EXPECT_TRUE(notifications.Check1AndReset(NOTIFY_NAV_ENTRY_COMMITTED));
+ EXPECT_TRUE(notifications.Check1AndReset(
+ NotificationType::NAV_ENTRY_COMMITTED));
TestTabContents* initial_contents = contents;
@@ -1128,28 +1178,28 @@ TEST_F(NavigationControllerTest, SwitchTypesCleanup) {
namespace {
// NotificationObserver implementation used in verifying we've received the
-// NOTIFY_NAV_LIST_PRUNED method.
+// NotificationType::NAV_LIST_PRUNED method.
class PrunedListener : public NotificationObserver {
public:
explicit PrunedListener(NavigationController* controller)
: notification_count_(0) {
- registrar_.Add(this, NOTIFY_NAV_LIST_PRUNED,
+ registrar_.Add(this, NotificationType::NAV_LIST_PRUNED,
Source<NavigationController>(controller));
}
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_NAV_LIST_PRUNED) {
+ if (type == NotificationType::NAV_LIST_PRUNED) {
notification_count_++;
details_ = *(Details<NavigationController::PrunedDetails>(details).ptr());
}
}
- // Number of times NOTIFY_NAV_LIST_PRUNED has been observed.
+ // Number of times NAV_LIST_PRUNED has been observed.
int notification_count_;
- // Details from the last NOTIFY_NAV_LIST_PRUNED.
+ // Details from the last NAV_LIST_PRUNED.
NavigationController::PrunedDetails details_;
private:
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 7a4c3bb..d98f2d6 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/profile.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "net/http/http_cache.h"
#include "net/http/http_util.h"
@@ -121,14 +122,15 @@ ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile)
prefs_->AddPrefObserver(prefs::kCookieBehavior, this);
NotificationService::current()->AddObserver(
- this, NOTIFY_EXTENSIONS_LOADED, NotificationService::AllSources());
+ this, NotificationType::EXTENSIONS_LOADED,
+ NotificationService::AllSources());
}
// NotificationObserver implementation.
void ChromeURLRequestContext::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (NOTIFY_PREF_CHANGED == type) {
+ if (NotificationType::PREF_CHANGED == type) {
std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
PrefService* prefs = Source<PrefService>(source).ptr();
DCHECK(pref_name_in && prefs);
@@ -147,7 +149,7 @@ void ChromeURLRequestContext::Observe(NotificationType type,
&ChromeURLRequestContext::OnCookiePolicyChange,
type));
}
- } else if (NOTIFY_EXTENSIONS_LOADED == type) {
+ } else if (NotificationType::EXTENSIONS_LOADED == type) {
ExtensionPaths* new_paths = new ExtensionPaths;
ExtensionList* extensions = Details<ExtensionList>(details).ptr();
DCHECK(extensions);
@@ -171,7 +173,8 @@ void ChromeURLRequestContext::CleanupOnUIThread() {
prefs_ = NULL;
NotificationService::current()->RemoveObserver(
- this, NOTIFY_EXTENSIONS_LOADED, NotificationService::AllSources());
+ this, NotificationType::EXTENSIONS_LOADED,
+ NotificationService::AllSources());
}
FilePath ChromeURLRequestContext::GetPathForExtension(const std::string& id) {
@@ -211,9 +214,10 @@ void ChromeURLRequestContext::OnNewExtensions(ExtensionPaths* new_paths) {
ChromeURLRequestContext::~ChromeURLRequestContext() {
DCHECK(NULL == prefs_);
- NotificationService::current()->Notify(NOTIFY_URL_REQUEST_CONTEXT_RELEASED,
- Source<URLRequestContext>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::URL_REQUEST_CONTEXT_RELEASED,
+ Source<URLRequestContext>(this),
+ NotificationService::NoDetails());
delete cookie_store_;
delete http_transaction_factory_;
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index f9cfafac..15d53e8 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -4,7 +4,7 @@
#include "base/file_path.h"
#include "chrome/common/net/cookie_monster_sqlite.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/pref_service.h"
#include "net/url_request/url_request_context.h"
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc
index 3ea79ff..b34de8a 100644
--- a/chrome/browser/net/dns_global.cc
+++ b/chrome/browser/net/dns_global.cc
@@ -16,7 +16,7 @@
#include "chrome/browser/net/referrer.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/session_startup_pref.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_type.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@@ -293,16 +293,16 @@ class OffTheRecordObserver : public NotificationObserver {
void Register() {
NotificationService* service = NotificationService::current();
// TODO(tc): These notification observers are never removed.
- service->AddObserver(this, NOTIFY_BROWSER_CLOSED,
+ service->AddObserver(this, NotificationType::BROWSER_CLOSED,
NotificationService::AllSources());
- service->AddObserver(this, NOTIFY_BROWSER_OPENED,
+ service->AddObserver(this, NotificationType::BROWSER_OPENED,
NotificationService::AllSources());
}
void Observe(NotificationType type, const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_BROWSER_OPENED:
+ switch (type.value) {
+ case NotificationType::BROWSER_OPENED:
if (!Source<Browser>(source)->profile()->IsOffTheRecord())
break;
{
@@ -312,7 +312,7 @@ class OffTheRecordObserver : public NotificationObserver {
OnTheRecord(false);
break;
- case NOTIFY_BROWSER_CLOSED:
+ case NotificationType::BROWSER_CLOSED:
if (!Source<Browser>(source)->profile()->IsOffTheRecord())
break; // Ignore ordinary windows.
{
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index f071a7a..0e06e3e 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -72,11 +72,11 @@ PluginNotificationTask::PluginNotificationTask(
void PluginNotificationTask::Run() {
// Verify that the notification type is one that makes sense.
- switch (notification_type_) {
- case NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED:
- case NOTIFY_PLUGIN_PROCESS_HOST_DISCONNECTED:
- case NOTIFY_PLUGIN_PROCESS_CRASHED:
- case NOTIFY_PLUGIN_INSTANCE_CREATED:
+ switch (notification_type_.value) {
+ case NotificationType::PLUGIN_PROCESS_HOST_CONNECTED:
+ case NotificationType::PLUGIN_PROCESS_HOST_DISCONNECTED:
+ case NotificationType::PLUGIN_PROCESS_CRASHED:
+ case NotificationType::PLUGIN_INSTANCE_CREATED:
break;
default:
@@ -568,13 +568,14 @@ void PluginProcessHost::OnObjectSignaled(HANDLE object) {
if (did_crash) {
// Report that this plugin crashed.
plugin_service_->main_message_loop()->PostTask(FROM_HERE,
- new PluginNotificationTask(NOTIFY_PLUGIN_PROCESS_CRASHED,
+ new PluginNotificationTask(NotificationType::PLUGIN_PROCESS_CRASHED,
plugin_path(), object));
}
// Notify in the main loop of the disconnection.
plugin_service_->main_message_loop()->PostTask(FROM_HERE,
- new PluginNotificationTask(NOTIFY_PLUGIN_PROCESS_HOST_DISCONNECTED,
- plugin_path(), object));
+ new PluginNotificationTask(
+ NotificationType::PLUGIN_PROCESS_HOST_DISCONNECTED,
+ plugin_path(), object));
// Cancel all requests for plugin processes.
// TODO(mpcomplete): use a real process ID when http://b/issue?id=1210062 is
@@ -642,8 +643,9 @@ void PluginProcessHost::OnChannelConnected(int32 peer_pid) {
// Notify in the main loop of the connection.
plugin_service_->main_message_loop()->PostTask(FROM_HERE,
- new PluginNotificationTask(NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED,
- plugin_path(), process()));
+ new PluginNotificationTask(
+ NotificationType::PLUGIN_PROCESS_HOST_CONNECTED,
+ plugin_path(), process()));
}
void PluginProcessHost::OnChannelError() {
@@ -664,7 +666,7 @@ void PluginProcessHost::OpenChannelToPlugin(
IPC::Message* reply_msg) {
// Notify in the main loop of the instantiation.
plugin_service_->main_message_loop()->PostTask(FROM_HERE,
- new PluginNotificationTask(NOTIFY_PLUGIN_INSTANCE_CREATED,
+ new PluginNotificationTask(NotificationType::PLUGIN_INSTANCE_CREATED,
plugin_path(), process()));
if (opening_channel_) {
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
index 14a487cd..193a3c1 100644
--- a/chrome/browser/printing/print_job.cc
+++ b/chrome/browser/printing/print_job.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/printing/print_job_worker.h"
#include "chrome/browser/printing/printed_document.h"
#include "chrome/browser/printing/printed_page.h"
+#include "chrome/common/notification_service.h"
#ifdef _MSC_VER
#pragma warning(disable:4355) // 'this' : used in base member initializer list
@@ -67,15 +68,15 @@ void PrintJob::Initialize(PrintJobWorkerOwner* job,
// Don't forget to register to our own messages.
NotificationService::current()->AddObserver(
- this, NOTIFY_PRINT_JOB_EVENT, Source<PrintJob>(this));
+ this, NotificationType::PRINT_JOB_EVENT, Source<PrintJob>(this));
}
void PrintJob::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK_EQ(ui_message_loop_, MessageLoop::current());
- switch (type) {
- case NOTIFY_PRINTED_DOCUMENT_UPDATED: {
+ switch (type.value) {
+ case NotificationType::PRINTED_DOCUMENT_UPDATED: {
DCHECK(Source<PrintedDocument>(source).ptr() ==
document_.get());
@@ -90,7 +91,7 @@ void PrintJob::Observe(NotificationType type,
}
break;
}
- case NOTIFY_PRINT_JOB_EVENT: {
+ case NotificationType::PRINT_JOB_EVENT: {
OnNotifyPrintJobEvent(*Details<JobEventDetails>(details).ptr());
break;
}
@@ -120,8 +121,8 @@ void PrintJob::GetSettingsDone(const PrintSettings& new_settings,
JobEventDetails::Type type;
if (is_print_dialog_box_shown_) {
type = (result == PrintingContext::OK) ?
- JobEventDetails::USER_INIT_DONE :
- JobEventDetails::USER_INIT_CANCELED;
+ JobEventDetails::USER_INIT_DONE :
+ JobEventDetails::USER_INIT_CANCELED;
// Dialog box is not shown anymore.
is_print_dialog_box_shown_ = false;
} else {
@@ -131,7 +132,7 @@ void PrintJob::GetSettingsDone(const PrintSettings& new_settings,
scoped_refptr<JobEventDetails> details(
new JobEventDetails(type, document_.get(), NULL));
NotificationService::current()->Notify(
- NOTIFY_PRINT_JOB_EVENT,
+ NotificationType::PRINT_JOB_EVENT,
Source<PrintJob>(this),
Details<JobEventDetails>(details.get()));
}
@@ -168,7 +169,7 @@ void PrintJob::GetSettings(GetSettingsAskParam ask_user_for_settings,
// Don't re-register if we were already registered.
NotificationService::current()->AddObserver(
- this, NOTIFY_PRINT_JOB_EVENT, Source<PrintJob>(this));
+ this, NotificationType::PRINT_JOB_EVENT, Source<PrintJob>(this));
}
int page_count = 0;
@@ -201,7 +202,7 @@ void PrintJob::StartPrinting() {
scoped_refptr<JobEventDetails> details(
new JobEventDetails(JobEventDetails::NEW_DOC, document_.get(), NULL));
NotificationService::current()->Notify(
- NOTIFY_PRINT_JOB_EVENT,
+ NotificationType::PRINT_JOB_EVENT,
Source<PrintJob>(this),
Details<JobEventDetails>(details.get()));
}
@@ -225,7 +226,7 @@ void PrintJob::Stop() {
is_job_pending_ = false;
NotificationService::current()->RemoveObserver(
- this, NOTIFY_PRINT_JOB_EVENT, Source<PrintJob>(this));
+ this, NotificationType::PRINT_JOB_EVENT, Source<PrintJob>(this));
}
// Flush the cached document.
UpdatePrintedDocument(NULL);
@@ -250,7 +251,7 @@ void PrintJob::Cancel() {
scoped_refptr<JobEventDetails> details(
new JobEventDetails(JobEventDetails::FAILED, NULL, NULL));
NotificationService::current()->Notify(
- NOTIFY_PRINT_JOB_EVENT,
+ NotificationType::PRINT_JOB_EVENT,
Source<PrintJob>(this),
Details<JobEventDetails>(details.get()));
Stop();
@@ -320,19 +321,19 @@ void PrintJob::UpdatePrintedDocument(PrintedDocument* new_document) {
return;
// Unregisters.
if (document_.get()) {
- NotificationService::current()->
- RemoveObserver(this,
- NOTIFY_PRINTED_DOCUMENT_UPDATED,
- Source<PrintedDocument>(document_.get()));
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::PRINTED_DOCUMENT_UPDATED,
+ Source<PrintedDocument>(document_.get()));
}
document_ = new_document;
// Registers.
if (document_.get()) {
- NotificationService::current()->
- AddObserver(this,
- NOTIFY_PRINTED_DOCUMENT_UPDATED,
- Source<PrintedDocument>(document_.get()));
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::PRINTED_DOCUMENT_UPDATED,
+ Source<PrintedDocument>(document_.get()));
settings_ = document_->settings();
}
@@ -392,7 +393,7 @@ void PrintJob::OnDocumentDone() {
scoped_refptr<JobEventDetails> details(
new JobEventDetails(JobEventDetails::JOB_DONE, document_.get(), NULL));
NotificationService::current()->Notify(
- NOTIFY_PRINT_JOB_EVENT,
+ NotificationType::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 f67cc7b..dcbe43e 100644
--- a/chrome/browser/printing/print_job.h
+++ b/chrome/browser/printing/print_job.h
@@ -10,7 +10,7 @@
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "chrome/browser/printing/print_job_worker_owner.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
class ChromeFont;
class GURL;
diff --git a/chrome/browser/printing/print_job_manager.cc b/chrome/browser/printing/print_job_manager.cc
index 978f889..c2ff3a8 100644
--- a/chrome/browser/printing/print_job_manager.cc
+++ b/chrome/browser/printing/print_job_manager.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/printing/printed_document.h"
#include "chrome/browser/printing/printed_page.h"
#include "chrome/common/gfx/emf.h"
+#include "chrome/common/notification_service.h"
namespace printing {
@@ -18,11 +19,11 @@ PrintJobManager::PrintJobManager()
: debug_dump_path_() {
NotificationService::current()->AddObserver(
this,
- NOTIFY_PRINT_JOB_EVENT,
+ NotificationType::PRINT_JOB_EVENT,
NotificationService::AllSources());
NotificationService::current()->AddObserver(
this,
- NOTIFY_PRINTED_DOCUMENT_UPDATED,
+ NotificationType::PRINTED_DOCUMENT_UPDATED,
NotificationService::AllSources());
}
@@ -33,11 +34,11 @@ PrintJobManager::~PrintJobManager() {
queued_queries_.clear();
NotificationService::current()->RemoveObserver(
this,
- NOTIFY_PRINT_JOB_EVENT,
+ NotificationType::PRINT_JOB_EVENT,
NotificationService::AllSources());
NotificationService::current()->RemoveObserver(
this,
- NOTIFY_PRINTED_DOCUMENT_UPDATED,
+ NotificationType::PRINTED_DOCUMENT_UPDATED,
NotificationService::AllSources());
}
@@ -61,11 +62,11 @@ void PrintJobManager::OnQuit() {
current_jobs_.clear();
NotificationService::current()->RemoveObserver(
this,
- NOTIFY_PRINT_JOB_EVENT,
+ NotificationType::PRINT_JOB_EVENT,
NotificationService::AllSources());
NotificationService::current()->RemoveObserver(
this,
- NOTIFY_PRINTED_DOCUMENT_UPDATED,
+ NotificationType::PRINTED_DOCUMENT_UPDATED,
NotificationService::AllSources());
DCHECK_EQ(current_jobs_.size(), 0);
}
@@ -98,13 +99,13 @@ void PrintJobManager::PopPrinterQuery(int document_cookie,
void PrintJobManager::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_PRINT_JOB_EVENT: {
+ switch (type.value) {
+ case NotificationType::PRINT_JOB_EVENT: {
OnPrintJobEvent(Source<PrintJob>(source).ptr(),
*Details<JobEventDetails>(details).ptr());
break;
}
- case NOTIFY_PRINTED_DOCUMENT_UPDATED: {
+ case NotificationType::PRINTED_DOCUMENT_UPDATED: {
PrintedPage* printed_page = Details<PrintedPage>(details).ptr();
if (printed_page)
OnPrintedDocumentUpdated(*Source<PrintedDocument>(source).ptr(),
diff --git a/chrome/browser/printing/print_job_manager.h b/chrome/browser/printing/print_job_manager.h
index 20424c1..4286a2d 100644
--- a/chrome/browser/printing/print_job_manager.h
+++ b/chrome/browser/printing/print_job_manager.h
@@ -2,12 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H__
-#define CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H__
+#ifndef CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H_
+#define CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H_
+
+#include <string>
+#include <vector>
#include "base/lock.h"
#include "base/ref_counted.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
namespace printing {
@@ -83,5 +86,4 @@ class PrintJobManager : public NotificationObserver {
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H__
-
+#endif // CHROME_BROWSER_PRINTING_PRINT_JOB_MANAGER_H_
diff --git a/chrome/browser/printing/print_job_unittest.cc b/chrome/browser/printing/print_job_unittest.cc
index a4b529c..6789dd0 100644
--- a/chrome/browser/printing/print_job_unittest.cc
+++ b/chrome/browser/printing/print_job_unittest.cc
@@ -5,6 +5,7 @@
#include "base/message_loop.h"
#include "chrome/browser/printing/print_job.h"
#include "chrome/browser/printing/printed_pages_source.h"
+#include "chrome/common/notification_service.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -43,7 +44,7 @@ class TestPrintNotifObserv : public NotificationObserver {
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- ASSERT_EQ(NOTIFY_PRINT_JOB_EVENT, type);
+ ASSERT_EQ(NotificationType::PRINT_JOB_EVENT, type.value);
printing::JobEventDetails::Type event_type =
Details<printing::JobEventDetails>(details)->type();
EXPECT_NE(printing::JobEventDetails::NEW_DOC, event_type);
@@ -70,7 +71,7 @@ TEST(PrintJobTest, SimplePrint) {
TestPrintNotifObserv observ;
MessageLoop current;
NotificationService::current()->AddObserver(
- &observ, NOTIFY_ALL,
+ &observ, NotificationType::ALL,
NotificationService::AllSources());
TestSource source;
volatile bool check = false;
@@ -82,7 +83,7 @@ TEST(PrintJobTest, SimplePrint) {
job = NULL;
EXPECT_TRUE(check);
NotificationService::current()->RemoveObserver(
- &observ, NOTIFY_ALL,
+ &observ, NotificationType::ALL,
NotificationService::AllSources());
}
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
index 69e84f0..5f1621f 100644
--- a/chrome/browser/printing/print_job_worker.cc
+++ b/chrome/browser/printing/print_job_worker.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/printing/printed_document.h"
#include "chrome/browser/printing/printed_page.h"
#include "chrome/common/gfx/emf.h"
+#include "chrome/common/notification_service.h"
namespace printing {
@@ -34,7 +35,7 @@ class PrintJobWorker::NotificationTask : public Task {
virtual void Run() {
// Send the notification in the right thread.
NotificationService::current()->Notify(
- NOTIFY_PRINT_JOB_EVENT,
+ NotificationType::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_));
@@ -43,7 +44,6 @@ class PrintJobWorker::NotificationTask : public Task {
// The job which originates this notification.
scoped_refptr<PrintJobWorkerOwner> print_job_;
scoped_refptr<JobEventDetails> details_;
- NotificationType type_;
};
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index 436742a..bdc9da3 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/gfx/emf.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "generated_resources.h"
@@ -183,8 +184,8 @@ GURL PrintViewManager::RenderSourceUrl() {
void PrintViewManager::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_PRINT_JOB_EVENT: {
+ switch (type.value) {
+ case NotificationType::PRINT_JOB_EVENT: {
OnNotifyPrintJobEvent(*Details<JobEventDetails>(details).ptr());
break;
}
@@ -398,10 +399,10 @@ bool PrintViewManager::CreateNewPrintJob(PrintJobWorkerOwner* job) {
} else {
print_job_ = new PrintJob(this);
}
- NotificationService::current()->
- AddObserver(this,
- NOTIFY_PRINT_JOB_EVENT,
- Source<PrintJob>(print_job_.get()));
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::PRINT_JOB_EVENT,
+ Source<PrintJob>(print_job_.get()));
return true;
}
@@ -453,7 +454,7 @@ void PrintViewManager::ReleasePrintJob() {
return;
NotificationService::current()->RemoveObserver(
this,
- NOTIFY_PRINT_JOB_EVENT,
+ NotificationType::PRINT_JOB_EVENT,
Source<PrintJob>(print_job_.get()));
print_job_->DisconnectSource();
diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h
index 21226c4..405b180 100644
--- a/chrome/browser/printing/print_view_manager.h
+++ b/chrome/browser/printing/print_view_manager.h
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H__
-#define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H__
+#ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
+#define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
#include "chrome/browser/printing/printed_pages_source.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/render_messages.h"
class RenderViewHost;
@@ -160,10 +160,9 @@ class PrintViewManager : public NotificationObserver,
// back reference is kept the the "parent object".
WebContents& owner_;
- DISALLOW_EVIL_CONSTRUCTORS(PrintViewManager);
+ DISALLOW_COPY_AND_ASSIGN(PrintViewManager);
};
} // namespace printing
-#endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H__
-
+#endif // CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_H_
diff --git a/chrome/browser/printing/printed_document.cc b/chrome/browser/printing/printed_document.cc
index 7108f83..bdbdbf0 100644
--- a/chrome/browser/printing/printed_document.cc
+++ b/chrome/browser/printing/printed_document.cc
@@ -60,7 +60,7 @@ void PrintedDocument::SetPage(int page_number, gfx::Emf* emf, double shrink) {
}
}
NotificationService::current()->Notify(
- NOTIFY_PRINTED_DOCUMENT_UPDATED,
+ NotificationType::PRINTED_DOCUMENT_UPDATED,
Source<PrintedDocument>(this),
Details<PrintedPage>(page));
}
@@ -245,7 +245,7 @@ void PrintedDocument::set_page_count(int max_page) {
}
}
NotificationService::current()->Notify(
- NOTIFY_PRINTED_DOCUMENT_UPDATED,
+ NotificationType::PRINTED_DOCUMENT_UPDATED,
Source<PrintedDocument>(this),
NotificationService::NoDetails());
}
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 5e1bbd3..bdbf4a0 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -113,7 +113,9 @@ class OffTheRecordProfileImpl : public Profile,
// off-the-record window is closed, in which case we can clean our states
// (cookies, downloads...).
NotificationService::current()->AddObserver(
- this, NOTIFY_BROWSER_CLOSED, NotificationService::AllSources());
+ this,
+ NotificationType::BROWSER_CLOSED,
+ NotificationService::AllSources());
}
virtual ~OffTheRecordProfileImpl() {
@@ -127,7 +129,9 @@ class OffTheRecordProfileImpl : public Profile,
request_context_ = NULL;
}
NotificationService::current()->RemoveObserver(
- this, NOTIFY_BROWSER_CLOSED, NotificationService::AllSources());
+ this,
+ NotificationType::BROWSER_CLOSED,
+ NotificationService::AllSources());
}
virtual FilePath GetPath() { return profile_->GetPath(); }
@@ -288,7 +292,7 @@ class OffTheRecordProfileImpl : public Profile,
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK_EQ(NOTIFY_BROWSER_CLOSED, type);
+ DCHECK_EQ(NotificationType::BROWSER_CLOSED, type.value);
// We are only interested in OTR browser closing.
if (Source<Browser>(source)->profile() != this)
return;
@@ -547,7 +551,7 @@ URLRequestContext* ProfileImpl::GetRequestContext() {
if (!default_request_context_) {
default_request_context_ = request_context_;
NotificationService::current()->Notify(
- NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE,
+ NotificationType::DEFAULT_REQUEST_CONTEXT_AVAILABLE,
NotificationService::AllSources(), NotificationService::NoDetails());
}
@@ -567,7 +571,7 @@ HistoryService* ProfileImpl::GetHistoryService(ServiceAccessType sat) {
// Send out the notification that the history service was created.
NotificationService::current()->
- Notify(NOTIFY_HISTORY_CREATED, Source<Profile>(this),
+ Notify(NotificationType::HISTORY_CREATED, Source<Profile>(this),
Details<HistoryService>(history_service_.get()));
}
return history_service_.get();
@@ -702,7 +706,7 @@ class NotifySpellcheckerChangeTask : public Task {
private:
void Run(void) {
NotificationService::current()->Notify(
- NOTIFY_SPELLCHECKER_REINITIALIZED,
+ NotificationType::SPELLCHECKER_REINITIALIZED,
Source<Profile>(profile_),
Details<SpellcheckerReinitializedDetails>(&spellchecker_));
}
@@ -785,7 +789,7 @@ void ProfileImpl::MarkAsCleanShutdown() {
void ProfileImpl::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (NOTIFY_PREF_CHANGED == type) {
+ if (NotificationType::PREF_CHANGED == type) {
std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
PrefService* prefs = Source<PrefService>(source).ptr();
DCHECK(pref_name_in && prefs);
diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h
index 7189577..ef2f713 100644
--- a/chrome/browser/profile.h
+++ b/chrome/browser/profile.h
@@ -4,8 +4,8 @@
// This class gathers state related to a single user profile.
-#ifndef CHROME_BROWSER_PROFILE_H__
-#define CHROME_BROWSER_PROFILE_H__
+#ifndef CHROME_BROWSER_PROFILE_H_
+#define CHROME_BROWSER_PROFILE_H_
#include <set>
#include <string>
@@ -19,7 +19,7 @@
#ifdef CHROME_PERSONALIZATION
#include "chrome/personalization/personalization.h"
#endif
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@@ -366,7 +366,7 @@ class ProfileImpl : public Profile,
// GetSessionService won't recreate the SessionService.
bool shutdown_session_service_;
- DISALLOW_EVIL_CONSTRUCTORS(ProfileImpl);
+ DISALLOW_COPY_AND_ASSIGN(ProfileImpl);
};
// This struct is used to pass the spellchecker object through the notification
@@ -376,5 +376,4 @@ struct SpellcheckerReinitializedDetails {
scoped_refptr<SpellChecker> spellchecker;
};
-#endif // CHROME_BROWSER_PROFILE_H__
-
+#endif // CHROME_BROWSER_PROFILE_H_
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 8fc3742..95c3942 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -38,6 +38,7 @@
#include "chrome/common/debug_flags.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/logging_chrome.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/process_watcher.h"
@@ -140,7 +141,8 @@ BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile)
profile->GetPrefs()->GetBoolean(prefs::kBlockPopups));
NotificationService::current()->AddObserver(this,
- NOTIFY_USER_SCRIPTS_LOADED, NotificationService::AllSources());
+ NotificationType::USER_SCRIPTS_LOADED,
+ NotificationService::AllSources());
// Note: When we create the BrowserRenderProcessHost, it's technically backgrounded,
// because it has no visible listeners. But the process doesn't
@@ -162,7 +164,7 @@ BrowserRenderProcessHost::~BrowserRenderProcessHost() {
profile()->GetPrefs()->RemovePrefObserver(prefs::kBlockPopups, this);
NotificationService::current()->RemoveObserver(this,
- NOTIFY_USER_SCRIPTS_LOADED, NotificationService::AllSources());
+ NotificationType::USER_SCRIPTS_LOADED, NotificationService::AllSources());
}
// When we're started with the --start-renderers-manually flag, we pop up a
@@ -382,7 +384,8 @@ bool BrowserRenderProcessHost::Init() {
bool on_sandbox_desktop = (desktop != NULL);
NotificationService::current()->Notify(
- NOTIFY_RENDERER_PROCESS_IN_SBOX, Source<BrowserRenderProcessHost>(this),
+ NotificationType::RENDERER_PROCESS_IN_SBOX,
+ Source<BrowserRenderProcessHost>(this),
Details<bool>(&on_sandbox_desktop));
ResumeThread(target.hThread);
@@ -392,7 +395,7 @@ bool BrowserRenderProcessHost::Init() {
// Help the process a little. It can't start the debugger by itself if
// the process is in a sandbox.
if (child_needs_help)
- DebugUtil::SpawnDebuggerOnProcess(target.dwProcessId);
+ DebugUtil::SpawnDebuggerOnProcess(target.dwProcessId);
} else
#endif // OS_WIN and sandbox
{
@@ -665,9 +668,10 @@ void BrowserRenderProcessHost::OnChannelError() {
if (!notified_termination_) {
// If |close_expected| is false, it means the renderer process went away
// before the web views expected it; count it as a crash.
- NotificationService::current()->Notify(NOTIFY_RENDERER_PROCESS_TERMINATED,
- Source<RenderProcessHost>(this),
- Details<bool>(&clean_shutdown));
+ NotificationService::current()->Notify(
+ NotificationType::RENDERER_PROCESS_TERMINATED,
+ Source<RenderProcessHost>(this),
+ Details<bool>(&clean_shutdown));
notified_termination_ = true;
}
@@ -744,8 +748,8 @@ void BrowserRenderProcessHost::SetBackgrounded(bool backgrounded) {
void BrowserRenderProcessHost::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_PREF_CHANGED: {
+ switch (type.value) {
+ case NotificationType::PREF_CHANGED: {
std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
DCHECK(Source<PrefService>(source).ptr() == profile()->GetPrefs());
if (*pref_name_in == prefs::kBlockPopups) {
@@ -756,7 +760,7 @@ void BrowserRenderProcessHost::Observe(NotificationType type,
}
break;
}
- case NOTIFY_USER_SCRIPTS_LOADED: {
+ case NotificationType::USER_SCRIPTS_LOADED: {
base::SharedMemory* shared_memory =
Details<base::SharedMemory>(details).ptr();
if (shared_memory) {
diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h
index 70c085c..b4ce17a 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.h
+++ b/chrome/browser/renderer_host/browser_render_process_host.h
@@ -21,7 +21,7 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/renderer_host/render_process_host.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/render_messages.h"
class PrefService;
diff --git a/chrome/browser/renderer_host/render_process_host.cc b/chrome/browser/renderer_host/render_process_host.cc
index 3ec8328..7a9ede0 100644
--- a/chrome/browser/renderer_host/render_process_host.cc
+++ b/chrome/browser/renderer_host/render_process_host.cc
@@ -77,7 +77,7 @@ void RenderProcessHost::Release(int listener_id) {
if (!notified_termination_) {
bool close_expected = true;
NotificationService::current()->Notify(
- NOTIFY_RENDERER_PROCESS_TERMINATED,
+ NotificationType::RENDERER_PROCESS_TERMINATED,
Source<RenderProcessHost>(this),
Details<bool>(&close_expected));
notified_termination_ = true;
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index 5914c74..a163705 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -321,7 +321,7 @@ void RenderWidgetHost::RendererExited() {
void RenderWidgetHost::Destroy() {
NotificationService::current()->Notify(
- NOTIFY_RENDER_WIDGET_HOST_DESTROYED,
+ NotificationType::RENDER_WIDGET_HOST_DESTROYED,
Source<RenderWidgetHost>(this),
NotificationService::NoDetails());
@@ -348,9 +348,10 @@ void RenderWidgetHost::CheckRendererIsUnresponsive() {
}
// OK, looks like we have a hung renderer!
- NotificationService::current()->Notify(NOTIFY_RENDERER_PROCESS_HANG,
- Source<RenderWidgetHost>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::RENDERER_PROCESS_HANG,
+ Source<RenderWidgetHost>(this),
+ NotificationService::NoDetails());
is_unresponsive_ = true;
NotifyRendererUnresponsive();
}
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 50368c0..3882372 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -34,8 +34,7 @@
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/tab_contents/web_contents.h"
-#include "chrome/common/notification_source.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/stl_util-inl.h"
#include "net/base/auth.h"
@@ -1069,10 +1068,10 @@ class NotificationTask : public Task {
if (tab_contents) {
// Issue the notification.
- NotificationService::current()->
- Notify(type_,
- Source<NavigationController>(tab_contents->controller()),
- Details<ResourceRequestDetails>(details_.get()));
+ NotificationService::current()->Notify(
+ type_,
+ Source<NavigationController>(tab_contents->controller()),
+ Details<ResourceRequestDetails>(details_.get()));
}
}
@@ -1110,7 +1109,7 @@ void ResourceDispatcherHost::NotifyResponseStarted(URLRequest* request,
// Notify the observers on the UI thread.
ui_loop_->PostTask(FROM_HERE,
- new NotificationTask(NOTIFY_RESOURCE_RESPONSE_STARTED, request,
+ new NotificationTask(NotificationType::RESOURCE_RESPONSE_STARTED, request,
new ResourceRequestDetails(request,
GetCertID(request, render_process_host_id))));
}
@@ -1124,7 +1123,8 @@ void ResourceDispatcherHost::NotifyResponseCompleted(
// Notify the observers on the UI thread.
ui_loop_->PostTask(FROM_HERE,
- new NotificationTask(NOTIFY_RESOURCE_RESPONSE_COMPLETED, request,
+ new NotificationTask(NotificationType::RESOURCE_RESPONSE_COMPLETED,
+ request,
new ResourceRequestDetails(request,
GetCertID(request, render_process_host_id))));
}
@@ -1140,7 +1140,8 @@ void ResourceDispatcherHost::NofityReceivedRedirect(URLRequest* request,
// Notify the observers on the UI thread.
ui_loop_->PostTask(FROM_HERE,
- new NotificationTask(NOTIFY_RESOURCE_RECEIVED_REDIRECT, request,
+ new NotificationTask(NotificationType::RESOURCE_RECEIVED_REDIRECT,
+ request,
new ResourceRedirectDetails(request,
cert_id,
new_url)));
diff --git a/chrome/browser/repost_form_warning_dialog.cc b/chrome/browser/repost_form_warning_dialog.cc
index 8a88a79..898c6c5 100644
--- a/chrome/browser/repost_form_warning_dialog.cc
+++ b/chrome/browser/repost_form_warning_dialog.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/views/message_box_view.h"
#include "chrome/views/window.h"
@@ -24,9 +25,9 @@ void RepostFormWarningDialog::RunRepostFormWarningDialog(
RepostFormWarningDialog::~RepostFormWarningDialog() {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_LOAD_START, NotificationService::AllSources());
+ this, NotificationType::LOAD_START, NotificationService::AllSources());
NotificationService::current()->RemoveObserver(
- this, NOTIFY_TAB_CLOSING, NotificationService::AllSources());
+ this, NotificationType::TAB_CLOSING, NotificationService::AllSources());
}
//////////////////////////////////////////////////////////////////////////////
@@ -85,10 +86,10 @@ RepostFormWarningDialog::RepostFormWarningDialog(
window()->GetNativeHandle());
}
views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this)->Show();
- NotificationService::current()->
- AddObserver(this, NOTIFY_LOAD_START, NotificationService::AllSources());
- NotificationService::current()->
- AddObserver(this, NOTIFY_TAB_CLOSING, NotificationService::AllSources());
+ NotificationService::current()->AddObserver(
+ this, NotificationType::LOAD_START, NotificationService::AllSources());
+ NotificationService::current()->AddObserver(
+ this, NotificationType::TAB_CLOSING, NotificationService::AllSources());
}
void RepostFormWarningDialog::Observe(NotificationType type,
@@ -98,10 +99,11 @@ void RepostFormWarningDialog::Observe(NotificationType type,
// the same page anymore) or if the tab is closed, because then we won't have
// a navigation controller anymore.
if (window() && navigation_controller_ &&
- (type == NOTIFY_LOAD_START || type == NOTIFY_TAB_CLOSING) &&
+ (type == NotificationType::LOAD_START ||
+ type == NotificationType::TAB_CLOSING) &&
Source<NavigationController>(source).ptr() == navigation_controller_) {
- navigation_controller_ = NULL;
- window()->Close();
- }
+ navigation_controller_ = NULL;
+ window()->Close();
+ }
}
diff --git a/chrome/browser/repost_form_warning_dialog.h b/chrome/browser/repost_form_warning_dialog.h
index 8aeba7b..3e41f63 100644
--- a/chrome/browser/repost_form_warning_dialog.h
+++ b/chrome/browser/repost_form_warning_dialog.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_REPOST_FORM_WARNING_H__
-#define CHROME_BROWSER_REPOST_FORM_WARNING_H__
+#ifndef CHROME_BROWSER_REPOST_FORM_WARNING_H_
+#define CHROME_BROWSER_REPOST_FORM_WARNING_H_
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/views/dialog_delegate.h"
class MessageBoxView;
@@ -50,8 +50,7 @@ class RepostFormWarningDialog : public views::DialogDelegate,
// Navigation controller, used to continue the reload.
NavigationController* navigation_controller_;
- DISALLOW_EVIL_CONSTRUCTORS(RepostFormWarningDialog);
+ DISALLOW_COPY_AND_ASSIGN(RepostFormWarningDialog);
};
-#endif // CHROME_BROWSER_REPOST_FORM_WARNING_H__
-
+#endif // CHROME_BROWSER_REPOST_FORM_WARNING_H_
diff --git a/chrome/browser/resource_message_filter.cc b/chrome/browser/resource_message_filter.cc
index d1d9370..02e6230 100644
--- a/chrome/browser/resource_message_filter.cc
+++ b/chrome/browser/resource_message_filter.cc
@@ -21,6 +21,7 @@
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/chrome_plugin_util.h"
#include "chrome/common/clipboard_service.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/ipc_message_macros.h"
@@ -115,7 +116,8 @@ ResourceMessageFilter::~ResourceMessageFilter() {
DCHECK(MessageLoop::current() ==
ChromeThread::GetMessageLoop(ChromeThread::IO));
NotificationService::current()->RemoveObserver(
- this, NOTIFY_SPELLCHECKER_REINITIALIZED,
+ this,
+ NotificationType::SPELLCHECKER_REINITIALIZED,
Source<Profile>(static_cast<Profile*>(profile_)));
}
@@ -125,14 +127,15 @@ void ResourceMessageFilter::OnFilterAdded(IPC::Channel* channel) {
// Add the observers to intercept
NotificationService::current()->AddObserver(
- this, NOTIFY_SPELLCHECKER_REINITIALIZED,
+ this,
+ NotificationType::SPELLCHECKER_REINITIALIZED,
Source<Profile>(static_cast<Profile*>(profile_)));
}
// Called on the IPC thread:
void ResourceMessageFilter::OnChannelConnected(int32 peer_pid) {
DCHECK(!render_handle_);
- render_handle_ = OpenProcess(PROCESS_DUP_HANDLE|PROCESS_TERMINATE,
+ render_handle_ = OpenProcess(PROCESS_DUP_HANDLE | PROCESS_TERMINATE,
FALSE, peer_pid);
DCHECK(render_handle_);
}
@@ -726,7 +729,7 @@ void ResourceMessageFilter::OnSpellCheck(const std::wstring& word,
void ResourceMessageFilter::Observe(NotificationType type,
const NotificationSource &source,
const NotificationDetails &details) {
- if (type == NOTIFY_SPELLCHECKER_REINITIALIZED) {
+ if (type == NotificationType::SPELLCHECKER_REINITIALIZED) {
spellchecker_ = Details<SpellcheckerReinitializedDetails>
(details).ptr()->spellchecker;
}
diff --git a/chrome/browser/resource_message_filter.h b/chrome/browser/resource_message_filter.h
index 48b4fb8..0d7b67d 100644
--- a/chrome/browser/resource_message_filter.h
+++ b/chrome/browser/resource_message_filter.h
@@ -14,7 +14,7 @@
#include "chrome/browser/net/resolve_proxy_msg_helper.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/common/ipc_channel_proxy.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "webkit/glue/cache_manager.h"
#if defined(OS_WIN)
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index 8313218..84ba46f 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -124,7 +124,7 @@ class OmniBoxUsageObserver : public NotificationObserver {
public:
OmniBoxUsageObserver() {
NotificationService::current()->AddObserver(this,
- NOTIFY_OMNIBOX_OPENED_URL,
+ NotificationType::OMNIBOX_OPENED_URL,
NotificationService::AllSources());
omnibox_used_ = false;
DCHECK(!instance_);
@@ -156,7 +156,7 @@ class OmniBoxUsageObserver : public NotificationObserver {
// Dtor is private so the object cannot be created on the stack.
~OmniBoxUsageObserver() {
NotificationService::current()->RemoveObserver(this,
- NOTIFY_OMNIBOX_OPENED_URL,
+ NotificationType::OMNIBOX_OPENED_URL,
NotificationService::AllSources());
instance_ = NULL;
}
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc
index b328964..bfb9d43 100644
--- a/chrome/browser/search_engines/template_url_model.cc
+++ b/chrome/browser/search_engines/template_url_model.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/stl_util-inl.h"
@@ -92,10 +93,10 @@ TemplateURLModel::~TemplateURLModel() {
NotificationService* ns = NotificationService::current();
if (profile_) {
- ns->RemoveObserver(this, NOTIFY_HISTORY_URL_VISITED,
+ ns->RemoveObserver(this, NotificationType::HISTORY_URL_VISITED,
Source<Profile>(profile_->GetOriginalProfile()));
}
- ns->RemoveObserver(this, NOTIFY_GOOGLE_URL_UPDATED,
+ ns->RemoveObserver(this, NotificationType::GOOGLE_URL_UPDATED,
NotificationService::AllSources());
}
@@ -108,10 +109,10 @@ void TemplateURLModel::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.
- ns->AddObserver(this, NOTIFY_HISTORY_URL_VISITED,
+ ns->AddObserver(this, NotificationType::HISTORY_URL_VISITED,
Source<Profile>(profile_->GetOriginalProfile()));
}
- ns->AddObserver(this, NOTIFY_GOOGLE_URL_UPDATED,
+ ns->AddObserver(this, NotificationType::GOOGLE_URL_UPDATED,
NotificationService::AllSources());
// Add specific initializers, if any.
@@ -686,14 +687,14 @@ void TemplateURLModel::RemoveDuplicatePrepopulateIDs(
void TemplateURLModel::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_HISTORY_URL_VISITED) {
+ if (type == NotificationType::HISTORY_URL_VISITED) {
Details<history::URLVisitedDetails> visit_details(details);
if (!loaded())
visits_to_add_.push_back(visit_details->row);
else
UpdateKeywordSearchTermsForURL(visit_details->row);
- } else if (type == NOTIFY_GOOGLE_URL_UPDATED) {
+ } else if (type == NotificationType::GOOGLE_URL_UPDATED) {
if (loaded_)
GoogleBaseURLChanged();
} else {
@@ -716,9 +717,10 @@ void TemplateURLModel::DeleteGeneratedKeywordsMatchingHost(
}
void TemplateURLModel::NotifyLoaded() {
- NotificationService::current()->
- Notify(TEMPLATE_URL_MODEL_LOADED, Source<TemplateURLModel>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::TEMPLATE_URL_MODEL_LOADED,
+ Source<TemplateURLModel>(this),
+ NotificationService::NoDetails());
}
void TemplateURLModel::MergeEnginesFromPrepopulateData() {
diff --git a/chrome/browser/search_engines/template_url_model.h b/chrome/browser/search_engines/template_url_model.h
index 6b9569b..5bdf73f 100644
--- a/chrome/browser/search_engines/template_url_model.h
+++ b/chrome/browser/search_engines/template_url_model.h
@@ -13,7 +13,7 @@
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/webdata/web_data_service.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
class GURL;
class PrefService;
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index dfb5acd..331a152 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -134,7 +134,8 @@ void TabLoader::LoadTabs() {
void TabLoader::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_TAB_CLOSED || type == NOTIFY_LOAD_STOP);
+ DCHECK(type == NotificationType::TAB_CLOSED ||
+ type == NotificationType::LOAD_STOP);
NavigationController* tab = Source<NavigationController>(source).ptr();
RemoveTab(tab);
if (loading_) {
@@ -158,19 +159,19 @@ void TabLoader::RemoveTab(NavigationController* tab) {
void TabLoader::AddListeners(NavigationController* controller) {
NotificationService::current()->AddObserver(
- this, NOTIFY_TAB_CLOSED,
+ this, NotificationType::TAB_CLOSED,
Source<NavigationController>(controller));
NotificationService::current()->AddObserver(
- this, NOTIFY_LOAD_STOP,
+ this, NotificationType::LOAD_STOP,
Source<NavigationController>(controller));
}
void TabLoader::RemoveListeners(NavigationController* controller) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_TAB_CLOSED,
+ this, NotificationType::TAB_CLOSED,
Source<NavigationController>(controller));
NotificationService::current()->RemoveObserver(
- this, NOTIFY_LOAD_STOP,
+ this, NotificationType::LOAD_STOP,
Source<NavigationController>(controller));
}
@@ -208,8 +209,10 @@ class SessionRestoreImpl : public NotificationObserver {
return;
}
- if (browser_)
- registrar_.Add(this, NOTIFY_BROWSER_CLOSED, Source<Browser>(browser_));
+ if (browser_) {
+ registrar_.Add(this, NotificationType::BROWSER_CLOSED,
+ Source<Browser>(browser_));
+ }
}
~SessionRestoreImpl() {
@@ -218,7 +221,7 @@ class SessionRestoreImpl : public NotificationObserver {
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type != NOTIFY_BROWSER_CLOSED) {
+ if (type != NotificationType::BROWSER_CLOSED) {
NOTREACHED();
return;
}
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 4f5861e..5f060d8 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -24,7 +24,6 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/notification_types.h"
#include "chrome/common/scoped_vector.h"
#include "chrome/common/win_util.h"
@@ -366,17 +365,17 @@ SessionService::Handle SessionService::GetLastSession(
void SessionService::Init() {
// Register for the notifications we're interested in.
- registrar_.Add(this, NOTIFY_TAB_PARENTED,
+ registrar_.Add(this, NotificationType::TAB_PARENTED,
NotificationService::AllSources());
- registrar_.Add(this, NOTIFY_TAB_CLOSED,
+ registrar_.Add(this, NotificationType::TAB_CLOSED,
NotificationService::AllSources());
- registrar_.Add(this, NOTIFY_NAV_LIST_PRUNED,
+ registrar_.Add(this, NotificationType::NAV_LIST_PRUNED,
NotificationService::AllSources());
- registrar_.Add(this, NOTIFY_NAV_ENTRY_CHANGED,
+ registrar_.Add(this, NotificationType::NAV_ENTRY_CHANGED,
NotificationService::AllSources());
- registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
NotificationService::AllSources());
- registrar_.Add(this, NOTIFY_BROWSER_OPENED,
+ registrar_.Add(this, NotificationType::BROWSER_OPENED,
NotificationService::AllSources());
}
@@ -384,8 +383,8 @@ void SessionService::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
// All of our messages have the NavigationController as the source.
- switch (type) {
- case NOTIFY_BROWSER_OPENED: {
+ switch (type.value) {
+ case NotificationType::BROWSER_OPENED: {
Browser* browser = Source<Browser>(source).ptr();
if (browser->profile() != profile() ||
!should_track_changes_for_browser_type(browser->type())) {
@@ -410,21 +409,21 @@ void SessionService::Observe(NotificationType type,
break;
}
- case NOTIFY_TAB_PARENTED: {
+ case NotificationType::TAB_PARENTED: {
NavigationController* controller =
Source<NavigationController>(source).ptr();
SetTabWindow(controller->window_id(), controller->session_id());
break;
}
- case NOTIFY_TAB_CLOSED: {
+ case NotificationType::TAB_CLOSED: {
NavigationController* controller =
Source<NavigationController>(source).ptr();
TabClosed(controller->window_id(), controller->session_id());
break;
}
- case NOTIFY_NAV_LIST_PRUNED: {
+ case NotificationType::NAV_LIST_PRUNED: {
NavigationController* controller =
Source<NavigationController>(source).ptr();
Details<NavigationController::PrunedDetails> pruned_details(details);
@@ -440,7 +439,7 @@ void SessionService::Observe(NotificationType type,
break;
}
- case NOTIFY_NAV_ENTRY_CHANGED: {
+ case NotificationType::NAV_ENTRY_CHANGED: {
NavigationController* controller =
Source<NavigationController>(source).ptr();
Details<NavigationController::EntryChangedDetails> changed(details);
@@ -449,7 +448,7 @@ void SessionService::Observe(NotificationType type,
break;
}
- case NOTIFY_NAV_ENTRY_COMMITTED: {
+ case NotificationType::NAV_ENTRY_COMMITTED: {
NavigationController* controller =
Source<NavigationController>(source).ptr();
int current_entry_index = controller->GetCurrentEntryIndex();
diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h
index 7af43f0..3c2f7fc 100644
--- a/chrome/browser/sessions/session_service.h
+++ b/chrome/browser/sessions/session_service.h
@@ -11,7 +11,7 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/sessions/base_session_service.h"
#include "chrome/browser/sessions/session_id.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
class Browser;
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc
index 96d0003..313908e 100644
--- a/chrome/browser/ssl/ssl_blocking_page.cc
+++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ssl/ssl_blocking_page.h"
#include "base/string_piece.h"
+#include "base/values.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_resources.h"
#include "chrome/browser/cert_store.h"
@@ -15,6 +16,7 @@
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/resource_bundle.h"
@@ -80,7 +82,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(
- NOTIFY_SSL_STATE_CHANGED,
+ NotificationType::SSL_STATE_CHANGED,
Source<NavigationController>(web->controller()),
NotificationService::NoDetails());
}
diff --git a/chrome/browser/ssl/ssl_blocking_page.h b/chrome/browser/ssl/ssl_blocking_page.h
index c3c2289..5ea0658 100644
--- a/chrome/browser/ssl/ssl_blocking_page.h
+++ b/chrome/browser/ssl/ssl_blocking_page.h
@@ -11,6 +11,8 @@
#include "chrome/browser/ssl/ssl_manager.h"
#include "chrome/views/decision.h"
+class DictionaryValue;
+
// This class is responsible for showing/hiding the interstitial page that is
// shown when a certificate error happens.
// It deletes itself when the interstitial page is closed.
diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc
index 49227e2..99440b9 100644
--- a/chrome/browser/ssl/ssl_manager.cc
+++ b/chrome/browser/ssl/ssl_manager.cc
@@ -102,15 +102,15 @@ SSLManager::SSLManager(NavigationController* controller, Delegate* delegate)
delegate_ = SSLPolicy::GetDefaultPolicy();
// Subscribe to various notifications.
- registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(controller_));
- registrar_.Add(this, NOTIFY_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
+ registrar_.Add(this, NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR,
Source<NavigationController>(controller_));
- registrar_.Add(this, NOTIFY_RESOURCE_RESPONSE_STARTED,
+ registrar_.Add(this, NotificationType::RESOURCE_RESPONSE_STARTED,
Source<NavigationController>(controller_));
- registrar_.Add(this, NOTIFY_RESOURCE_RECEIVED_REDIRECT,
+ registrar_.Add(this, NotificationType::RESOURCE_RECEIVED_REDIRECT,
Source<NavigationController>(controller_));
- registrar_.Add(this, NOTIFY_LOAD_FROM_MEMORY_CACHE,
+ registrar_.Add(this, NotificationType::LOAD_FROM_MEMORY_CACHE,
Source<NavigationController>(controller_));
}
@@ -496,27 +496,27 @@ void SSLManager::Observe(NotificationType type,
DCHECK(source == Source<NavigationController>(controller_));
// Dispatch by type.
- switch (type) {
- case NOTIFY_NAV_ENTRY_COMMITTED:
+ switch (type.value) {
+ case NotificationType::NAV_ENTRY_COMMITTED:
DidCommitProvisionalLoad(details);
break;
- case NOTIFY_FAIL_PROVISIONAL_LOAD_WITH_ERROR:
+ case NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR:
DidFailProvisionalLoadWithError(
Details<ProvisionalLoadDetails>(details).ptr());
break;
- case NOTIFY_RESOURCE_RESPONSE_STARTED:
+ case NotificationType::RESOURCE_RESPONSE_STARTED:
DidStartResourceResponse(Details<ResourceRequestDetails>(details).ptr());
break;
- case NOTIFY_RESOURCE_RECEIVED_REDIRECT:
+ case NotificationType::RESOURCE_RECEIVED_REDIRECT:
DidReceiveResourceRedirect(
Details<ResourceRedirectDetails>(details).ptr());
break;
- case NOTIFY_LOAD_FROM_MEMORY_CACHE:
+ case NotificationType::LOAD_FROM_MEMORY_CACHE:
DidLoadFromMemoryCache(
Details<LoadFromMemoryCacheDetails>(details).ptr());
break;
- default:
- NOTREACHED() << "The SSLManager received an unexpected notification.";
+ default:
+ NOTREACHED() << "The SSLManager received an unexpected notification.";
}
}
@@ -613,7 +613,7 @@ void SSLManager::DidCommitProvisionalLoad(
if (changed) {
// Only send the notification when something actually changed.
NotificationService::current()->Notify(
- NOTIFY_SSL_STATE_CHANGED,
+ NotificationType::SSL_STATE_CHANGED,
Source<NavigationController>(controller_),
NotificationService::NoDetails());
}
diff --git a/chrome/browser/ssl/ssl_manager.h b/chrome/browser/ssl/ssl_manager.h
index a58f3fe..3294e42 100644
--- a/chrome/browser/ssl/ssl_manager.h
+++ b/chrome/browser/ssl/ssl_manager.h
@@ -14,8 +14,8 @@
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/tab_contents/provisional_load_details.h"
#include "chrome/browser/tab_contents/security_style.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
-#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
diff --git a/chrome/browser/ssl/ssl_policy.cc b/chrome/browser/ssl/ssl_policy.cc
index 61aada3..1784deb 100644
--- a/chrome/browser/ssl/ssl_policy.cc
+++ b/chrome/browser/ssl/ssl_policy.cc
@@ -258,7 +258,7 @@ class DefaultPolicy : public SSLPolicy {
if (error->manager()->SetMaxSecurityStyle(
SECURITY_STYLE_AUTHENTICATION_BROKEN)) {
NotificationService::current()->Notify(
- NOTIFY_SSL_STATE_CHANGED,
+ NotificationType::SSL_STATE_CHANGED,
Source<NavigationController>(error->manager()->controller()),
Details<NavigationEntry>(
error->manager()->controller()->GetActiveEntry()));
@@ -313,7 +313,7 @@ class DefaultPolicy : public SSLPolicy {
AddMessageToConsole(msg, MESSAGE_LEVEL_WARNING);
NotificationService::current()->Notify(
- NOTIFY_SSL_STATE_CHANGED,
+ NotificationType::SSL_STATE_CHANGED,
Source<NavigationController>(navigation_controller),
Details<NavigationEntry>(entry));
}
@@ -410,7 +410,7 @@ void SSLPolicy::OnRequestStarted(SSLManager* manager, const GURL& url,
if (changed) {
// Only send the notification when something actually changed.
NotificationService::current()->Notify(
- NOTIFY_SSL_STATE_CHANGED,
+ NotificationType::SSL_STATE_CHANGED,
Source<NavigationController>(manager->controller()),
NotificationService::NoDetails());
}
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index 942c126..c7e7d49 100644
--- a/chrome/browser/tab_contents/interstitial_page.cc
+++ b/chrome/browser/tab_contents/interstitial_page.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/browser/tab_contents/web_contents_view_win.h"
+#include "chrome/common/notification_service.h"
#include "chrome/views/window.h"
#include "chrome/views/window_delegate.h"
#include "net/base/escape.h"
@@ -106,7 +107,7 @@ void InterstitialPage::Show() {
// NOTIFY_TAB_CONTENTS_DESTROYED as at that point the RenderViewHost has
// already been destroyed.
notification_registrar_.Add(
- this, NOTIFY_RENDER_WIDGET_HOST_DESTROYED,
+ this, NotificationType::RENDER_WIDGET_HOST_DESTROYED,
Source<RenderWidgetHost>(tab_->render_view_host()));
// Update the tab_to_interstitial_page_ map.
@@ -134,11 +135,11 @@ void InterstitialPage::Show() {
EscapePath(GetHTMLContents());
render_view_host_->NavigateToURL(GURL(data_url));
- notification_registrar_.Add(this, NOTIFY_TAB_CONTENTS_DESTROYED,
+ notification_registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED,
Source<TabContents>(tab_));
- notification_registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ notification_registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(tab_->controller()));
- notification_registrar_.Add(this, NOTIFY_NAV_ENTRY_PENDING,
+ notification_registrar_.Add(this, NotificationType::NAV_ENTRY_PENDING,
Source<NavigationController>(tab_->controller()));
}
@@ -159,8 +160,8 @@ void InterstitialPage::Hide() {
void InterstitialPage::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_NAV_ENTRY_PENDING:
+ switch (type.value) {
+ case NotificationType::NAV_ENTRY_PENDING:
// We are navigating away from the interstitial (the user has typed a URL
// in the location bar or clicked a bookmark). Make sure clicking on the
// interstitial will have no effect. Also cancel any blocked requests
@@ -174,7 +175,7 @@ void InterstitialPage::Observe(NotificationType type,
DCHECK(!resource_dispatcher_host_notified_);
TakeActionOnResourceDispatcher(CANCEL);
break;
- case NOTIFY_RENDER_WIDGET_HOST_DESTROYED:
+ case NotificationType::RENDER_WIDGET_HOST_DESTROYED:
if (!action_taken_) {
// The RenderViewHost is being destroyed (as part of the tab being
// closed), make sure we clear the blocked requests.
@@ -184,8 +185,8 @@ void InterstitialPage::Observe(NotificationType type,
TakeActionOnResourceDispatcher(CANCEL);
}
break;
- case NOTIFY_TAB_CONTENTS_DESTROYED:
- case NOTIFY_NAV_ENTRY_COMMITTED:
+ case NotificationType::TAB_CONTENTS_DESTROYED:
+ case NotificationType::NAV_ENTRY_COMMITTED:
if (!action_taken_) {
// We are navigating away from the interstitial or closing a tab with an
// interstitial. Default to DontProceed(). We don't just call Hide as
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc
index 9fb1be6..af0d810 100644
--- a/chrome/browser/tab_contents/navigation_controller.cc
+++ b/chrome/browser/tab_contents/navigation_controller.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/navigation_types.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/scoped_vector.h"
#include "net/base/net_util.h"
@@ -36,7 +37,7 @@ void NotifyPrunedEntries(NavigationController* nav_controller,
details.from_front = from_front;
details.count = count;
NotificationService::current()->Notify(
- NOTIFY_NAV_LIST_PRUNED,
+ NotificationType::NAV_LIST_PRUNED,
Source<NavigationController>(nav_controller),
Details<NavigationController::PrunedDetails>(&details));
}
@@ -194,9 +195,10 @@ NavigationController::~NavigationController() {
DiscardNonCommittedEntriesInternal();
- NotificationService::current()->Notify(NOTIFY_TAB_CLOSED,
- Source<NavigationController>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::TAB_CLOSED,
+ Source<NavigationController>(this),
+ NotificationService::NoDetails());
}
TabContents* NavigationController::GetTabContents(TabContentsType t) {
@@ -249,7 +251,7 @@ void NavigationController::LoadEntry(NavigationEntry* entry) {
DiscardNonCommittedEntriesInternal();
pending_entry_ = entry;
NotificationService::current()->Notify(
- NOTIFY_NAV_ENTRY_PENDING,
+ NotificationType::NAV_ENTRY_PENDING,
Source<NavigationController>(this),
NotificationService::NoDetails());
NavigateToPendingEntry(false);
@@ -984,7 +986,7 @@ void NavigationController::InsertEntry(NavigationEntry* entry) {
void NavigationController::SetWindowID(const SessionID& id) {
window_id_ = id;
- NotificationService::current()->Notify(NOTIFY_TAB_PARENTED,
+ NotificationService::current()->Notify(NotificationType::TAB_PARENTED,
Source<NavigationController>(this),
NotificationService::NoDetails());
}
@@ -1029,7 +1031,7 @@ void NavigationController::NotifyNavigationEntryCommitted(
details->entry = GetActiveEntry();
NotificationService::current()->Notify(
- NOTIFY_NAV_ENTRY_COMMITTED,
+ NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(this),
Details<LoadCommittedDetails>(details));
}
@@ -1113,7 +1115,7 @@ void NavigationController::NotifyEntryChanged(const NavigationEntry* entry,
EntryChangedDetails det;
det.changed_entry = entry;
det.index = index;
- NotificationService::current()->Notify(NOTIFY_NAV_ENTRY_CHANGED,
+ NotificationService::current()->Notify(NotificationType::NAV_ENTRY_CHANGED,
Source<NavigationController>(this),
Details<EntryChangedDetails>(&det));
}
diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc
index 789bb57..92c1d04 100644
--- a/chrome/browser/tab_contents/render_view_host_manager.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager.cc
@@ -92,7 +92,7 @@ RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) {
details.new_host = render_view_host_;
details.old_host = NULL;
NotificationService::current()->Notify(
- NOTIFY_RENDER_VIEW_HOST_CHANGED,
+ NotificationType::RENDER_VIEW_HOST_CHANGED,
Source<NavigationController>(
delegate_->GetControllerForRenderManager()),
Details<RenderViewHostSwitchedDetails>(&details));
@@ -415,7 +415,7 @@ void RenderViewHostManager::SwapToRenderView(
details.new_host = render_view_host_;
details.old_host = old_render_view_host;
NotificationService::current()->Notify(
- NOTIFY_RENDER_VIEW_HOST_CHANGED,
+ NotificationType::RENDER_VIEW_HOST_CHANGED,
Source<NavigationController>(delegate_->GetControllerForRenderManager()),
Details<RenderViewHostSwitchedDetails>(&details));
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 8afcfef..6db2c86 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/views/native_scroll_bar.h"
@@ -98,9 +99,10 @@ void TabContents::Destroy() {
infobar_delegates_.clear();
// Notify any observer that have a reference on this tab contents.
- NotificationService::current()->Notify(NOTIFY_TAB_CONTENTS_DESTROYED,
- Source<TabContents>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::TAB_CONTENTS_DESTROYED,
+ Source<TabContents>(this),
+ NotificationService::NoDetails());
// If we still have a window handle, destroy it. GetContainerHWND can return
// NULL if this contents was part of a window that closed.
@@ -246,9 +248,10 @@ void TabContents::DidBecomeSelected() {
}
void TabContents::WasHidden() {
- NotificationService::current()->Notify(NOTIFY_TAB_CONTENTS_HIDDEN,
- Source<TabContents>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::TAB_CONTENTS_HIDDEN,
+ Source<TabContents>(this),
+ NotificationService::NoDetails());
}
void TabContents::Activate() {
@@ -413,16 +416,17 @@ void TabContents::AddInfoBar(InfoBarDelegate* delegate) {
}
infobar_delegates_.push_back(delegate);
- NotificationService::current()->Notify(NOTIFY_TAB_CONTENTS_INFOBAR_ADDED,
- Source<TabContents>(this),
- Details<InfoBarDelegate>(delegate));
+ NotificationService::current()->Notify(
+ NotificationType::TAB_CONTENTS_INFOBAR_ADDED,
+ Source<TabContents>(this),
+ Details<InfoBarDelegate>(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 (infobar_delegates_.size() == 1) {
DCHECK(controller());
- registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(controller()));
}
}
@@ -432,14 +436,15 @@ void TabContents::RemoveInfoBar(InfoBarDelegate* delegate) {
find(infobar_delegates_.begin(), infobar_delegates_.end(), delegate);
if (it != infobar_delegates_.end()) {
InfoBarDelegate* delegate = *it;
- NotificationService::current()->Notify(NOTIFY_TAB_CONTENTS_INFOBAR_REMOVED,
- Source<TabContents>(this),
- Details<InfoBarDelegate>(delegate));
+ NotificationService::current()->Notify(
+ NotificationType::TAB_CONTENTS_INFOBAR_REMOVED,
+ Source<TabContents>(this),
+ Details<InfoBarDelegate>(delegate));
infobar_delegates_.erase(it);
// Remove ourselves as an observer if we are tracking no more InfoBars.
if (infobar_delegates_.empty()) {
- registrar_.Remove(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Remove(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(controller()));
}
}
@@ -529,7 +534,7 @@ void TabContents::DidMoveOrResize(ConstrainedWindow* window) {
void TabContents::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_NAV_ENTRY_COMMITTED);
+ DCHECK(type == NotificationType::NAV_ENTRY_COMMITTED);
DCHECK(controller() == Source<NavigationController>(source).ptr());
NavigationController::LoadCommittedDetails& committed_details =
@@ -560,11 +565,14 @@ void TabContents::SetIsLoading(bool is_loading,
if (delegate_)
delegate_->LoadingStateChanged(this);
- NotificationService::current()->
- Notify((is_loading ? NOTIFY_LOAD_START : NOTIFY_LOAD_STOP),
- Source<NavigationController>(this->controller()),
- details ? Details<LoadNotificationDetails>(details) :
- NotificationService::NoDetails());
+ NotificationType type = is_loading ? NotificationType::LOAD_START :
+ NotificationType::LOAD_STOP;
+ NotificationDetails det = details ?
+ Details<LoadNotificationDetails>(details) :
+ NotificationService::NoDetails();
+ NotificationService::current()->Notify(type,
+ Source<NavigationController>(this->controller()),
+ det);
}
// TODO(brettw) This should be on the WebContentsView.
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index 9d6543f..5f82bc0 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -37,6 +37,7 @@
#include "chrome/browser/views/hung_renderer_view.h" // TODO(brettw) delete me.
#include "chrome/common/chrome_switches.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/resource_bundle.h"
@@ -206,14 +207,14 @@ WebContents::WebContents(Profile* profile,
}
// Register for notifications about URL starredness changing on any profile.
- NotificationService::current()->
- AddObserver(this, NOTIFY_URLS_STARRED, NotificationService::AllSources());
- NotificationService::current()->
- AddObserver(this, NOTIFY_BOOKMARK_MODEL_LOADED,
- NotificationService::AllSources());
- NotificationService::current()->
- AddObserver(this, NOTIFY_RENDER_WIDGET_HOST_DESTROYED,
- NotificationService::AllSources());
+ NotificationService::current()->AddObserver(
+ this, NotificationType::URLS_STARRED, NotificationService::AllSources());
+ NotificationService::current()->AddObserver(
+ this, NotificationType::BOOKMARK_MODEL_LOADED,
+ NotificationService::AllSources());
+ NotificationService::current()->AddObserver(
+ this, NotificationType::RENDER_WIDGET_HOST_DESTROYED,
+ NotificationService::AllSources());
}
WebContents::~WebContents() {
@@ -221,9 +222,9 @@ WebContents::~WebContents() {
web_app_->RemoveObserver(this);
if (pending_install_.callback_functor)
pending_install_.callback_functor->Cancel();
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_RENDER_WIDGET_HOST_DESTROYED,
- NotificationService::AllSources());
+ NotificationService::current()->RemoveObserver(
+ this, NotificationType::RENDER_WIDGET_HOST_DESTROYED,
+ NotificationService::AllSources());
}
// static
@@ -300,12 +301,11 @@ PluginInstaller* WebContents::GetPluginInstaller() {
void WebContents::Destroy() {
// Tell the notification service we no longer want notifications.
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_URLS_STARRED,
- NotificationService::AllSources());
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_BOOKMARK_MODEL_LOADED,
- NotificationService::AllSources());
+ NotificationService::current()->RemoveObserver(
+ this, NotificationType::URLS_STARRED, NotificationService::AllSources());
+ NotificationService::current()->RemoveObserver(
+ this, NotificationType::BOOKMARK_MODEL_LOADED,
+ NotificationService::AllSources());
// Destroy the print manager right now since a Print command may be pending.
printing_.Destroy();
@@ -829,10 +829,10 @@ void WebContents::DidStartProvisionalLoadForFrame(
ProvisionalLoadDetails details(is_main_frame,
controller()->IsURLInPageNavigation(url),
url, std::string(), false);
- NotificationService::current()->
- Notify(NOTIFY_FRAME_PROVISIONAL_LOAD_START,
- Source<NavigationController>(controller()),
- Details<ProvisionalLoadDetails>(&details));
+ NotificationService::current()->Notify(
+ NotificationType::FRAME_PROVISIONAL_LOAD_START,
+ Source<NavigationController>(controller()),
+ Details<ProvisionalLoadDetails>(&details));
}
void WebContents::DidRedirectProvisionalLoad(int32 page_id,
@@ -863,10 +863,10 @@ void WebContents::DidLoadResourceFromMemoryCache(
&security_bits);
LoadFromMemoryCacheDetails details(url, cert_id, cert_status);
- NotificationService::current()->
- Notify(NOTIFY_LOAD_FROM_MEMORY_CACHE,
- Source<NavigationController>(controller()),
- Details<LoadFromMemoryCacheDetails>(&details));
+ NotificationService::current()->Notify(
+ NotificationType::LOAD_FROM_MEMORY_CACHE,
+ Source<NavigationController>(controller()),
+ Details<LoadFromMemoryCacheDetails>(&details));
}
void WebContents::DidFailProvisionalLoadWithError(
@@ -918,10 +918,10 @@ void WebContents::DidFailProvisionalLoadWithError(
url, std::string(), false);
details.set_error_code(error_code);
- NotificationService::current()->
- Notify(NOTIFY_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
- Source<NavigationController>(controller()),
- Details<ProvisionalLoadDetails>(&details));
+ NotificationService::current()->Notify(
+ NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR,
+ Source<NavigationController>(controller()),
+ Details<ProvisionalLoadDetails>(&details));
}
void WebContents::UpdateFavIconURL(RenderViewHost* render_view_host,
@@ -957,7 +957,7 @@ void WebContents::DomOperationResponse(const std::string& json_string,
int automation_id) {
DomOperationNotificationDetails details(json_string, automation_id);
NotificationService::current()->Notify(
- NOTIFY_DOM_OPERATION_RESPONSE, Source<WebContents>(this),
+ NotificationType::DOM_OPERATION_RESPONSE, Source<WebContents>(this),
Details<DomOperationNotificationDetails>(&details));
}
@@ -1138,9 +1138,9 @@ void WebContents::PageHasOSDD(RenderViewHost* render_view_host,
void WebContents::InspectElementReply(int num_resources) {
// We have received reply from inspect element request. Notify the
// automation provider in case we need to notify automation client.
- NotificationService::current()->
- Notify(NOTIFY_DOM_INSPECT_ELEMENT_RESPONSE, Source<WebContents>(this),
- Details<int>(&num_resources));
+ NotificationService::current()->Notify(
+ NotificationType::DOM_INSPECT_ELEMENT_RESPONSE, Source<WebContents>(this),
+ Details<int>(&num_resources));
}
void WebContents::DidGetPrintedPagesCount(int cookie, int number_pages) {
@@ -1385,10 +1385,11 @@ bool WebContents::CreateRenderViewForRenderManager(
void WebContents::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_BOOKMARK_MODEL_LOADED: // BookmarkModel finished loading, fall
- // through to update starred state.
- case NOTIFY_URLS_STARRED: { // Somewhere, a URL has been starred.
+ switch (type.value) {
+ case NotificationType::BOOKMARK_MODEL_LOADED:
+ // BookmarkModel finished loading, fall through to update starred state.
+ case NotificationType::URLS_STARRED: {
+ // Somewhere, a URL has been starred.
// Ignore notifications for profiles other than our current one.
Profile* source_profile = Source<Profile>(source).ptr();
if (!source_profile->IsSameProfile(profile()))
@@ -1397,7 +1398,7 @@ void WebContents::Observe(NotificationType type,
UpdateStarredStateForCurrentURL();
break;
}
- case NOTIFY_PREF_CHANGED: {
+ case NotificationType::PREF_CHANGED: {
std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
DCHECK(Source<PrefService>(source).ptr() == profile()->GetPrefs());
if (*pref_name_in == prefs::kAlternateErrorPagesEnabled) {
@@ -1411,7 +1412,7 @@ void WebContents::Observe(NotificationType type,
}
break;
}
- case NOTIFY_RENDER_WIDGET_HOST_DESTROYED:
+ case NotificationType::RENDER_WIDGET_HOST_DESTROYED:
view_->RenderWidgetHostDestroyed(Source<RenderWidgetHost>(source).ptr());
break;
default: {
@@ -1679,18 +1680,18 @@ void WebContents::NotifySwapped() {
// notification so that clients that pick up a pointer to |this| can NULL the
// pointer. See Bug 1230284.
notify_disconnection_ = true;
- NotificationService::current()->
- Notify(NOTIFY_WEB_CONTENTS_SWAPPED,
- Source<WebContents>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::WEB_CONTENTS_SWAPPED,
+ Source<WebContents>(this),
+ NotificationService::NoDetails());
}
void WebContents::NotifyConnected() {
notify_disconnection_ = true;
- NotificationService::current()->
- Notify(NOTIFY_WEB_CONTENTS_CONNECTED,
- Source<WebContents>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::WEB_CONTENTS_CONNECTED,
+ Source<WebContents>(this),
+ NotificationService::NoDetails());
}
void WebContents::NotifyDisconnected() {
@@ -1698,10 +1699,10 @@ void WebContents::NotifyDisconnected() {
return;
notify_disconnection_ = false;
- NotificationService::current()->
- Notify(NOTIFY_WEB_CONTENTS_DISCONNECTED,
- Source<WebContents>(this),
- NotificationService::NoDetails());
+ NotificationService::current()->Notify(
+ NotificationType::WEB_CONTENTS_DISCONNECTED,
+ Source<WebContents>(this),
+ NotificationService::NoDetails());
}
void WebContents::GenerateKeywordIfNecessary(
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 5150938..8c5e8d2 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/tabs/tab_strip_model_order_controller.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/stl_util-inl.h"
///////////////////////////////////////////////////////////////////////////////
@@ -30,7 +31,8 @@ TabStripModel::TabStripModel(TabStripModelDelegate* delegate, Profile* profile)
order_controller_(NULL) {
DCHECK(delegate_);
NotificationService::current()->AddObserver(this,
- NOTIFY_TAB_CONTENTS_DESTROYED, NotificationService::AllSources());
+ NotificationType::TAB_CONTENTS_DESTROYED,
+ NotificationService::AllSources());
SetOrderController(new TabStripModelOrderController(this));
}
@@ -38,7 +40,8 @@ TabStripModel::~TabStripModel() {
STLDeleteContainerPointers(contents_data_.begin(), contents_data_.end());
delete order_controller_;
NotificationService::current()->RemoveObserver(this,
- NOTIFY_TAB_CONTENTS_DESTROYED, NotificationService::AllSources());
+ NotificationType::TAB_CONTENTS_DESTROYED,
+ NotificationService::AllSources());
}
void TabStripModel::AddObserver(TabStripModelObserver* observer) {
@@ -482,7 +485,7 @@ std::vector<int> TabStripModel::GetIndexesOpenedBy(int index) const {
void TabStripModel::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_TAB_CONTENTS_DESTROYED);
+ DCHECK(type == NotificationType::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.
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index a6bf00f..9183b1b 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -8,7 +8,7 @@
#include <vector>
#include "base/observer_list.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/page_transition_types.h"
namespace gfx {
diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc
index 8576471..c0e94c9 100644
--- a/chrome/browser/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager_resource_providers.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/resource_message_filter.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/tab_contents/web_contents.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/stl_util-inl.h"
#include "chrome/common/gfx/icon_util.h"
@@ -139,11 +140,11 @@ void TaskManagerWebContentsResourceProvider::StartUpdating() {
}
// Then we register for notifications to get new tabs.
NotificationService* service = NotificationService::current();
- service->AddObserver(this, NOTIFY_WEB_CONTENTS_CONNECTED,
+ service->AddObserver(this, NotificationType::WEB_CONTENTS_CONNECTED,
NotificationService::AllSources());
- service->AddObserver(this, NOTIFY_WEB_CONTENTS_SWAPPED,
+ service->AddObserver(this, NotificationType::WEB_CONTENTS_SWAPPED,
NotificationService::AllSources());
- service->AddObserver(this, NOTIFY_WEB_CONTENTS_DISCONNECTED,
+ service->AddObserver(this, NotificationType::WEB_CONTENTS_DISCONNECTED,
NotificationService::AllSources());
}
@@ -153,11 +154,11 @@ void TaskManagerWebContentsResourceProvider::StopUpdating() {
// Then we unregister for notifications to get new tabs.
NotificationService* service = NotificationService::current();
- service->RemoveObserver(this, NOTIFY_WEB_CONTENTS_CONNECTED,
+ service->RemoveObserver(this, NotificationType::WEB_CONTENTS_CONNECTED,
NotificationService::AllSources());
- service->RemoveObserver(this, NOTIFY_WEB_CONTENTS_SWAPPED,
+ service->RemoveObserver(this, NotificationType::WEB_CONTENTS_SWAPPED,
NotificationService::AllSources());
- service->RemoveObserver(this, NOTIFY_WEB_CONTENTS_DISCONNECTED,
+ service->RemoveObserver(this, NotificationType::WEB_CONTENTS_DISCONNECTED,
NotificationService::AllSources());
// Delete all the resources.
@@ -221,15 +222,15 @@ void TaskManagerWebContentsResourceProvider::Remove(WebContents* web_contents) {
void TaskManagerWebContentsResourceProvider::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_WEB_CONTENTS_CONNECTED:
+ switch (type.value) {
+ case NotificationType::WEB_CONTENTS_CONNECTED:
Add(Source<WebContents>(source).ptr());
break;
- case NOTIFY_WEB_CONTENTS_SWAPPED:
+ case NotificationType::WEB_CONTENTS_SWAPPED:
Remove(Source<WebContents>(source).ptr());
Add(Source<WebContents>(source).ptr());
break;
- case NOTIFY_WEB_CONTENTS_DISCONNECTED:
+ case NotificationType::WEB_CONTENTS_DISCONNECTED:
Remove(Source<WebContents>(source).ptr());
break;
default:
@@ -320,9 +321,9 @@ void TaskManagerPluginProcessResourceProvider::StartUpdating() {
// Register for notifications to get new plugin processes.
NotificationService* service = NotificationService::current();
- service->AddObserver(this, NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED,
+ service->AddObserver(this, NotificationType::PLUGIN_PROCESS_HOST_CONNECTED,
NotificationService::AllSources());
- service->AddObserver(this, NOTIFY_PLUGIN_PROCESS_HOST_DISCONNECTED,
+ service->AddObserver(this, NotificationType::PLUGIN_PROCESS_HOST_DISCONNECTED,
NotificationService::AllSources());
// Get the existing plugins
@@ -337,9 +338,10 @@ void TaskManagerPluginProcessResourceProvider::StopUpdating() {
// Unregister for notifications to get new plugin processes.
NotificationService* service = NotificationService::current();
- service->RemoveObserver(this, NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED,
+ service->RemoveObserver(this, NotificationType::PLUGIN_PROCESS_HOST_CONNECTED,
NotificationService::AllSources());
- service->RemoveObserver(this, NOTIFY_PLUGIN_PROCESS_HOST_DISCONNECTED,
+ service->RemoveObserver(this,
+ NotificationType::PLUGIN_PROCESS_HOST_DISCONNECTED,
NotificationService::AllSources());
// Delete all the resources.
@@ -354,11 +356,11 @@ void TaskManagerPluginProcessResourceProvider::Observe(
NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED:
+ switch (type.value) {
+ case NotificationType::PLUGIN_PROCESS_HOST_CONNECTED:
Add(*Details<PluginProcessInfo>(details).ptr());
break;
- case NOTIFY_PLUGIN_PROCESS_HOST_DISCONNECTED:
+ case NotificationType::PLUGIN_PROCESS_HOST_DISCONNECTED:
Remove(*Details<PluginProcessInfo>(details).ptr());
break;
default:
diff --git a/chrome/browser/task_manager_resource_providers.h b/chrome/browser/task_manager_resource_providers.h
index bece876..2fb0820 100644
--- a/chrome/browser/task_manager_resource_providers.h
+++ b/chrome/browser/task_manager_resource_providers.h
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H__
-#define CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H__
+#ifndef CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_
+#define CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_
#include "base/basictypes.h"
#include "chrome/browser/plugin_process_info.h"
#include "chrome/browser/task_manager.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
class PluginProcessHost;
class WebContents;
@@ -35,7 +35,7 @@ class TaskManagerWebContentsResource : public TaskManager::Resource {
HANDLE process_;
int pid_;
- DISALLOW_EVIL_CONSTRUCTORS(TaskManagerWebContentsResource);
+ DISALLOW_COPY_AND_ASSIGN(TaskManagerWebContentsResource);
};
class TaskManagerWebContentsResourceProvider
@@ -72,7 +72,7 @@ class TaskManagerWebContentsResourceProvider
// resources.
std::map<WebContents*, TaskManagerWebContentsResource*> resources_;
- DISALLOW_EVIL_CONSTRUCTORS(TaskManagerWebContentsResourceProvider);
+ DISALLOW_COPY_AND_ASSIGN(TaskManagerWebContentsResourceProvider);
};
class TaskManagerPluginProcessResource : public TaskManager::Resource {
@@ -107,7 +107,7 @@ class TaskManagerPluginProcessResource : public TaskManager::Resource {
// plugins.
static SkBitmap* default_icon_;
- DISALLOW_EVIL_CONSTRUCTORS(TaskManagerPluginProcessResource);
+ DISALLOW_COPY_AND_ASSIGN(TaskManagerPluginProcessResource);
};
class TaskManagerPluginProcessResourceProvider
@@ -159,7 +159,7 @@ class TaskManagerPluginProcessResourceProvider
// byte read notifications).
std::map<int, TaskManagerPluginProcessResource*> pid_to_resources_;
- DISALLOW_EVIL_CONSTRUCTORS(TaskManagerPluginProcessResourceProvider);
+ DISALLOW_COPY_AND_ASSIGN(TaskManagerPluginProcessResourceProvider);
};
class TaskManagerBrowserProcessResource : public TaskManager::Resource {
@@ -191,7 +191,7 @@ class TaskManagerBrowserProcessResource : public TaskManager::Resource {
static SkBitmap* default_icon_;
- DISALLOW_EVIL_CONSTRUCTORS(TaskManagerBrowserProcessResource);
+ DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResource);
};
class TaskManagerBrowserProcessResourceProvider
@@ -217,8 +217,7 @@ class TaskManagerBrowserProcessResourceProvider
TaskManager* task_manager_;
TaskManagerBrowserProcessResource resource_;
- DISALLOW_EVIL_CONSTRUCTORS(TaskManagerBrowserProcessResourceProvider);
+ DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider);
};
-#endif // CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H__
-
+#endif // CHROME_BROWSER_TASK_MANAGER_RESOURCE_PROVIDERS_H_
diff --git a/chrome/browser/views/blocked_popup_container.cc b/chrome/browser/views/blocked_popup_container.cc
index 0ec1dd0..b7cb046 100644
--- a/chrome/browser/views/blocked_popup_container.cc
+++ b/chrome/browser/views/blocked_popup_container.cc
@@ -18,6 +18,7 @@
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/gfx/path.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/views/background.h"
@@ -318,7 +319,7 @@ void BlockedPopupContainer::CloseConstrainedWindow() {
// Broadcast to all observers of NOTIFY_CWINDOW_CLOSED.
// One example of such an observer is AutomationCWindowTracker in the
// automation component.
- NotificationService::current()->Notify(NOTIFY_CWINDOW_CLOSED,
+ NotificationService::current()->Notify(NotificationType::CWINDOW_CLOSED,
Source<ConstrainedWindow>(this),
NotificationService::NoDetails());
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index 438bb34..f1f8d3e 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -30,7 +30,6 @@
#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/notification_types.h"
#include "chrome/common/os_exchange_data.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/pref_names.h"
@@ -667,7 +666,8 @@ void BookmarkBarView::ToggleWhenVisible(Profile* profile) {
// And notify the notification service.
Source<Profile> source(profile);
NotificationService::current()->Notify(
- NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, source,
+ NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
+ source,
NotificationService::NoDetails());
}
@@ -736,9 +736,9 @@ void BookmarkBarView::SetProfile(Profile* profile) {
NotificationService* ns = NotificationService::current();
Source<Profile> ns_source(profile_->GetOriginalProfile());
- ns->AddObserver(this, NOTIFY_BOOKMARK_BUBBLE_SHOWN, ns_source);
- ns->AddObserver(this, NOTIFY_BOOKMARK_BUBBLE_HIDDEN, ns_source);
- ns->AddObserver(this, NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
+ ns->AddObserver(this, NotificationType::BOOKMARK_BUBBLE_SHOWN, ns_source);
+ ns->AddObserver(this, NotificationType::BOOKMARK_BUBBLE_HIDDEN, ns_source);
+ ns->AddObserver(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
NotificationService::AllSources());
model_ = profile_->GetBookmarkModel();
@@ -1525,8 +1525,8 @@ void BookmarkBarView::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK(profile_);
- switch (type) {
- case NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED:
+ switch (type.value) {
+ case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED:
if (IsAlwaysShown()) {
size_animation_->Show();
} else {
@@ -1534,13 +1534,13 @@ void BookmarkBarView::Observe(NotificationType type,
}
break;
- case NOTIFY_BOOKMARK_BUBBLE_SHOWN:
+ case NotificationType::BOOKMARK_BUBBLE_SHOWN:
StopThrobbing(true);
bubble_url_ = *(Details<GURL>(details).ptr());
StartThrobbing();
break;
- case NOTIFY_BOOKMARK_BUBBLE_HIDDEN:
+ case NotificationType::BOOKMARK_BUBBLE_HIDDEN:
StopThrobbing(false);
bubble_url_ = GURL();
break;
@@ -1550,9 +1550,10 @@ void BookmarkBarView::Observe(NotificationType type,
void BookmarkBarView::RemoveNotificationObservers() {
NotificationService* ns = NotificationService::current();
Source<Profile> ns_source(profile_->GetOriginalProfile());
- ns->RemoveObserver(this, NOTIFY_BOOKMARK_BUBBLE_SHOWN, ns_source);
- ns->RemoveObserver(this, NOTIFY_BOOKMARK_BUBBLE_HIDDEN, ns_source);
- ns->RemoveObserver(this, NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
+ ns->RemoveObserver(this, NotificationType::BOOKMARK_BUBBLE_SHOWN, ns_source);
+ ns->RemoveObserver(this, NotificationType::BOOKMARK_BUBBLE_HIDDEN, ns_source);
+ ns->RemoveObserver(this,
+ NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
NotificationService::AllSources());
}
diff --git a/chrome/browser/views/bookmark_bubble_view.cc b/chrome/browser/views/bookmark_bubble_view.cc
index 792b6e0..ac8d572 100644
--- a/chrome/browser/views/bookmark_bubble_view.cc
+++ b/chrome/browser/views/bookmark_bubble_view.cc
@@ -122,7 +122,7 @@ void BookmarkBubbleView::Show(HWND parent,
InfoBubble::Show(parent, bounds, view, view);
GURL url_ptr(url);
NotificationService::current()->Notify(
- NOTIFY_BOOKMARK_BUBBLE_SHOWN,
+ NotificationType::BOOKMARK_BUBBLE_SHOWN,
Source<Profile>(profile->GetOriginalProfile()),
Details<GURL>(&url_ptr));
view->BubbleShown();
@@ -320,7 +320,7 @@ void BookmarkBubbleView::InfoBubbleClosing(InfoBubble* info_bubble,
if (delegate_)
delegate_->InfoBubbleClosing(info_bubble, closed_by_escape);
NotificationService::current()->Notify(
- NOTIFY_BOOKMARK_BUBBLE_HIDDEN,
+ NotificationType::BOOKMARK_BUBBLE_HIDDEN,
Source<Profile>(profile_->GetOriginalProfile()),
NotificationService::NoDetails());
}
diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc
index dac5356..2cae93d 100644
--- a/chrome/browser/views/constrained_window_impl.cc
+++ b/chrome/browser/views/constrained_window_impl.cc
@@ -22,6 +22,7 @@
#include "chrome/common/gfx/path.h"
#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/resource_bundle.h"
@@ -624,7 +625,7 @@ void ConstrainedWindowImpl::CloseConstrainedWindow() {
// Broadcast to all observers of NOTIFY_CWINDOW_CLOSED.
// One example of such an observer is AutomationCWindowTracker in the
// automation component.
- NotificationService::current()->Notify(NOTIFY_CWINDOW_CLOSED,
+ NotificationService::current()->Notify(NotificationType::CWINDOW_CLOSED,
Source<ConstrainedWindow>(this),
NotificationService::NoDetails());
diff --git a/chrome/browser/views/download_started_animation.cc b/chrome/browser/views/download_started_animation.cc
index b08b1c3..e09debc 100644
--- a/chrome/browser/views/download_started_animation.cc
+++ b/chrome/browser/views/download_started_animation.cc
@@ -6,6 +6,7 @@
#include "chrome/app/theme/theme_resources.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/views/widget_win.h"
@@ -36,10 +37,14 @@ DownloadStartedAnimation::DownloadStartedAnimation(TabContents* tab_contents)
if (tab_contents_bounds_.height() < kDownloadImage->height())
return;
- NotificationService::current()->AddObserver(this, NOTIFY_TAB_CONTENTS_HIDDEN,
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::TAB_CONTENTS_HIDDEN,
+ Source<TabContents>(tab_contents_));
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::TAB_CONTENTS_DESTROYED,
Source<TabContents>(tab_contents_));
- NotificationService::current()->AddObserver(this,
- NOTIFY_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_));
SetImage(kDownloadImage);
@@ -76,10 +81,14 @@ void DownloadStartedAnimation::Close() {
if (!tab_contents_)
return;
- NotificationService::current()->RemoveObserver(this,
- NOTIFY_TAB_CONTENTS_HIDDEN, Source<TabContents>(tab_contents_));
- NotificationService::current()->RemoveObserver(this,
- NOTIFY_TAB_CONTENTS_DESTROYED, Source<TabContents>(tab_contents_));
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::TAB_CONTENTS_HIDDEN,
+ Source<TabContents>(tab_contents_));
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::TAB_CONTENTS_DESTROYED,
+ Source<TabContents>(tab_contents_));
tab_contents_ = NULL;
popup_->Close();
}
diff --git a/chrome/browser/views/download_started_animation.h b/chrome/browser/views/download_started_animation.h
index c097ca9..e083d67 100644
--- a/chrome/browser/views/download_started_animation.h
+++ b/chrome/browser/views/download_started_animation.h
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_VIEWS_DOWNLOAD_STARTED_ANIMATION_H__
-#define CHROME_BROWSER_VIEWS_DOWNLOAD_STARTED_ANIMATION_H__
+#ifndef CHROME_BROWSER_VIEWS_DOWNLOAD_STARTED_ANIMATION_H_
+#define CHROME_BROWSER_VIEWS_DOWNLOAD_STARTED_ANIMATION_H_
#include "base/gfx/rect.h"
#include "chrome/common/animation.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/views/image_view.h"
namespace views {
@@ -54,8 +54,7 @@ class DownloadStartedAnimation : public Animation,
// much heartbreak.
gfx::Rect tab_contents_bounds_;
- DISALLOW_EVIL_CONSTRUCTORS(DownloadStartedAnimation);
+ DISALLOW_COPY_AND_ASSIGN(DownloadStartedAnimation);
};
-#endif // CHROME_BROWSER_VIEWS_DOWNLOAD_STARTED_ANIMATION_H__
-
+#endif // CHROME_BROWSER_VIEWS_DOWNLOAD_STARTED_ANIMATION_H_
diff --git a/chrome/browser/views/download_tab_view.cc b/chrome/browser/views/download_tab_view.cc
index c17c126..3b35e6e 100644
--- a/chrome/browser/views/download_tab_view.cc
+++ b/chrome/browser/views/download_tab_view.cc
@@ -22,6 +22,7 @@
#include "chrome/common/gfx/chrome_font.h"
#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/stl_util-inl.h"
#include "chrome/common/time_format.h"
@@ -1241,9 +1242,9 @@ DownloadTabUI::DownloadTabUI(NativeUIContents* contents)
download_tab_view_->Initialize();
NotificationService* ns = NotificationService::current();
- ns->AddObserver(this, NOTIFY_DOWNLOAD_START,
+ ns->AddObserver(this, NotificationType::DOWNLOAD_START,
NotificationService::AllSources());
- ns->AddObserver(this, NOTIFY_DOWNLOAD_STOP,
+ ns->AddObserver(this, NotificationType::DOWNLOAD_STOP,
NotificationService::AllSources());
// Spin the throbber if there are active downloads, since we may have been
@@ -1259,9 +1260,9 @@ DownloadTabUI::DownloadTabUI(NativeUIContents* contents)
DownloadTabUI::~DownloadTabUI() {
NotificationService* ns = NotificationService::current();
- ns->RemoveObserver(this, NOTIFY_DOWNLOAD_START,
+ ns->RemoveObserver(this, NotificationType::DOWNLOAD_START,
NotificationService::AllSources());
- ns->RemoveObserver(this, NOTIFY_DOWNLOAD_STOP,
+ ns->RemoveObserver(this, NotificationType::DOWNLOAD_STOP,
NotificationService::AllSources());
}
@@ -1326,9 +1327,9 @@ void DownloadTabUI::DoSearch(const std::wstring& new_text) {
void DownloadTabUI::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- switch (type) {
- case NOTIFY_DOWNLOAD_START:
- case NOTIFY_DOWNLOAD_STOP:
+ switch (type.value) {
+ case NotificationType::DOWNLOAD_START:
+ case NotificationType::DOWNLOAD_STOP:
DCHECK(profile()->HasCreatedDownloadManager());
contents_->SetIsLoading(
profile()->GetDownloadManager()->in_progress_count() > 0,
diff --git a/chrome/browser/views/find_bar_win.cc b/chrome/browser/views/find_bar_win.cc
index e85bd3e..2d1d1c2 100644
--- a/chrome/browser/views/find_bar_win.cc
+++ b/chrome/browser/views/find_bar_win.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/views/find_bar_view.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/browser/tab_contents/web_contents_view.h"
+#include "chrome/common/notification_service.h"
#include "chrome/views/external_focus_tracker.h"
#include "chrome/views/native_scroll_bar.h"
#include "chrome/views/root_view.h"
@@ -439,7 +440,7 @@ void FindBarWin::OnFindReply(int request_id,
active_match_ordinal,
final_update);
NotificationService::current()->Notify(
- NOTIFY_FIND_RESULT_AVAILABLE,
+ NotificationType::FIND_RESULT_AVAILABLE,
Source<TabContents>(parent_tab_->GetWebContents()),
Details<FindNotificationDetails>(&detail));
}
diff --git a/chrome/browser/views/find_bar_win_unittest.cc b/chrome/browser/views/find_bar_win_unittest.cc
index 0112696..c80e26d 100644
--- a/chrome/browser/views/find_bar_win_unittest.cc
+++ b/chrome/browser/views/find_bar_win_unittest.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/browser/tab_contents/web_contents_view.h"
#include "chrome/browser/views/find_bar_win.h"
+#include "chrome/common/notification_service.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
@@ -25,7 +26,7 @@ class FindInPageNotificationObserver : public NotificationObserver {
: parent_tab_(parent_tab),
active_match_ordinal_(-1),
number_of_matches_(0) {
- registrar_.Add(this, NOTIFY_FIND_RESULT_AVAILABLE,
+ registrar_.Add(this, NotificationType::FIND_RESULT_AVAILABLE,
Source<TabContents>(parent_tab_));
ui_test_utils::RunMessageLoop();
}
@@ -36,7 +37,7 @@ class FindInPageNotificationObserver : public NotificationObserver {
virtual void Observe(NotificationType type, const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_FIND_RESULT_AVAILABLE) {
+ if (type == NotificationType::FIND_RESULT_AVAILABLE) {
Details<FindNotificationDetails> find_details(details);
if (find_details->request_id() == kFindInPageRequestId) {
// We get multiple responses and one of those will contain the ordinal.
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 080c044..3d08372 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -663,7 +663,7 @@ LocationBarView* BrowserView::GetLocationBarView() const {
void BrowserView::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_PREF_CHANGED &&
+ if (type == NotificationType::PREF_CHANGED &&
*Details<std::wstring>(details).ptr() == prefs::kShowBookmarkBar) {
if (MaybeShowBookmarkBar(browser_->GetSelectedTabContents()))
Layout();
@@ -874,7 +874,8 @@ bool BrowserView::CanClose() const {
// Empty TabStripModel, it's now safe to allow the Window to be closed.
NotificationService::current()->Notify(
- NOTIFY_WINDOW_CLOSED, Source<HWND>(frame_->GetWindow()->GetHWND()),
+ NotificationType::WINDOW_CLOSED,
+ Source<HWND>(frame_->GetWindow()->GetHWND()),
NotificationService::NoDetails());
return true;
}
diff --git a/chrome/browser/views/infobars/infobar_container.cc b/chrome/browser/views/infobars/infobar_container.cc
index d3d007f..35d7f7a 100644
--- a/chrome/browser/views/infobars/infobar_container.cc
+++ b/chrome/browser/views/infobars/infobar_container.cc
@@ -8,14 +8,13 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/infobars/infobars.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_service.h"
// InfoBarContainer, public: ---------------------------------------------------
InfoBarContainer::InfoBarContainer(BrowserView* browser_view)
: browser_view_(browser_view),
tab_contents_(NULL) {
-
}
InfoBarContainer::~InfoBarContainer() {
@@ -29,10 +28,10 @@ InfoBarContainer::~InfoBarContainer() {
void InfoBarContainer::ChangeTabContents(TabContents* contents) {
if (tab_contents_) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_TAB_CONTENTS_INFOBAR_ADDED,
+ this, NotificationType::TAB_CONTENTS_INFOBAR_ADDED,
Source<TabContents>(tab_contents_));
NotificationService::current()->RemoveObserver(
- this, NOTIFY_TAB_CONTENTS_INFOBAR_REMOVED,
+ this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED,
Source<TabContents>(tab_contents_));
}
// No need to delete the child views here, their removal from the view
@@ -42,10 +41,10 @@ void InfoBarContainer::ChangeTabContents(TabContents* contents) {
if (tab_contents_) {
UpdateInfoBars();
NotificationService::current()->AddObserver(
- this, NOTIFY_TAB_CONTENTS_INFOBAR_ADDED,
+ this, NotificationType::TAB_CONTENTS_INFOBAR_ADDED,
Source<TabContents>(tab_contents_));
NotificationService::current()->AddObserver(
- this, NOTIFY_TAB_CONTENTS_INFOBAR_REMOVED,
+ this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED,
Source<TabContents>(tab_contents_));
}
}
@@ -96,9 +95,9 @@ void InfoBarContainer::ViewHierarchyChanged(bool is_add,
void InfoBarContainer::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_TAB_CONTENTS_INFOBAR_ADDED) {
+ if (type == NotificationType::TAB_CONTENTS_INFOBAR_ADDED) {
AddInfoBar(Details<InfoBarDelegate>(details).ptr());
- } else if (type == NOTIFY_TAB_CONTENTS_INFOBAR_REMOVED) {
+ } else if (type == NotificationType::TAB_CONTENTS_INFOBAR_REMOVED) {
RemoveInfoBar(Details<InfoBarDelegate>(details).ptr());
} else {
NOTREACHED();
diff --git a/chrome/browser/views/infobars/infobar_container.h b/chrome/browser/views/infobars/infobar_container.h
index 43c5280..181d95e 100644
--- a/chrome/browser/views/infobars/infobar_container.h
+++ b/chrome/browser/views/infobars/infobar_container.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_
#define CHROME_BROWSER_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/views/view.h"
class BrowserView;
diff --git a/chrome/browser/views/options/options_page_view.cc b/chrome/browser/views/options/options_page_view.cc
index e1eff1c..61a8977 100644
--- a/chrome/browser/views/options/options_page_view.cc
+++ b/chrome/browser/views/options/options_page_view.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/user_metrics.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_service.h"
#include "chrome/views/widget.h"
@@ -33,7 +34,7 @@ void OptionsPageView::UserMetricsRecordAction(const wchar_t* action,
void OptionsPageView::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_PREF_CHANGED)
+ if (type == NotificationType::PREF_CHANGED)
NotifyPrefChanged(Details<std::wstring>(details).ptr());
}
diff --git a/chrome/browser/views/options/options_page_view.h b/chrome/browser/views/options/options_page_view.h
index d60b0d4..f9e5110 100644
--- a/chrome/browser/views/options/options_page_view.h
+++ b/chrome/browser/views/options/options_page_view.h
@@ -7,7 +7,7 @@
#include "chrome/browser/options_window.h"
#include "chrome/browser/profile.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/views/link.h"
#include "chrome/views/native_button.h"
diff --git a/chrome/browser/views/tab_contents_container_view.cc b/chrome/browser/views/tab_contents_container_view.cc
index 2fb25a1..3228dba 100644
--- a/chrome/browser/views/tab_contents_container_view.cc
+++ b/chrome/browser/views/tab_contents_container_view.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/browser/view_ids.h"
+#include "chrome/common/notification_service.h"
#include "chrome/views/root_view.h"
#include "chrome/views/widget.h"
@@ -186,12 +187,12 @@ bool TabContentsContainerView::ShouldLookupAccelerators(
void TabContentsContainerView::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_RENDER_VIEW_HOST_CHANGED) {
+ if (type == NotificationType::RENDER_VIEW_HOST_CHANGED) {
RenderViewHostSwitchedDetails* switched_details =
Details<RenderViewHostSwitchedDetails>(details).ptr();
RenderViewHostChanged(switched_details->old_host,
switched_details->new_host);
- } else if (type == NOTIFY_TAB_CONTENTS_DESTROYED) {
+ } else if (type == NotificationType::TAB_CONTENTS_DESTROYED) {
TabContentsDestroyed(Source<TabContents>(source).ptr());
} else {
NOTREACHED();
@@ -205,11 +206,12 @@ void TabContentsContainerView::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.
NotificationService::current()->AddObserver(
- this, NOTIFY_RENDER_VIEW_HOST_CHANGED,
+ this, NotificationType::RENDER_VIEW_HOST_CHANGED,
Source<NavigationController>(tab_contents_->controller()));
}
NotificationService::current()->AddObserver(
- this, NOTIFY_TAB_CONTENTS_DESTROYED,
+ this,
+ NotificationType::TAB_CONTENTS_DESTROYED,
Source<TabContents>(tab_contents_));
}
@@ -217,11 +219,13 @@ void TabContentsContainerView::RemoveObservers() {
DCHECK(tab_contents_);
if (tab_contents_->AsWebContents()) {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_RENDER_VIEW_HOST_CHANGED,
+ this,
+ NotificationType::RENDER_VIEW_HOST_CHANGED,
Source<NavigationController>(tab_contents_->controller()));
}
NotificationService::current()->RemoveObserver(
- this, NOTIFY_TAB_CONTENTS_DESTROYED,
+ this,
+ NotificationType::TAB_CONTENTS_DESTROYED,
Source<TabContents>(tab_contents_));
}
diff --git a/chrome/browser/views/tab_contents_container_view.h b/chrome/browser/views/tab_contents_container_view.h
index 46a1a9b..2aa67d5 100644
--- a/chrome/browser/views/tab_contents_container_view.h
+++ b/chrome/browser/views/tab_contents_container_view.h
@@ -12,7 +12,7 @@ class View;
class RenderViewHost;
class TabContents;
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/views/focus_manager.h"
#include "chrome/views/hwnd_view.h"
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc
index 4d35ad8..7464b92 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/views/tabs/dragged_tab_controller.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/views/tabs/tab_strip.h"
#include "chrome/browser/tab_contents/web_contents.h"
#include "chrome/common/animation.h"
+#include "chrome/common/notification_service.h"
#include "chrome/views/event.h"
#include "chrome/views/root_view.h"
#include "skia/include/SkBitmap.h"
@@ -488,7 +489,7 @@ void DraggedTabController::UpdateTargetURL(TabContents* source,
void DraggedTabController::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_TAB_CONTENTS_DESTROYED);
+ DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED);
DCHECK(Source<TabContents>(source).ptr() == dragged_contents_);
EndDragImpl(TAB_DESTROYED);
}
@@ -561,18 +562,20 @@ void DraggedTabController::UpdateDockInfo(const gfx::Point& screen_point) {
void DraggedTabController::ChangeDraggedContents(TabContents* new_contents) {
if (dragged_contents_) {
- NotificationService::current()->RemoveObserver(this,
- NOTIFY_TAB_CONTENTS_DESTROYED,
- Source<TabContents>(dragged_contents_));
+ NotificationService::current()->RemoveObserver(
+ this,
+ NotificationType::TAB_CONTENTS_DESTROYED,
+ Source<TabContents>(dragged_contents_));
if (original_delegate_)
dragged_contents_->set_delegate(original_delegate_);
}
original_delegate_ = NULL;
dragged_contents_ = new_contents;
if (dragged_contents_) {
- NotificationService::current()->AddObserver(this,
- NOTIFY_TAB_CONTENTS_DESTROYED,
- Source<TabContents>(dragged_contents_));
+ NotificationService::current()->AddObserver(
+ this,
+ NotificationType::TAB_CONTENTS_DESTROYED,
+ Source<TabContents>(dragged_contents_));
// We need to be the delegate so we receive messages about stuff,
// otherwise our dragged_contents() may be replaced and subsequently
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.h b/chrome/browser/views/tabs/dragged_tab_controller.h
index 5c9730a..b03b0cb 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.h
+++ b/chrome/browser/views/tabs/dragged_tab_controller.h
@@ -12,7 +12,7 @@
#include "chrome/browser/tab_contents/tab_contents_delegate.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/views/tabs/tab_renderer.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
namespace views {
class MouseEvent;
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index aed2a73..8ceb421 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -787,7 +787,7 @@ void BrowserToolbarView::ButtonPressed(views::BaseButton* sender) {
void BrowserToolbarView::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_PREF_CHANGED) {
+ if (type == NotificationType::PREF_CHANGED) {
std::wstring* pref_name = Details<std::wstring>(details).ptr();
if (*pref_name == prefs::kShowHomeButton) {
Layout();
diff --git a/chrome/common/chrome_plugin_lib.cc b/chrome/common/chrome_plugin_lib.cc
index a462adc..186261f 100644
--- a/chrome/common/chrome_plugin_lib.cc
+++ b/chrome/common/chrome_plugin_lib.cc
@@ -290,7 +290,7 @@ bool ChromePluginLib::Load() {
void ChromePluginLib::Unload() {
NotificationService::current()->Notify(
- NOTIFY_CHROME_PLUGIN_UNLOADED,
+ NotificationType::CHROME_PLUGIN_UNLOADED,
Source<ChromePluginLib>(this),
NotificationService::NoDetails());
diff --git a/chrome/common/chrome_plugin_util.cc b/chrome/common/chrome_plugin_util.cc
index 610c0b9..e7a2ed0 100644
--- a/chrome/common/chrome_plugin_util.cc
+++ b/chrome/common/chrome_plugin_util.cc
@@ -10,6 +10,7 @@
#include "base/string_util.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/notification_service.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
@@ -40,7 +41,7 @@ ScopableCPRequest::~ScopableCPRequest() {
// static
void PluginHelper::DestroyAllHelpersForPlugin(ChromePluginLib* plugin) {
NotificationService::current()->Notify(
- NOTIFY_CHROME_PLUGIN_UNLOADED,
+ NotificationType::CHROME_PLUGIN_UNLOADED,
Source<ChromePluginLib>(plugin),
NotificationService::NoDetails());
}
@@ -48,14 +49,14 @@ void PluginHelper::DestroyAllHelpersForPlugin(ChromePluginLib* plugin) {
PluginHelper::PluginHelper(ChromePluginLib* plugin) : plugin_(plugin) {
DCHECK(CalledOnValidThread());
NotificationService::current()->AddObserver(
- this, NOTIFY_CHROME_PLUGIN_UNLOADED,
+ this, NotificationType::CHROME_PLUGIN_UNLOADED,
Source<ChromePluginLib>(plugin_));
}
PluginHelper::~PluginHelper() {
DCHECK(CalledOnValidThread());
NotificationService::current()->RemoveObserver(
- this, NOTIFY_CHROME_PLUGIN_UNLOADED,
+ this, NotificationType::CHROME_PLUGIN_UNLOADED,
Source<ChromePluginLib>(plugin_));
}
@@ -63,7 +64,7 @@ void PluginHelper::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK(CalledOnValidThread());
- DCHECK(type == NOTIFY_CHROME_PLUGIN_UNLOADED);
+ DCHECK(type == NotificationType::CHROME_PLUGIN_UNLOADED);
DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr());
delete this;
diff --git a/chrome/common/chrome_plugin_util.h b/chrome/common/chrome_plugin_util.h
index 5ca17fc..0c80c8c 100644
--- a/chrome/common/chrome_plugin_util.h
+++ b/chrome/common/chrome_plugin_util.h
@@ -9,7 +9,7 @@
#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "chrome/common/chrome_plugin_api.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
class ChromePluginLib;
class MessageLoop;
diff --git a/chrome/common/net/url_request_intercept_job.cc b/chrome/common/net/url_request_intercept_job.cc
index 01f4e29..08da43a 100644
--- a/chrome/common/net/url_request_intercept_job.cc
+++ b/chrome/common/net/url_request_intercept_job.cc
@@ -11,6 +11,7 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "chrome/common/chrome_plugin_lib.h"
+#include "chrome/common/notification_service.h"
#include "net/base/net_errors.h"
using base::Time;
@@ -31,7 +32,7 @@ URLRequestInterceptJob::URLRequestInterceptJob(URLRequest* request,
cprequest_->data = this; // see FromCPRequest().
NotificationService::current()->AddObserver(
- this, NOTIFY_CHROME_PLUGIN_UNLOADED,
+ this, NotificationType::CHROME_PLUGIN_UNLOADED,
Source<ChromePluginLib>(plugin_));
}
@@ -45,7 +46,7 @@ URLRequestInterceptJob::~URLRequestInterceptJob() {
void URLRequestInterceptJob::DetachPlugin() {
NotificationService::current()->RemoveObserver(
- this, NOTIFY_CHROME_PLUGIN_UNLOADED,
+ this, NotificationType::CHROME_PLUGIN_UNLOADED,
Source<ChromePluginLib>(plugin_));
plugin_ = NULL;
}
@@ -205,7 +206,7 @@ void URLRequestInterceptJob::OnReadCompleted(int bytes_read) {
void URLRequestInterceptJob::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_CHROME_PLUGIN_UNLOADED);
+ DCHECK(type == NotificationType::CHROME_PLUGIN_UNLOADED);
DCHECK(plugin_ == Source<ChromePluginLib>(source).ptr());
DetachPlugin();
diff --git a/chrome/common/net/url_request_intercept_job.h b/chrome/common/net/url_request_intercept_job.h
index 1537281..794a418 100644
--- a/chrome/common/net/url_request_intercept_job.h
+++ b/chrome/common/net/url_request_intercept_job.h
@@ -11,7 +11,7 @@
#include "chrome/browser/chrome_plugin_host.h"
#include "chrome/common/chrome_plugin_api.h"
#include "chrome/common/chrome_plugin_util.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
class ChromePluginLib;
diff --git a/chrome/common/notification_registrar.cc b/chrome/common/notification_registrar.cc
index aaa5b9e..b9ea3d7 100644
--- a/chrome/common/notification_registrar.cc
+++ b/chrome/common/notification_registrar.cc
@@ -2,9 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/common/notification_registrar.h"
+
#include <algorithm>
-#include "chrome/common/notification_registrar.h"
+#include "base/logging.h"
+#include "chrome/common/notification_service.h"
+
+struct NotificationRegistrar::Record {
+ bool operator==(const Record& other) const;
+
+ NotificationObserver* observer;
+ NotificationType type;
+ NotificationSource source;
+};
+
+bool NotificationRegistrar::Record::operator==(const Record& other) const {
+ return observer == other.observer &&
+ type == other.type &&
+ source == other.source;
+}
NotificationRegistrar::NotificationRegistrar() {
}
diff --git a/chrome/common/notification_registrar.h b/chrome/common/notification_registrar.h
index 25e46b2..c79d732 100644
--- a/chrome/common/notification_registrar.h
+++ b/chrome/common/notification_registrar.h
@@ -8,7 +8,7 @@
#include <vector>
#include "base/basictypes.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
// Aids in registering for notifications and ensures that all registered
// notifications are unregistered when the class is destroyed.
@@ -36,17 +36,7 @@ class NotificationRegistrar {
void RemoveAll();
private:
- struct Record {
- bool operator==(const Record& other) const {
- return observer == other.observer &&
- type == other.type &&
- source == other.source;
- }
-
- NotificationObserver* observer;
- NotificationType type;
- NotificationSource source;
- };
+ struct Record;
// We keep registered notifications in a simple vector. This means we'll do
// brute-force searches when removing them individually, but individual
diff --git a/chrome/common/notification_service.cc b/chrome/common/notification_service.cc
index dccadbe..5b732df 100644
--- a/chrome/common/notification_service.cc
+++ b/chrome/common/notification_service.cc
@@ -33,33 +33,34 @@ NotificationService::NotificationService() {
void NotificationService::AddObserver(NotificationObserver* observer,
NotificationType type,
const NotificationSource& source) {
- DCHECK(type < NOTIFICATION_TYPE_COUNT);
+ DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT);
NotificationObserverList* observer_list;
- if (HasKey(observers_[type], source)) {
- observer_list = observers_[type][source.map_key()];
+ if (HasKey(observers_[type.value], source)) {
+ observer_list = observers_[type.value][source.map_key()];
} else {
observer_list = new NotificationObserverList;
- observers_[type][source.map_key()] = observer_list;
+ observers_[type.value][source.map_key()] = observer_list;
}
observer_list->AddObserver(observer);
#ifndef NDEBUG
- ++observer_counts_[type];
+ ++observer_counts_[type.value];
#endif
}
void NotificationService::RemoveObserver(NotificationObserver* observer,
NotificationType type,
const NotificationSource& source) {
- DCHECK(type < NOTIFICATION_TYPE_COUNT);
- DCHECK(HasKey(observers_[type], source));
+ DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT);
+ DCHECK(HasKey(observers_[type.value], source));
- NotificationObserverList* observer_list = observers_[type][source.map_key()];
+ NotificationObserverList* observer_list =
+ observers_[type.value][source.map_key()];
if (observer_list) {
observer_list->RemoveObserver(observer);
#ifndef NDEBUG
- --observer_counts_[type];
+ --observer_counts_[type.value];
#endif
}
@@ -69,34 +70,42 @@ void NotificationService::RemoveObserver(NotificationObserver* observer,
void NotificationService::Notify(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type > NOTIFY_ALL); // Allowed for subscription, but not posting.
- DCHECK(type < NOTIFICATION_TYPE_COUNT);
+ DCHECK(type.value > NotificationType::ALL) <<
+ "Allowed for observing, but not posting.";
+ DCHECK(type.value < NotificationType::NOTIFICATION_TYPE_COUNT);
// There's no particular reason for the order in which the different
// classes of observers get notified here.
// Notify observers of all types and all sources
- if (HasKey(observers_[NOTIFY_ALL], AllSources()) &&
- source != AllSources())
+ if (HasKey(observers_[NotificationType::ALL], AllSources()) &&
+ source != AllSources()) {
FOR_EACH_OBSERVER(NotificationObserver,
- *observers_[NOTIFY_ALL][AllSources().map_key()],
- Observe(type, source, details));
+ *observers_[NotificationType::ALL][AllSources().map_key()],
+ Observe(type, source, details));
+ }
+
// Notify observers of all types and the given source
- if (HasKey(observers_[NOTIFY_ALL], source))
+ if (HasKey(observers_[NotificationType::ALL], source)) {
FOR_EACH_OBSERVER(NotificationObserver,
- *observers_[NOTIFY_ALL][source.map_key()],
- Observe(type, source, details));
+ *observers_[NotificationType::ALL][source.map_key()],
+ Observe(type, source, details));
+ }
+
// Notify observers of the given type and all sources
- if (HasKey(observers_[type], AllSources()) &&
- source != AllSources())
+ if (HasKey(observers_[type.value], AllSources()) &&
+ source != AllSources()) {
FOR_EACH_OBSERVER(NotificationObserver,
- *observers_[type][AllSources().map_key()],
+ *observers_[type.value][AllSources().map_key()],
Observe(type, source, details));
+ }
+
// Notify observers of the given type and the given source
- if (HasKey(observers_[type], source))
+ if (HasKey(observers_[type.value], source)) {
FOR_EACH_OBSERVER(NotificationObserver,
- *observers_[type][source.map_key()],
+ *observers_[type.value][source.map_key()],
Observe(type, source, details));
+ }
}
@@ -104,7 +113,7 @@ NotificationService::~NotificationService() {
lazy_tls_ptr.Pointer()->Set(NULL);
#ifndef NDEBUG
- for (int i = 0; i < NOTIFICATION_TYPE_COUNT; i++) {
+ for (int i = 0; i < NotificationType::NOTIFICATION_TYPE_COUNT; i++) {
if (observer_counts_[i] > 0) {
LOG(WARNING) << observer_counts_[i] << " notification observer(s) leaked"
<< " of notification type " << i;
@@ -112,7 +121,7 @@ NotificationService::~NotificationService() {
}
#endif
- for (int i = 0; i < NOTIFICATION_TYPE_COUNT; i++) {
+ for (int i = 0; i < NotificationType::NOTIFICATION_TYPE_COUNT; i++) {
NotificationSourceMap omap = observers_[i];
for (NotificationSourceMap::iterator it = omap.begin();
it != omap.end(); ++it) {
diff --git a/chrome/common/notification_service.h b/chrome/common/notification_service.h
index 170baa6..8fb8981 100644
--- a/chrome/common/notification_service.h
+++ b/chrome/common/notification_service.h
@@ -6,16 +6,16 @@
// happen in various parts of the application, and allows users to register
// observers for various classes of events that they're interested in.
-#ifndef CHROME_COMMON_NOTIFICATION_SERVICE_H__
-#define CHROME_COMMON_NOTIFICATION_SERVICE_H__
+#ifndef CHROME_COMMON_NOTIFICATION_SERVICE_H_
+#define CHROME_COMMON_NOTIFICATION_SERVICE_H_
#include <map>
#include "base/observer_list.h"
-#include "base/values.h"
#include "chrome/common/notification_details.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_source.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_type.h"
class NotificationObserver;
@@ -86,27 +86,16 @@ class NotificationService {
// Keeps track of the observers for each type of notification.
// Until we get a prohibitively large number of notification types,
// a simple array is probably the fastest way to dispatch.
- NotificationSourceMap observers_[NOTIFICATION_TYPE_COUNT];
+ NotificationSourceMap observers_[NotificationType::NOTIFICATION_TYPE_COUNT];
#ifndef NDEBUG
// Used to check to see that AddObserver and RemoveObserver calls are
// balanced.
- int observer_counts_[NOTIFICATION_TYPE_COUNT];
+ int observer_counts_[NotificationType::NOTIFICATION_TYPE_COUNT];
#endif
- DISALLOW_EVIL_CONSTRUCTORS(NotificationService);
+ DISALLOW_COPY_AND_ASSIGN(NotificationService);
};
-// This is the base class for notification observers. When a matching
-// notification is posted to the notification service, Observe is called.
-class NotificationObserver {
- public:
- virtual ~NotificationObserver();
-
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) = 0;
-};
-
-#endif // CHROME_COMMON_NOTIFICATION_SERVICE_H__
+#endif // CHROME_COMMON_NOTIFICATION_SERVICE_H_
diff --git a/chrome/common/notification_service_unittest.cc b/chrome/common/notification_service_unittest.cc
index fb79b33..db46356 100644
--- a/chrome/common/notification_service_unittest.cc
+++ b/chrome/common/notification_service_unittest.cc
@@ -50,25 +50,29 @@ TEST(NotificationServiceTest, Basic) {
NotificationService* service = NotificationService::current();
// Make sure it doesn't freak out when there are no observers.
- service->Notify(NOTIFY_IDLE,
+ service->Notify(NotificationType::IDLE,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
- service->AddObserver(
- &all_types_all_sources, NOTIFY_ALL, NotificationService::AllSources());
- service->AddObserver(
- &idle_all_sources, NOTIFY_IDLE, NotificationService::AllSources());
- service->AddObserver(
- &all_types_test_source, NOTIFY_ALL, Source<TestSource>(&test_source));
- service->AddObserver(
- &idle_test_source, NOTIFY_IDLE, Source<TestSource>(&test_source));
+ service->AddObserver(&all_types_all_sources,
+ NotificationType::ALL,
+ NotificationService::AllSources());
+ service->AddObserver(&idle_all_sources,
+ NotificationType::IDLE,
+ NotificationService::AllSources());
+ service->AddObserver(&all_types_test_source,
+ NotificationType::ALL,
+ Source<TestSource>(&test_source));
+ service->AddObserver(&idle_test_source,
+ NotificationType::IDLE,
+ Source<TestSource>(&test_source));
EXPECT_EQ(0, all_types_all_sources.notification_count());
EXPECT_EQ(0, idle_all_sources.notification_count());
EXPECT_EQ(0, all_types_test_source.notification_count());
EXPECT_EQ(0, idle_test_source.notification_count());
- service->Notify(NOTIFY_IDLE,
+ service->Notify(NotificationType::IDLE,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
@@ -77,7 +81,7 @@ TEST(NotificationServiceTest, Basic) {
EXPECT_EQ(1, all_types_test_source.notification_count());
EXPECT_EQ(1, idle_test_source.notification_count());
- service->Notify(NOTIFY_BUSY,
+ service->Notify(NotificationType::BUSY,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
@@ -86,7 +90,7 @@ TEST(NotificationServiceTest, Basic) {
EXPECT_EQ(2, all_types_test_source.notification_count());
EXPECT_EQ(1, idle_test_source.notification_count());
- service->Notify(NOTIFY_IDLE,
+ service->Notify(NotificationType::IDLE,
Source<TestSource>(&other_source),
NotificationService::NoDetails());
@@ -95,7 +99,7 @@ TEST(NotificationServiceTest, Basic) {
EXPECT_EQ(2, all_types_test_source.notification_count());
EXPECT_EQ(1, idle_test_source.notification_count());
- service->Notify(NOTIFY_BUSY,
+ service->Notify(NotificationType::BUSY,
Source<TestSource>(&other_source),
NotificationService::NoDetails());
@@ -105,7 +109,7 @@ TEST(NotificationServiceTest, Basic) {
EXPECT_EQ(1, idle_test_source.notification_count());
// Try send with NULL source.
- service->Notify(NOTIFY_IDLE,
+ service->Notify(NotificationType::IDLE,
NotificationService::AllSources(),
NotificationService::NoDetails());
@@ -114,16 +118,20 @@ TEST(NotificationServiceTest, Basic) {
EXPECT_EQ(2, all_types_test_source.notification_count());
EXPECT_EQ(1, idle_test_source.notification_count());
- service->RemoveObserver(
- &all_types_all_sources, NOTIFY_ALL, NotificationService::AllSources());
- service->RemoveObserver(
- &idle_all_sources, NOTIFY_IDLE, NotificationService::AllSources());
- service->RemoveObserver(
- &all_types_test_source, NOTIFY_ALL, Source<TestSource>(&test_source));
- service->RemoveObserver(
- &idle_test_source, NOTIFY_IDLE, Source<TestSource>(&test_source));
-
- service->Notify(NOTIFY_IDLE,
+ service->RemoveObserver(&all_types_all_sources,
+ NotificationType::ALL,
+ NotificationService::AllSources());
+ service->RemoveObserver(&idle_all_sources,
+ NotificationType::IDLE,
+ NotificationService::AllSources());
+ service->RemoveObserver(&all_types_test_source,
+ NotificationType::ALL,
+ Source<TestSource>(&test_source));
+ service->RemoveObserver(&idle_test_source,
+ NotificationType::IDLE,
+ Source<TestSource>(&test_source));
+
+ service->Notify(NotificationType::IDLE,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
@@ -134,7 +142,7 @@ TEST(NotificationServiceTest, Basic) {
// Removing an observer that isn't there is a no-op, this should be fine.
service->RemoveObserver(
- &all_types_all_sources, NOTIFY_ALL, NotificationService::AllSources());
+ &all_types_all_sources, NotificationType::ALL, NotificationService::AllSources());
}
TEST(NotificationServiceTest, MultipleRegistration) {
@@ -145,27 +153,27 @@ TEST(NotificationServiceTest, MultipleRegistration) {
NotificationService* service = NotificationService::current();
service->AddObserver(
- &idle_test_source, NOTIFY_IDLE, Source<TestSource>(&test_source));
+ &idle_test_source, NotificationType::IDLE, Source<TestSource>(&test_source));
service->AddObserver(
- &idle_test_source, NOTIFY_ALL, Source<TestSource>(&test_source));
+ &idle_test_source, NotificationType::ALL, Source<TestSource>(&test_source));
- service->Notify(NOTIFY_IDLE,
+ service->Notify(NotificationType::IDLE,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
EXPECT_EQ(2, idle_test_source.notification_count());
service->RemoveObserver(
- &idle_test_source, NOTIFY_IDLE, Source<TestSource>(&test_source));
+ &idle_test_source, NotificationType::IDLE, Source<TestSource>(&test_source));
- service->Notify(NOTIFY_IDLE,
+ service->Notify(NotificationType::IDLE,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
EXPECT_EQ(3, idle_test_source.notification_count());
service->RemoveObserver(
- &idle_test_source, NOTIFY_ALL, Source<TestSource>(&test_source));
+ &idle_test_source, NotificationType::ALL, Source<TestSource>(&test_source));
- service->Notify(NOTIFY_IDLE,
+ service->Notify(NotificationType::IDLE,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
EXPECT_EQ(3, idle_test_source.notification_count());
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
new file mode 100644
index 0000000..6894f49
--- /dev/null
+++ b/chrome/common/notification_type.h
@@ -0,0 +1,557 @@
+// Copyright (c) 2006-2008 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_NOTIFICATION_TYPE_H_
+#define CHROME_COMMON_NOTIFICATION_TYPE_H_
+
+// This file describes various types used to describe and filter notifications
+// that pass through the NotificationService.
+//
+// It is written as an enum inside a class so that it can be forward declared.
+// You're not allowed to forward declare an enum, and we want to forward
+// declare this since it's required by NotificationObserver which is included
+// by a lot of header files.
+//
+// Since this class encapsulates an integral value, it should be passed by
+// value.
+class NotificationType {
+ public:
+ enum Type {
+ // General -----------------------------------------------------------------
+
+ // Special signal value to represent an interest in all notifications.
+ // Not valid when posting a notification.
+ ALL = 0,
+
+ // The app is done processing user actions, now is a good time to do
+ // some background work.
+ IDLE,
+
+ // Means that the app has just started doing something in response to a
+ // user action, and that background processes shouldn't run if avoidable.
+ BUSY,
+
+ // This is sent when the user does a gesture resulting in a noteworthy
+ // action taking place. This is typically used for logging. The source is
+ // the profile, and the details is a wstring identifying the action.
+ USER_ACTION,
+
+ // NavigationController ----------------------------------------------------
+
+ // A new pending navigation has been created. Pending entries are created
+ // when the user requests the navigation. We don't know if it will actually
+ // happen until it does (at this point, it will be "committed." Note that
+ // renderer- initiated navigations such as link clicks will never be
+ // pending.
+ //
+ // This notification is called after the pending entry is created, but
+ // before we actually try to navigate. The source will be the
+ // NavigationController that owns the pending entry, and there are no
+ // details.
+ NAV_ENTRY_PENDING,
+
+ // A new non-pending navigation entry has been created. This will
+ // correspond to one NavigationController entry being created (in the case
+ // of new navigations) or renavigated to (for back/forward navigations).
+ //
+ // The source will be the navigation controller doing the commit. The
+ // details will be NavigationController::LoadCommittedDetails.
+ NAV_ENTRY_COMMITTED,
+
+ // Indicates that the NavigationController given in the Source has
+ // decreased its back/forward list count by removing entries from either
+ // the front or back of its list. This is usually the result of going back
+ // and then doing a new navigation, meaning all the "forward" items are
+ // deleted.
+ //
+ // This normally happens as a result of a new navigation. It will be
+ // followed by a NAV_ENTRY_COMMITTED message for the new page that
+ // caused the pruning. It could also be a result of removing an item from
+ // the list to fix up after interstitials.
+ //
+ // The details are NavigationController::PrunedDetails.
+ NAV_LIST_PRUNED,
+
+ // Indicates that a NavigationEntry has changed. The source will be the
+ // NavigationController that owns the NavigationEntry. The details will be
+ // a NavigationController::EntryChangedDetails struct.
+ //
+ // This will NOT be sent on navigation, interested parties should also
+ // listen for NAV_ENTRY_COMMITTED to handle that case. This will be
+ // sent when the entry is updated outside of navigation (like when a new
+ // title comes).
+ NAV_ENTRY_CHANGED,
+
+ // Other load-related (not from NavigationController) ----------------------
+
+ // A content load is starting. The source will be a
+ // Source<NavigationController> corresponding to the tab in which the load
+ // is occurring. No details are expected for this notification.
+ LOAD_START,
+
+ // A content load has stopped. The source will be a
+ // Source<NavigationController> corresponding to the tab in which the load
+ // is occurring. Details in the form of a LoadNotificationDetails object
+ // are optional.
+ LOAD_STOP,
+
+ // A frame is staring a provisional load. The source is a
+ // Source<NavigationController> corresponding to the tab in which the load
+ // occurs. Details is a bool specifying if the load occurs in the main
+ // frame (or a sub-frame if false).
+ FRAME_PROVISIONAL_LOAD_START,
+
+ // Content was loaded from an in-memory cache. The source will be a
+ // Source<NavigationController> corresponding to the tab in which the load
+ // occurred. Details in the form of a LoadFromMemoryCacheDetails object
+ // are provided.
+ LOAD_FROM_MEMORY_CACHE,
+
+ // A provisional content load has failed with an error. The source will be
+ // a Source<NavigationController> corresponding to the tab in which the
+ // load occurred. Details in the form of a ProvisionalLoadDetails object
+ // are provided.
+ FAIL_PROVISIONAL_LOAD_WITH_ERROR,
+
+ // A response has been received for a resource request. The source will be
+ // a Source<NavigationController> corresponding to the tab in which the
+ // request was issued. Details in the form of a ResourceRequestDetails
+ // object are provided.
+ RESOURCE_RESPONSE_STARTED,
+
+ // The response to a resource request has completed. The source will be a
+ // Source<NavigationController> corresponding to the tab in which the
+ // request was issued. Details in the form of a ResourceRequestDetails
+ // object are provided.
+ RESOURCE_RESPONSE_COMPLETED,
+
+ // A redirect was received while requesting a resource. The source will be
+ // a Source<NavigationController> corresponding to the tab in which the
+ // request was issued. Details in the form of a ResourceRedirectDetails
+ // are provided.
+ RESOURCE_RECEIVED_REDIRECT,
+
+ // The SSL state of a page has changed somehow. For example, if an insecure
+ // resource is loaded on a secure page. Note that a toplevel load commit
+ // will also update the SSL state (since the NavigationEntry is new) and
+ // this message won't always be sent in that case.
+ //
+ // The source will be the navigation controller associated with the load.
+ // There are no details. The entry changed will be the active entry of the
+ // controller.
+ SSL_STATE_CHANGED,
+
+ // Download start and stop notifications. Stop notifications can occur on
+ // both normal completion or via a cancel operation.
+ DOWNLOAD_START, DOWNLOAD_STOP,
+
+ // Views -------------------------------------------------------------------
+
+ // Notification that a view was removed from a view hierarchy. The source
+ // is the view, the details is the parent view.
+ VIEW_REMOVED,
+
+ // Browser-window ----------------------------------------------------------
+
+ // This message is sent after a window has been opened. The source is a
+ // Source<Browser> with a pointer to the new window. No details are
+ // expected.
+ BROWSER_OPENED,
+
+ // This message is sent after a window has been closed. The source is a
+ // Source<Browser> with a pointer to the closed window. 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). Note that the boolean pointed to by Details is only
+ // valid for the duration of this call.
+ BROWSER_CLOSED,
+
+ // This message is sent when the last window considered to be an
+ // "application window" has been closed. Dependent/dialog/utility windows
+ // can use this as a way to know that they should also close. No source or
+ // details are passed.
+ ALL_APPWINDOWS_CLOSED,
+
+ // Indicates that a top window has been closed. The source is the HWND
+ // that was closed, no details are expected.
+ WINDOW_CLOSED,
+
+ // Tabs --------------------------------------------------------------------
+
+ // This notification is sent after a tab has been appended to the
+ // tab_strip. The source is a Source<NavigationController> with a pointer
+ // to controller for the added tab. There are no details.
+ TAB_PARENTED,
+
+ // This message is sent before a tab has been closed. The source is a
+ // Source<NavigationController> with a pointer to the controller for the
+ // closed tab. No details are expected.
+ //
+ // See also TAB_CLOSED.
+ TAB_CLOSING,
+
+ // Notification that a tab has been closed. The source is the
+ // NavigationController with no details.
+ TAB_CLOSED,
+
+ // This notification is sent when a render view host has connected to a
+ // renderer process. The source is a Source<WebContents> with a pointer to
+ // the WebContents. A WEB_CONTENTS_DISCONNECTED notification is
+ // guaranteed before the source pointer becomes junk. No details are
+ // expected.
+ WEB_CONTENTS_CONNECTED,
+
+ // This notification is sent when a WebContents swaps its render view host
+ // with another one, possibly changing processes. The source is a
+ // Source<WebContents> with a pointer to the WebContents. A
+ // WEB_CONTENTS_DISCONNECTED notification is guaranteed before the
+ // source pointer becomes junk. No details are expected.
+ WEB_CONTENTS_SWAPPED,
+
+ // This message is sent after a WebContents is disconnected from the
+ // renderer process. The source is a Source<WebContents> with a pointer to
+ // the WebContents (the pointer is usable). No details are expected.
+ WEB_CONTENTS_DISCONNECTED,
+
+ // This message is sent when a new InfoBar has been added to a TabContents.
+ // The source is a Source<TabContents> with a pointer to the TabContents
+ // the InfoBar was added to. The details is a Details<InfoBarDelegate> with
+ // a pointer to an object implementing the InfoBarDelegate interface for
+ // the InfoBar that was added.
+ TAB_CONTENTS_INFOBAR_ADDED,
+
+ // This message is sent when an InfoBar is about to be removed from a
+ // TabContents. The source is a Source<TabContents> with a pointer to the
+ // TabContents the InfoBar was removed from. The details is a
+ // Details<InfoBarDelegate> with a pointer to an object implementing the
+ // InfoBarDelegate interface for the InfoBar that was removed.
+ TAB_CONTENTS_INFOBAR_REMOVED,
+
+ // This is sent when an externally hosted tab is created. The details
+ // contain the ExternalTabContainer that contains the tab
+ EXTERNAL_TAB_CREATED,
+
+ // This is sent when an externally hosted tab is closed. No details are
+ // expected.
+ 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.
+ INITIAL_NEW_TAB_UI_LOAD,
+
+ // This notification is sent when a TabContents is being hidden, e.g. due
+ // to switching away from this tab. The source is a Source<TabContents>.
+ TAB_CONTENTS_HIDDEN,
+
+ // This notification is sent when a TabContents is being destroyed. Any
+ // object holding a reference to a TabContents can listen to that
+ // notification to properly reset the reference. The source is a
+ // Source<TabContents>.
+ TAB_CONTENTS_DESTROYED,
+
+ // 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.
+ CWINDOW_CLOSED,
+
+ // Indicates that a render process has terminated. The source will be the
+ // RenderProcessHost that corresponds to the process, and the details is a
+ // bool specifying whether the termination was expected, i.e. if false it
+ // means the process crashed.
+ RENDERER_PROCESS_TERMINATED,
+
+ // Indicates that a render process has become unresponsive for a period of
+ // time. The source will be the RenderWidgetHost that corresponds to the
+ // hung view, and no details are expected.
+ RENDERER_PROCESS_HANG,
+
+ // Indicates that a render process is created in the sandbox. The source
+ // will be the RenderProcessHost that corresponds to the created process
+ // and the detail is a bool telling us if the process got created on the
+ // sandbox desktop or not.
+ RENDERER_PROCESS_IN_SBOX,
+
+ // This is sent to notify that the RenderViewHost displayed in a
+ // WebContents has changed. Source is the WebContents for which the change
+ // happened, details is the previous RenderViewHost (can be NULL when the
+ // first RenderViewHost is set).
+ RENDER_VIEW_HOST_CHANGED,
+
+ // This is sent when a RenderWidgetHost is being destroyed. The source is
+ // the RenderWidgetHost, the details are not used.
+ RENDER_WIDGET_HOST_DESTROYED,
+
+ // Notification from WebContents that we have received a response from the
+ // renderer after using the dom inspector.
+ DOM_INSPECT_ELEMENT_RESPONSE,
+
+ // Notification from WebContents that we have received a response from the
+ // renderer in response to a dom automation controller action.
+ DOM_OPERATION_RESPONSE,
+
+ // Sent when the bookmark bubble hides. The source is the profile, the
+ // details unused.
+ 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 WebContents. Details encompass a
+ // FindNotificationDetail object that tells whether the match was found or
+ // not found.
+ 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.
+ BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
+
+ // 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.
+ WEB_CACHE_STATS_OBSERVED,
+
+ // Plugins -----------------------------------------------------------------
+
+ // This notification is sent when a plugin process host has connected to a
+ // plugin process. There is no usable source, since it is sent from an
+ // ephemeral task; register for AllSources() to receive this notification.
+ // The details are in a Details<PluginProcessInfo> with a pointer to a
+ // plug-in process info for the plugin, that is only valid for the time of
+ // the notification (don't keep this pointer around, make a copy of the
+ // object if you need to keep it).
+ PLUGIN_PROCESS_HOST_CONNECTED,
+
+ // This message is sent after a PluginProcessHost is disconnected from the
+ // plugin process. There is no usable source, since it is sent from an
+ // ephemeral task; register for AllSources() to receive this notification.
+ // The details are in a Details<PluginProcessInfo> with a pointer to a
+ // plug-in process info for the plugin, that is only valid for the time of
+ // the notification (don't keep this pointer around, make a copy of the
+ // object if you need to keep it).
+ PLUGIN_PROCESS_HOST_DISCONNECTED,
+
+ // This message is sent when a plugin process disappears unexpectedly.
+ // There is no usable source, since it is sent from an ephemeral task;
+ // register for AllSources() to receive this notification. The details are
+ // in a Details<PluginProcessInfo> with a pointer to a plug-in process info
+ // for the plugin, that is only valid for the time of the notification
+ // (don't keep this pointer around, make a copy of the object if you need
+ // to keep it).
+ PLUGIN_PROCESS_CRASHED,
+
+ // This message indicates that an instance of a particular plugin was
+ // created in a page. (If one page contains several regions rendered by
+ // the same plugin, this notification will occur once for each region
+ // during the page load.)
+ //
+ // There is no usable source, since it is sent from an ephemeral task;
+ // register for AllSources() to receive this notification. The details are
+ // in a Details<PluginProcessInfo> with a pointer to a plug-in process info
+ // for the plugin, that is only valid for the time of the notification
+ // (don't keep this pointer around, make a copy of the object if you need
+ // to keep it).
+ PLUGIN_INSTANCE_CREATED,
+
+ // 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.
+ 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.
+ 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.
+ // No details are expected.
+ AUTH_SUPPLIED,
+
+ // 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.
+ 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.
+ 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.
+ 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.
+ 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.
+ HISTORY_URLS_DELETED,
+
+ // 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).
+ FAVICON_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.
+ URLS_STARRED,
+
+ // Sent when the bookmark bar model finishes loading. This source is the
+ // Profile, and the details aren't used.
+ BOOKMARK_MODEL_LOADED,
+
+ // Sent when the spellchecker object changes. Note that this is not sent
+ // the first time the spellchecker gets initialized. The source is the
+ // profile, the details is SpellcheckerReinitializedDetails defined in
+ // profile.
+ SPELLCHECKER_REINITIALIZED,
+
+ // Sent when the bookmark bubble is shown for a particular URL. The source
+ // is the profile, the details the URL.
+ BOOKMARK_BUBBLE_SHOWN,
+
+ // Non-history storage services --------------------------------------------
+
+ // Notification that the TemplateURLModel has finished loading from the
+ // database. The source is the TemplateURLModel, and the details are
+ // NoDetails.
+ TEMPLATE_URL_MODEL_LOADED,
+
+ // 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.
+ WEB_APP_INSTALL_CHANGED,
+
+ // This is sent to a pref observer when a pref is changed.
+ PREF_CHANGED,
+
+ // 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.
+ DEFAULT_REQUEST_CONTEXT_AVAILABLE,
+
+ // Autocomplete ------------------------------------------------------------
+
+ // Sent by the autocomplete controller at least once per query, each time
+ // new matches are available, subject to rate-limiting/coalescing to reduce
+ // the number of updates. There are no details.
+ AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED,
+
+ // Sent by the autocomplete controller once per query, immediately after
+ // synchronous matches become available. There are no details.
+ AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE,
+
+ // This is sent when an item of the Omnibox popup is selected. The source
+ // is the profile.
+ OMNIBOX_OPENED_URL,
+
+ // Sent by the autocomplete edit when it is destroyed.
+ AUTOCOMPLETE_EDIT_DESTROYED,
+
+ // 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().
+ GOOGLE_URL_UPDATED,
+
+ // Printing ----------------------------------------------------------------
+
+ // Notification from a PrintedDocument that it has been updated. It may be
+ // that a printed page has just been generated or that the document's
+ // number of pages has been calculated. Details is the new page or NULL if
+ // only the number of pages in the document has been updated.
+ PRINTED_DOCUMENT_UPDATED,
+
+ // Notification from PrintJob that an event occured. It can be that a page
+ // finished printing or that the print job failed. Details is
+ // PrintJob::EventDetails.
+ PRINT_JOB_EVENT,
+
+ // Shutdown ----------------------------------------------------------------
+
+ // Sent on the browser IO thread when an URLRequestContext is released by
+ // its owning Profile. The source is a pointer to the URLRequestContext.
+ 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.
+ SESSION_END,
+
+ // Personalization ---------------------------------------------------------
+
+ PERSONALIZATION,
+ PERSONALIZATION_CREATED,
+
+ // User Scripts ------------------------------------------------------------
+
+ // Sent when there are new user scripts available. The details are a
+ // pointer to SharedMemory containing the new scripts.
+ USER_SCRIPTS_LOADED,
+
+ // Extensions --------------------------------------------------------------
+
+ // Sent when new extensions are loaded. The details are an ExtensionList*.
+ EXTENSIONS_LOADED,
+
+ // Sent when new extensions are installed. The details are a FilePath.
+ EXTENSION_INSTALLED,
+
+ // Count (must be last) ----------------------------------------------------
+ // Used to determine the number of notification types. Not valid as
+ // a type parameter when registering for or posting notifications.
+ NOTIFICATION_TYPE_COUNT
+ };
+
+ NotificationType(Type v) : value(v) {}
+
+ bool operator==(NotificationType t) const { return value == t.value; }
+ bool operator!=(NotificationType t) const { return value != t.value; }
+
+ // Comparison to explicit enum values.
+ bool operator==(Type v) const { return value == v; }
+ bool operator!=(Type v) const { return value != v; }
+
+ Type value;
+};
+
+inline bool operator==(NotificationType::Type a, NotificationType b) {
+ return a == b.value;
+}
+inline bool operator!=(NotificationType::Type a, NotificationType b) {
+ return a != b.value;
+}
+
+#endif // CHROME_COMMON_NOTIFICATION_TYPE_H_
diff --git a/chrome/common/notification_types.h b/chrome/common/notification_types.h
deleted file mode 100644
index 788ba17..0000000
--- a/chrome/common/notification_types.h
+++ /dev/null
@@ -1,525 +0,0 @@
-// Copyright (c) 2006-2008 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.
-
-// This file describes various types used to describe and filter notifications
-// that pass through the NotificationService.
-
-#ifndef CHROME_COMMON_NOTIFICATION_TYPES_H__
-#define CHROME_COMMON_NOTIFICATION_TYPES_H__
-
-enum NotificationType {
- // General -------------------------------------------------------------------
-
- // Special signal value to represent an interest in all notifications.
- // Not valid when posting a notification.
- NOTIFY_ALL = 0,
-
- // The app is done processing user actions, now is a good time to do
- // some background work.
- NOTIFY_IDLE,
-
- // Means that the app has just started doing something in response
- // to a user action, and that background processes shouldn't run if avoidable.
- NOTIFY_BUSY,
-
- // This is sent when the user does a gesture resulting in a noteworthy
- // action taking place. This is typically used for logging. The
- // source is the profile, and the details is a wstring identifying the action.
- NOTIFY_USER_ACTION,
-
- // NavigationController ------------------------------------------------------
-
- // A new pending navigation has been created. Pending entries are created when
- // the user requests the navigation. We don't know if it will actually happen
- // until it does (at this point, it will be "committed." Note that renderer-
- // initiated navigations such as link clicks will never be pending.
- //
- // This notification is called after the pending entry is created, but before
- // we actually try to navigate. The source will be the NavigationController
- // that owns the pending entry, and there are no details.
- NOTIFY_NAV_ENTRY_PENDING,
-
- // A new non-pending navigation entry has been created. This will correspond
- // to one NavigationController entry being created (in the case of new
- // navigations) or renavigated to (for back/forward navigations).
- //
- // The source will be the navigation controller doing the commit. The details
- // will be NavigationController::LoadCommittedDetails.
- NOTIFY_NAV_ENTRY_COMMITTED,
-
- // Indicates that the NavigationController given in the Source has decreased
- // its back/forward list count by removing entries from either the front or
- // back of its list. This is usually the result of going back and then doing a
- // new navigation, meaning all the "forward" items are deleted.
- //
- // This normally happens as a result of a new navigation. It will be followed
- // by a NOTIFY_NAV_ENTRY_COMMITTED message for the new page that caused the
- // pruning. It could also be a result of removing an item from the list to fix
- // up after interstitials.
- //
- // The details are NavigationController::PrunedDetails.
- NOTIFY_NAV_LIST_PRUNED,
-
- // Indicates that a NavigationEntry has changed. The source will be the
- // NavigationController that owns the NavigationEntry. The details will be
- // a NavigationController::EntryChangedDetails struct.
- //
- // This will NOT be sent on navigation, interested parties should also listen
- // for NOTIFY_NAV_ENTRY_COMMITTED to handle that case. This will be sent when
- // the entry is updated outside of navigation (like when a new title comes).
- NOTIFY_NAV_ENTRY_CHANGED,
-
- // Other load-related (not from NavigationController) ------------------------
-
- // A content load is starting. The source will be a
- // Source<NavigationController> corresponding to the tab
- // in which the load is occurring. No details are
- // expected for this notification.
- NOTIFY_LOAD_START,
-
- // A content load has stopped. The source will be a
- // Source<NavigationController> corresponding to the tab
- // in which the load is occurring. Details in the form of a
- // LoadNotificationDetails object are optional.
- NOTIFY_LOAD_STOP,
-
- // A frame is staring a provisional load. The source is a
- // Source<NavigationController> corresponding to the tab in which the load
- // occurs. Details is a bool specifying if the load occurs in the main
- // frame (or a sub-frame if false).
- NOTIFY_FRAME_PROVISIONAL_LOAD_START,
-
- // Content was loaded from an in-memory cache. The source will be a
- // Source<NavigationController> corresponding to the tab
- // in which the load occurred. Details in the form of a
- // LoadFromMemoryCacheDetails object are provided.
- NOTIFY_LOAD_FROM_MEMORY_CACHE,
-
- // A provisional content load has failed with an error. The source will be a
- // Source<NavigationController> corresponding to the tab
- // in which the load occurred. Details in the form of a
- // ProvisionalLoadDetails object are provided.
- NOTIFY_FAIL_PROVISIONAL_LOAD_WITH_ERROR,
-
- // A response has been received for a resource request. The source will be a
- // Source<NavigationController> corresponding to the tab in which the request
- // was issued. Details in the form of a ResourceRequestDetails object are
- // provided.
- NOTIFY_RESOURCE_RESPONSE_STARTED,
-
- // The response to a resource request has completed. The source will be a
- // Source<NavigationController> corresponding to the tab in which the request
- // was issued. Details in the form of a ResourceRequestDetails object are
- // provided.
- NOTIFY_RESOURCE_RESPONSE_COMPLETED,
-
- // A redirect was received while requesting a resource. The source will be a
- // Source<NavigationController> corresponding to the tab in which the request
- // was issued. Details in the form of a ResourceRedirectDetails are provided.
- NOTIFY_RESOURCE_RECEIVED_REDIRECT,
-
- // The SSL state of a page has changed somehow. For example, if an insecure
- // resource is loaded on a secure page. Note that a toplevel load commit
- // will also update the SSL state (since the NavigationEntry is new) and this
- // message won't always be sent in that case.
- //
- // The source will be the navigation controller associated with the load.
- // There are no details. The entry changed will be the active entry of the
- // controller.
- NOTIFY_SSL_STATE_CHANGED,
-
- // Download start and stop notifications. Stop notifications can occur on both
- // normal completion or via a cancel operation.
- NOTIFY_DOWNLOAD_START,
- NOTIFY_DOWNLOAD_STOP,
-
- // Views ---------------------------------------------------------------------
-
- // Notification that a view was removed from a view hierarchy. The source is
- // the view, the details is the parent view.
- NOTIFY_VIEW_REMOVED,
-
- // Browser-window ------------------------------------------------------------
-
- // This message is sent after a window has been opened. The source is
- // a Source<Browser> with a pointer to the new window.
- // No details are expected.
- NOTIFY_BROWSER_OPENED,
-
- // This message is sent after a window has been closed. The source is
- // a Source<Browser> with a pointer to the closed window.
- // 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). Note that the boolean pointed to by Details is
- // only valid for the duration of this call.
- NOTIFY_BROWSER_CLOSED,
-
- // This message is sent when the last window considered to be an "application
- // window" has been closed. Dependent/dialog/utility windows can use this as
- // a way to know that they should also close. No source or details are passed.
- NOTIFY_ALL_APPWINDOWS_CLOSED,
-
- // Indicates that a top window has been closed. The source is the HWND that
- // was closed, no details are expected.
- NOTIFY_WINDOW_CLOSED,
-
- // Tabs ----------------------------------------------------------------------
-
- // This notification is sent after a tab has been appended to the tab_strip.
- // The source is a Source<NavigationController> with a pointer to
- // controller for the added tab. There are no details.
- NOTIFY_TAB_PARENTED,
-
- // This message is sent before a tab has been closed. The source is
- // a Source<NavigationController> with a pointer to the controller for the
- // closed tab.
- // No details are expected.
- //
- // See also NOTIFY_TAB_CLOSED.
- NOTIFY_TAB_CLOSING,
-
- // Notification that a tab has been closed. The source is the
- // NavigationController with no details.
- NOTIFY_TAB_CLOSED,
-
- // This notification is sent when a render view host has connected to a
- // renderer process. The source is a Source<WebContents> with a pointer to
- // the WebContents. A NOTIFY_WEB_CONTENTS_DISCONNECTED notification is
- // guaranteed before the source pointer becomes junk.
- // No details are expected.
- NOTIFY_WEB_CONTENTS_CONNECTED,
-
- // This notification is sent when a WebContents swaps its render view host
- // with another one, possibly changing processes. The source is a
- // Source<WebContents> with a pointer to the WebContents. A
- // NOTIFY_WEB_CONTENTS_DISCONNECTED notification is guaranteed before the
- // source pointer becomes junk.
- // No details are expected.
- NOTIFY_WEB_CONTENTS_SWAPPED,
-
- // This message is sent after a WebContents is disconnected from the
- // renderer process.
- // The source is a Source<WebContents> with a pointer to the WebContents
- // (the pointer is usable).
- // No details are expected.
- NOTIFY_WEB_CONTENTS_DISCONNECTED,
-
- // This message is sent when a new InfoBar has been added to a TabContents.
- // The source is a Source<TabContents> with a pointer to the TabContents the
- // InfoBar was added to. The details is a Details<InfoBarDelegate> with a
- // pointer to an object implementing the InfoBarDelegate interface for the
- // InfoBar that was added.
- NOTIFY_TAB_CONTENTS_INFOBAR_ADDED,
-
- // This message is sent when an InfoBar is about to be removed from a
- // TabContents. The source is a Source<TabContents> with a pointer to the
- // TabContents the InfoBar was removed from. The details is a
- // Details<InfoBarDelegate> with a pointer to an object implementing the
- // InfoBarDelegate interface for the InfoBar that was removed.
- NOTIFY_TAB_CONTENTS_INFOBAR_REMOVED,
-
- // This is sent when an externally hosted tab is created. The details contain
- // the ExternalTabContainer that contains the tab
- NOTIFY_EXTERNAL_TAB_CREATED,
-
- // This is sent when an externally hosted tab is closed.
- // No details are expected.
- NOTIFY_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.
- NOTIFY_INITIAL_NEW_TAB_UI_LOAD,
-
- // This notification is sent when a TabContents is being hidden, e.g. due to
- // switching away from this tab. The source is a Source<TabContents>.
- NOTIFY_TAB_CONTENTS_HIDDEN,
-
- // This notification is sent when a TabContents is being destroyed. Any object
- // holding a reference to a TabContents can listen to that notification to
- // properly reset the reference. The source is a Source<TabContents>.
- NOTIFY_TAB_CONTENTS_DESTROYED,
-
- // 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.
- NOTIFY_CWINDOW_CLOSED,
-
- // Indicates that a render process has terminated. The source will be the
- // RenderProcessHost that corresponds to the process, and the details is a
- // bool specifying whether the termination was expected, i.e. if false it
- // means the process crashed.
- NOTIFY_RENDERER_PROCESS_TERMINATED,
-
- // Indicates that a render process has become unresponsive for a period of
- // time. The source will be the RenderWidgetHost that corresponds to the hung
- // view, and no details are expected.
- NOTIFY_RENDERER_PROCESS_HANG,
-
- // Indicates that a render process is created in the sandbox. The source
- // will be the RenderProcessHost that corresponds to the created process
- // and the detail is a bool telling us if the process got created on the
- // sandbox desktop or not.
- NOTIFY_RENDERER_PROCESS_IN_SBOX,
-
- // This is sent to notify that the RenderViewHost displayed in a WebContents
- // has changed. Source is the WebContents for which the change happened,
- // details is the previous RenderViewHost (can be NULL when the first
- // RenderViewHost is set).
- NOTIFY_RENDER_VIEW_HOST_CHANGED,
-
- // This is sent when a RenderWidgetHost is being destroyed. The source
- // is the RenderWidgetHost, the details are not used.
- NOTIFY_RENDER_WIDGET_HOST_DESTROYED,
-
- // Notification from WebContents that we have received a response from
- // the renderer after using the dom inspector.
- NOTIFY_DOM_INSPECT_ELEMENT_RESPONSE,
-
- // Notification from WebContents that we have received a response from
- // the renderer in response to a dom automation controller action.
- NOTIFY_DOM_OPERATION_RESPONSE,
-
- // Sent when the bookmark bubble hides. The source is the profile, the
- // details unused.
- NOTIFY_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 WebContents. Details encompass a
- // FindNotificationDetail object that tells whether the match was
- // found or not found.
- NOTIFY_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.
- NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
-
- // 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.
- NOTIFY_WEB_CACHE_STATS_OBSERVED,
-
- // Plugins -------------------------------------------------------------------
-
- // This notification is sent when a plugin process host has connected to a
- // plugin process. There is no usable source, since it is sent from an
- // ephemeral task; register for AllSources() to receive this notification.
- // The details are in a Details<PluginProcessInfo> with a pointer to
- // a plug-in process info for the plugin, that is only valid for the time of
- // the notification (don't keep this pointer around, make a copy of the object
- // if you need to keep it).
- NOTIFY_PLUGIN_PROCESS_HOST_CONNECTED,
-
- // This message is sent after a PluginProcessHost is disconnected from the
- // plugin process. There is no usable source, since it is sent from an
- // ephemeral task; register for AllSources() to receive this notification.
- // The details are in a Details<PluginProcessInfo> with a pointer to
- // a plug-in process info for the plugin, that is only valid for the time of
- // the notification (don't keep this pointer around, make a copy of the object
- // if you need to keep it).
- NOTIFY_PLUGIN_PROCESS_HOST_DISCONNECTED,
-
- // This message is sent when a plugin process disappears unexpectedly.
- // There is no usable source, since it is sent from an
- // ephemeral task; register for AllSources() to receive this notification.
- // The details are in a Details<PluginProcessInfo> with a pointer to
- // a plug-in process info for the plugin, that is only valid for the time of
- // the notification (don't keep this pointer around, make a copy of the object
- // if you need to keep it).
- NOTIFY_PLUGIN_PROCESS_CRASHED,
-
- // This message indicates that an instance of a particular plugin was
- // created in a page. (If one page contains several regions rendered
- // by the same plugin, this notification will occur once for each region
- // during the page load.)
- // There is no usable source, since it is sent from an
- // ephemeral task; register for AllSources() to receive this notification.
- // The details are in a Details<PluginProcessInfo> with a pointer to
- // a plug-in process info for the plugin, that is only valid for the time of
- // the notification (don't keep this pointer around, make a copy of the object
- // if you need to keep it).
- NOTIFY_PLUGIN_INSTANCE_CREATED,
-
- // 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.
- NOTIFY_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.
- NOTIFY_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.
- // No details are expected.
- NOTIFY_AUTH_SUPPLIED,
-
- // 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
- // NOTIFY_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.
- NOTIFY_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.
- NOTIFY_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.
- NOTIFY_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.
- NOTIFY_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.
- NOTIFY_HISTORY_URLS_DELETED,
-
- // 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).
- NOTIFY_FAVICON_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.
- NOTIFY_URLS_STARRED,
-
- // Sent when the bookmark bar model finishes loading. This source is the
- // Profile, and the details aren't used.
- NOTIFY_BOOKMARK_MODEL_LOADED,
-
- // Sent when the spellchecker object changes. Note that this is not sent the
- // first time the spellchecker gets initialized. The source is the profile,
- // the details is SpellcheckerReinitializedDetails defined in profile.
- NOTIFY_SPELLCHECKER_REINITIALIZED,
-
- // Sent when the bookmark bubble is shown for a particular URL. The source
- // is the profile, the details the URL.
- NOTIFY_BOOKMARK_BUBBLE_SHOWN,
-
- // Non-history storage services ----------------------------------------------
-
- // Notification that the TemplateURLModel has finished loading from the
- // database. The source is the TemplateURLModel, and the details are
- // NoDetails.
- TEMPLATE_URL_MODEL_LOADED,
-
- // 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.
- NOTIFY_WEB_APP_INSTALL_CHANGED,
-
- // This is sent to a pref observer when a pref is changed.
- NOTIFY_PREF_CHANGED,
-
- // 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.
- NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE,
-
- // Autocomplete --------------------------------------------------------------
-
- // Sent by the autocomplete controller at least once per query, each time new
- // matches are available, subject to rate-limiting/coalescing to reduce the
- // number of updates. There are no details.
- NOTIFY_AUTOCOMPLETE_CONTROLLER_RESULT_UPDATED,
-
- // Sent by the autocomplete controller once per query, immediately after
- // synchronous matches become available. There are no details.
- NOTIFY_AUTOCOMPLETE_CONTROLLER_SYNCHRONOUS_MATCHES_AVAILABLE,
-
- // This is sent when an item of the Omnibox popup is selected. The source is
- // the profile.
- NOTIFY_OMNIBOX_OPENED_URL,
-
- // Sent by the autocomplete edit when it is destroyed.
- NOTIFY_AUTOCOMPLETE_EDIT_DESTROYED,
-
- // 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().
- NOTIFY_GOOGLE_URL_UPDATED,
-
- // Printing ------------------------------------------------------------------
-
- // Notification from a PrintedDocument that it has been updated. It may be
- // that a printed page has just been generated or that the document's number
- // of pages has been calculated. Details is the new page or NULL if only the
- // number of pages in the document has been updated.
- NOTIFY_PRINTED_DOCUMENT_UPDATED,
-
- // Notification from PrintJob that an event occured. It can be that a page
- // finished printing or that the print job failed. Details is
- // PrintJob::EventDetails.
- NOTIFY_PRINT_JOB_EVENT,
-
- // Shutdown ------------------------------------------------------------------
-
- // Sent on the browser IO thread when an URLRequestContext is released by its
- // owning Profile. The source is a pointer to the URLRequestContext.
- NOTIFY_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.
- NOTIFY_SESSION_END,
-
- // Personalization -----------------------------------------------------------
- NOTIFY_PERSONALIZATION,
- NOTIFY_PERSONALIZATION_CREATED,
-
- // User Scripts --------------------------------------------------------------
-
- // Sent when there are new user scripts available.
- // The details are a pointer to SharedMemory containing the new scripts.
- NOTIFY_USER_SCRIPTS_LOADED,
-
- // Extensions ----------------------------------------------------------------
-
- // Sent when new extensions are loaded. The details are an ExtensionList*.
- NOTIFY_EXTENSIONS_LOADED,
-
- // Sent when new extensions are installed. The details are a FilePath.
- NOTIFY_EXTENSION_INSTALLED,
-
- // Count (must be last) ------------------------------------------------------
- // Used to determine the number of notification types. Not valid as
- // a type parameter when registering for or posting notifications.
- NOTIFICATION_TYPE_COUNT
-};
-
-#endif // CHROME_COMMON_NOTIFICATION_TYPES_H__
-
diff --git a/chrome/common/pref_member.cc b/chrome/common/pref_member.cc
index 9843b7e..8734775 100644
--- a/chrome/common/pref_member.cc
+++ b/chrome/common/pref_member.cc
@@ -5,6 +5,7 @@
#include "chrome/common/pref_member.h"
#include "base/logging.h"
+#include "chrome/common/notification_type.h"
#include "chrome/common/pref_service.h"
namespace subtle {
@@ -23,7 +24,7 @@ PrefMemberBase::~PrefMemberBase() {
void PrefMemberBase::Init(const wchar_t* pref_name, PrefService* prefs,
- NotificationObserver* observer) {
+ NotificationObserver* observer) {
DCHECK(pref_name);
DCHECK(prefs);
DCHECK(pref_name_.empty()); // Check that Init is only called once.
@@ -40,7 +41,7 @@ void PrefMemberBase::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
DCHECK(!pref_name_.empty());
- DCHECK(NOTIFY_PREF_CHANGED == type);
+ DCHECK(NotificationType::PREF_CHANGED == type);
UpdateValueFromPref();
is_synced_ = true;
if (!setting_value_ && observer_)
diff --git a/chrome/common/pref_member.h b/chrome/common/pref_member.h
index 9b5c70f..65f861a 100644
--- a/chrome/common/pref_member.h
+++ b/chrome/common/pref_member.h
@@ -25,7 +25,8 @@
#include <string>
-#include "chrome/common/notification_service.h"
+#include "base/basictypes.h"
+#include "chrome/common/notification_observer.h"
class PrefService;
diff --git a/chrome/common/pref_member_unittest.cc b/chrome/common/pref_member_unittest.cc
index d016674..1b11948 100644
--- a/chrome/common/pref_member_unittest.cc
+++ b/chrome/common/pref_member_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_member.h"
#include "chrome/common/pref_service.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -29,7 +30,7 @@ class PrefMemberTestClass : public NotificationObserver {
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(NOTIFY_PREF_CHANGED == type);
+ DCHECK(NotificationType::PREF_CHANGED == type);
PrefService* prefs_in = Source<PrefService>(source).ptr();
EXPECT_EQ(prefs_in, prefs_);
std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
diff --git a/chrome/common/pref_service.cc b/chrome/common/pref_service.cc
index 870e79e..e9daeba 100644
--- a/chrome/common/pref_service.cc
+++ b/chrome/common/pref_service.cc
@@ -623,7 +623,7 @@ void PrefService::FireObservers(const wchar_t* path) {
NotificationObserverList::Iterator it(*(observer_iterator->second));
NotificationObserver* observer;
while ((observer = it.GetNext()) != NULL) {
- observer->Observe(NOTIFY_PREF_CHANGED,
+ observer->Observe(NotificationType::PREF_CHANGED,
Source<PrefService>(this),
Details<std::wstring>(&path_str));
}
diff --git a/chrome/common/pref_service_unittest.cc b/chrome/common/pref_service_unittest.cc
index e35e44a..a798a84 100644
--- a/chrome/common/pref_service_unittest.cc
+++ b/chrome/common/pref_service_unittest.cc
@@ -7,7 +7,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/json_value_serializer.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/test/data/resource.h"
@@ -56,7 +56,7 @@ class TestPrefObserver : public NotificationObserver {
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- EXPECT_EQ(type, NOTIFY_PREF_CHANGED);
+ EXPECT_EQ(type.value, NotificationType::PREF_CHANGED);
PrefService* prefs_in = Source<PrefService>(source).ptr();
EXPECT_EQ(prefs_in, prefs_);
std::wstring* pref_name_in = Details<std::wstring>(details).ptr();
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index b63b655..587c517 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -4,8 +4,6 @@
#include "chrome/renderer/render_widget.h"
-#include <windows.h>
-
#include "base/gfx/point.h"
#include "base/gfx/size.h"
#include "base/logging.h"
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 581ddab..6d6cc96 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -107,7 +107,7 @@ void InProcessBrowserTest::TearDown() {
void InProcessBrowserTest::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_BROWSER_CLOSED) {
+ if (type == NotificationType::BROWSER_CLOSED) {
DCHECK(Source<Browser>(source).ptr() == browser_);
browser_ = NULL;
} else {
@@ -161,7 +161,9 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() {
browser_ = CreateBrowser(profile);
- registrar_.Add(this, NOTIFY_BROWSER_CLOSED, Source<Browser>(browser_));
+ registrar_.Add(this,
+ NotificationType::BROWSER_CLOSED,
+ Source<Browser>(browser_));
RunTestOnMainThread();
diff --git a/chrome/test/in_process_browser_test.h b/chrome/test/in_process_browser_test.h
index fb8bd9d..230b8df 100644
--- a/chrome/test/in_process_browser_test.h
+++ b/chrome/test/in_process_browser_test.h
@@ -7,7 +7,7 @@
#include "chrome/app/scoped_ole_initializer.h"
#include "chrome/common/notification_registrar.h"
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "net/url_request/url_request_unittest.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/test/test_notification_tracker.cc b/chrome/test/test_notification_tracker.cc
index 84f8869..d89ea16 100644
--- a/chrome/test/test_notification_tracker.cc
+++ b/chrome/test/test_notification_tracker.cc
@@ -3,10 +3,10 @@
// found in the LICENSE file.
#include "chrome/test/test_notification_tracker.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_service.h"
TestNotificationTracker::Event::Event()
- : type(NOTIFY_ALL),
+ : type(NotificationType::ALL),
source(NotificationService::AllSources()),
details(NotificationService::NoDetails()) {
}
diff --git a/chrome/test/testing_browser_process.h b/chrome/test/testing_browser_process.h
index 76f349c..d3a337b 100644
--- a/chrome/test/testing_browser_process.h
+++ b/chrome/test/testing_browser_process.h
@@ -7,8 +7,8 @@
// keep the profile clean. Clients of this class must handle the NULL return
// value, however.
-#ifndef CHROME_TEST_TESTING_BROWSER_PROCESS_H__
-#define CHROME_TEST_TESTING_BROWSER_PROCESS_H__
+#ifndef CHROME_TEST_TESTING_BROWSER_PROCESS_H_
+#define CHROME_TEST_TESTING_BROWSER_PROCESS_H_
#include "build/build_config.h"
@@ -130,5 +130,4 @@ class TestingBrowserProcess : public BrowserProcess {
DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess);
};
-#endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H__
-
+#endif // CHROME_TEST_TESTING_BROWSER_PROCESS_H_
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index 07016f7..1293f72 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -21,11 +21,11 @@ class NavigationNotificationObserver : public NotificationObserver {
public:
explicit NavigationNotificationObserver(NavigationController* controller)
: navigation_started_(false) {
- registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED,
+ registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
Source<NavigationController>(controller));
- registrar_.Add(this, NOTIFY_LOAD_START,
+ registrar_.Add(this, NotificationType::LOAD_START,
Source<NavigationController>(controller));
- registrar_.Add(this, NOTIFY_LOAD_STOP,
+ registrar_.Add(this, NotificationType::LOAD_STOP,
Source<NavigationController>(controller));
RunMessageLoop();
}
@@ -33,9 +33,10 @@ class NavigationNotificationObserver : public NotificationObserver {
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_NAV_ENTRY_COMMITTED || type == NOTIFY_LOAD_START) {
+ if (type == NotificationType::NAV_ENTRY_COMMITTED ||
+ type == NotificationType::LOAD_START) {
navigation_started_ = true;
- } else if (type == NOTIFY_LOAD_STOP) {
+ } else if (type == NotificationType::LOAD_STOP) {
if (navigation_started_) {
navigation_started_ = false;
MessageLoopForUI::current()->Quit();
diff --git a/chrome/views/focus_manager.cc b/chrome/views/focus_manager.cc
index 01eab17..6f73045 100644
--- a/chrome/views/focus_manager.cc
+++ b/chrome/views/focus_manager.cc
@@ -8,7 +8,7 @@
#include "base/logging.h"
#include "base/win_util.h"
#include "chrome/browser/renderer_host/render_widget_host_view_win.h"
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_service.h"
#include "chrome/views/accelerator.h"
#include "chrome/views/focus_manager.h"
#include "chrome/views/root_view.h"
@@ -212,7 +212,9 @@ FocusManager* FocusManager::CreateFocusManager(HWND window,
// We register for view removed notifications so we can make sure we don't
// keep references to invalidated views.
NotificationService::current()->AddObserver(
- focus_manager, NOTIFY_VIEW_REMOVED, NotificationService::AllSources());
+ focus_manager,
+ NotificationType::VIEW_REMOVED,
+ NotificationService::AllSources());
return focus_manager;
}
@@ -313,7 +315,9 @@ bool FocusManager::OnNCDestroy(HWND window) {
DCHECK(GetProp(window, kFocusManagerKey));
// Unregister notifications.
NotificationService::current()->RemoveObserver(
- this, NOTIFY_VIEW_REMOVED, NotificationService::AllSources());
+ this,
+ NotificationType::VIEW_REMOVED,
+ NotificationService::AllSources());
// Make sure this is called on the window that was set with the
// FocusManager.
@@ -792,7 +796,7 @@ AcceleratorTarget* FocusManager::GetTargetForAccelerator(
void FocusManager::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_VIEW_REMOVED);
+ DCHECK(type == NotificationType::VIEW_REMOVED);
if (focused_view_ && Source<View>(focused_view_) == source)
focused_view_ = NULL;
}
diff --git a/chrome/views/focus_manager.h b/chrome/views/focus_manager.h
index f254803..652e6e7 100644
--- a/chrome/views/focus_manager.h
+++ b/chrome/views/focus_manager.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_VIEWS_FOCUS_MANAGER_H__
-#define CHROME_VIEWS_FOCUS_MANAGER_H__
+#ifndef CHROME_VIEWS_FOCUS_MANAGER_H_
+#define CHROME_VIEWS_FOCUS_MANAGER_H_
#include "base/basictypes.h"
@@ -13,7 +13,7 @@
#include <vector>
#include <map>
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/views/accelerator.h"
// The FocusManager class is used to handle focus traversal, store/restore
@@ -340,10 +340,9 @@ class FocusManager : public NotificationObserver {
typedef std::vector<FocusChangeListener*> FocusChangeListenerList;
FocusChangeListenerList focus_change_listeners_;
- DISALLOW_EVIL_CONSTRUCTORS(FocusManager);
+ DISALLOW_COPY_AND_ASSIGN(FocusManager);
};
} // namespace views
-#endif // CHROME_VIEWS_FOCUS_MANAGER_H__
-
+#endif // CHROME_VIEWS_FOCUS_MANAGER_H_
diff --git a/chrome/views/native_control.cc b/chrome/views/native_control.cc
index 05e8cf8..3c0e8d0 100644
--- a/chrome/views/native_control.cc
+++ b/chrome/views/native_control.cc
@@ -9,8 +9,10 @@
#include <atlcrack.h>
#include <atlframe.h>
+#include "base/logging.h"
#include "base/win_util.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/views/background.h"
#include "chrome/views/border.h"
#include "chrome/views/focus_manager.h"
diff --git a/chrome/views/root_view.cc b/chrome/views/root_view.cc
index 4029e66..10c11fc 100644
--- a/chrome/views/root_view.cc
+++ b/chrome/views/root_view.cc
@@ -13,6 +13,7 @@
#include "base/message_loop.h"
#include "chrome/common/drag_drop_types.h"
#include "chrome/common/gfx/chrome_canvas.h"
+#include "chrome/common/notification_service.h"
#if defined(OS_WIN)
#include "chrome/views/root_view_drop_target.h"
#endif
@@ -252,9 +253,10 @@ void RootView::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
if (default_keyboard_hander_ == child) {
default_keyboard_hander_ = NULL;
}
- NotificationService::current()->
- Notify(NOTIFY_VIEW_REMOVED,
- Source<View>(child), Details<View>(parent));
+ NotificationService::current()->Notify(
+ NotificationType::VIEW_REMOVED,
+ Source<View>(child),
+ Details<View>(parent));
}
}
diff --git a/chrome/views/root_view_win.cc b/chrome/views/root_view_win.cc
index a843f1d..9b38e64f 100644
--- a/chrome/views/root_view_win.cc
+++ b/chrome/views/root_view_win.cc
@@ -5,6 +5,7 @@
#include "chrome/views/root_view.h"
#include "base/base_drag_source.h"
+#include "base/logging.h"
#include "chrome/common/drag_drop_types.h"
#include "chrome/views/root_view_drop_target.h"
diff --git a/chrome/views/view_storage.cc b/chrome/views/view_storage.cc
index f19c5c4..ed445f3 100644
--- a/chrome/views/view_storage.cc
+++ b/chrome/views/view_storage.cc
@@ -6,7 +6,7 @@
#include <algorithm>
-#include "chrome/common/notification_types.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/stl_util-inl.h"
namespace views {
@@ -52,14 +52,13 @@ void ViewStorage::DeleteSharedInstance() {
}
ViewStorage::ViewStorage() : view_storage_next_id_(0) {
- NotificationService::current()->
- AddObserver(this, NOTIFY_VIEW_REMOVED, NotificationService::AllSources());
+ NotificationService::current()->AddObserver(
+ this, NotificationType::VIEW_REMOVED, NotificationService::AllSources());
}
ViewStorage::~ViewStorage() {
- NotificationService::current()->
- RemoveObserver(this, NOTIFY_VIEW_REMOVED,
- NotificationService::AllSources());
+ NotificationService::current()->RemoveObserver(
+ this, NotificationType::VIEW_REMOVED, NotificationService::AllSources());
STLDeleteContainerPairSecondPointers(id_to_view_location_.begin(),
id_to_view_location_.end());
@@ -187,7 +186,7 @@ void ViewStorage::EraseView(int storage_id, bool remove_all_ids) {
void ViewStorage::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NOTIFY_VIEW_REMOVED);
+ DCHECK(type == NotificationType::VIEW_REMOVED);
// Let's first retrieve the ids for that view.
std::map<View*, std::vector<int>*>::iterator ids_iter =
diff --git a/chrome/views/view_storage.h b/chrome/views/view_storage.h
index b343139..a965158 100644
--- a/chrome/views/view_storage.h
+++ b/chrome/views/view_storage.h
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_VIEWS_VIEW_STORAGE_H__
-#define CHROME_VIEWS_VIEW_STORAGE_H__
+#ifndef CHROME_VIEWS_VIEW_STORAGE_H_
+#define CHROME_VIEWS_VIEW_STORAGE_H_
-#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_observer.h"
#include "chrome/views/view.h"
// This class is a simple storage place for storing/retrieving views. It is
@@ -72,10 +72,9 @@ class ViewStorage : public NotificationObserver {
// The singleton instance.
static ViewStorage* shared_instance_;
- DISALLOW_EVIL_CONSTRUCTORS(ViewStorage);
+ DISALLOW_COPY_AND_ASSIGN(ViewStorage);
};
} // namespace views
-#endif // #ifndef CHROME_VIEWS_VIEW_STORAGE_H__
-
+#endif // #ifndef CHROME_VIEWS_VIEW_STORAGE_H_
diff --git a/chrome/views/view_unittest.cc b/chrome/views/view_unittest.cc
index 48499a3..0b4ac94 100644
--- a/chrome/views/view_unittest.cc
+++ b/chrome/views/view_unittest.cc
@@ -4,6 +4,7 @@
#include "chrome/common/gfx/chrome_canvas.h"
#include "chrome/common/gfx/path.h"
+#include "chrome/common/notification_service.h"
#include "chrome/views/background.h"
#include "chrome/views/checkbox.h"
#include "chrome/views/dialog_delegate.h"
@@ -427,7 +428,7 @@ public:
void Observe(NotificationType type, const NotificationSource& source,
const NotificationDetails& details) {
- ASSERT_TRUE(type == NOTIFY_VIEW_REMOVED);
+ ASSERT_TRUE(type == NotificationType::VIEW_REMOVED);
removed_views_.push_back(Source<views::View>(source).ptr());
}
@@ -444,7 +445,9 @@ TEST_F(ViewTest, RemoveNotification) {
scoped_ptr<RemoveViewObserver> observer(new RemoveViewObserver);
NotificationService::current()->AddObserver(
- observer.get(), NOTIFY_VIEW_REMOVED, NotificationService::AllSources());
+ observer.get(),
+ NotificationType::VIEW_REMOVED,
+ NotificationService::AllSources());
views::WidgetWin* window = new views::WidgetWin;
views::RootView* root_view = window->GetRootView();
@@ -506,7 +509,7 @@ TEST_F(ViewTest, RemoveNotification) {
observer->WasRemoved(v111) && observer->WasRemoved(v112));
NotificationService::current()->RemoveObserver(observer.get(),
- NOTIFY_VIEW_REMOVED, NotificationService::AllSources());
+ NotificationType::VIEW_REMOVED, NotificationService::AllSources());
}
namespace {
diff --git a/chrome/views/widget_win.cc b/chrome/views/widget_win.cc
index 0cfc8e5..7268a59 100644
--- a/chrome/views/widget_win.cc
+++ b/chrome/views/widget_win.cc
@@ -9,6 +9,7 @@
#include "base/win_util.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/common/gfx/chrome_canvas.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/win_util.h"
#include "chrome/views/aero_tooltip_manager.h"
#include "chrome/views/accessibility/view_accessibility.h"
@@ -440,7 +441,7 @@ void WidgetWin::OnClose() {
// WARNING: this method is NOT called for all WidgetWins. If you need to do
// cleanup code before WidgetWin is destroyed, put it in OnDestroy.
NotificationService::current()->Notify(
- NOTIFY_WINDOW_CLOSED, Source<HWND>(hwnd_),
+ NotificationType::WINDOW_CLOSED, Source<HWND>(hwnd_),
NotificationService::NoDetails());
Close();
diff --git a/chrome/views/window.cc b/chrome/views/window.cc
index 5101efa..11e07f2b 100644
--- a/chrome/views/window.cc
+++ b/chrome/views/window.cc
@@ -9,6 +9,7 @@
#include "chrome/common/gfx/chrome_font.h"
#include "chrome/common/gfx/icon_util.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/resource_bundle.h"
#include "chrome/common/win_util.h"
@@ -231,7 +232,7 @@ void Window::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
// This window is closed when the last app window is closed.
- DCHECK(type == NOTIFY_ALL_APPWINDOWS_CLOSED);
+ DCHECK(type == NotificationType::ALL_APPWINDOWS_CLOSED);
// Only registered as an observer when we're not an app window.
// XXX DCHECK(!IsAppWindow());
Close();
@@ -294,7 +295,9 @@ void Window::Init(HWND parent, const gfx::Rect& bounds) {
if (!IsAppWindow()) {
notification_registrar_.Add(
- this, NOTIFY_ALL_APPWINDOWS_CLOSED, NotificationService::AllSources());
+ this,
+ NotificationType::ALL_APPWINDOWS_CLOSED,
+ NotificationService::AllSources());
}
}