diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-01 18:16:56 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-01 18:16:56 +0000 |
commit | bfd04a62ce610d7bb61dbb78811dccbed23589b7 (patch) | |
tree | 70bb228c0f00ba1c12c584efd569daccf96b4026 /chrome/views | |
parent | a814d863440f0a154a7299f2d8b440f405c7700e (diff) | |
download | chromium_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/views')
-rw-r--r-- | chrome/views/focus_manager.cc | 12 | ||||
-rw-r--r-- | chrome/views/focus_manager.h | 11 | ||||
-rw-r--r-- | chrome/views/native_control.cc | 2 | ||||
-rw-r--r-- | chrome/views/root_view.cc | 8 | ||||
-rw-r--r-- | chrome/views/root_view_win.cc | 1 | ||||
-rw-r--r-- | chrome/views/view_storage.cc | 13 | ||||
-rw-r--r-- | chrome/views/view_storage.h | 11 | ||||
-rw-r--r-- | chrome/views/view_unittest.cc | 9 | ||||
-rw-r--r-- | chrome/views/widget_win.cc | 3 | ||||
-rw-r--r-- | chrome/views/window.cc | 7 |
10 files changed, 45 insertions, 32 deletions
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()); } } |