summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-01 18:16:56 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-01 18:16:56 +0000
commitbfd04a62ce610d7bb61dbb78811dccbed23589b7 (patch)
tree70bb228c0f00ba1c12c584efd569daccf96b4026 /chrome/browser/views
parenta814d863440f0a154a7299f2d8b440f405c7700e (diff)
downloadchromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.zip
chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.gz
chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.bz2
Remove most header file dependencies on the notification type list. It is
really painful to add more types, since lots of headers include the notification service to derive from the notification observer. This splits that out, so much less of the project should end up including notification_types.h ---Paths modified but not in any changelist: Review URL: http://codereview.chromium.org/19744 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-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
19 files changed, 90 insertions, 68 deletions
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();