From c61064657291dcb38cfeff9dce6eb94950d776d9 Mon Sep 17 00:00:00 2001 From: "sadrul@chromium.org" Date: Tue, 1 Nov 2011 18:00:20 +0000 Subject: aura: Use the existing notification system. BUG=98331 TEST=none Review URL: http://codereview.chromium.org/8355042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108132 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/chromeos/cros_stubs_aura.cc | 24 ------------------ .../notifications/balloon_collection_views.cc | 12 +++++++++ .../ui/views/notifications/balloon_view_host.cc | 29 +++++++++++----------- 3 files changed, 27 insertions(+), 38 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/chromeos/cros_stubs_aura.cc b/chrome/browser/chromeos/cros_stubs_aura.cc index a6792f8..8627482 100644 --- a/chrome/browser/chromeos/cros_stubs_aura.cc +++ b/chrome/browser/chromeos/cros_stubs_aura.cc @@ -202,27 +202,3 @@ void ScreenLocker::ScreenLockReady() { } } // namespace chromeos - -class BalloonCollectionStub : public BalloonCollection { - public: - BalloonCollectionStub() {} - virtual ~BalloonCollectionStub() {} - private: - void Add(const Notification& notification, Profile* profile) {} - bool RemoveById(const std::string& id) { return true; } - bool RemoveBySourceOrigin(const GURL& source_origin) { return true; } - void RemoveAll() {} - bool HasSpace() const { return true; } - void ResizeBalloon(Balloon* balloon, const gfx::Size& size) {} - void SetPositionPreference(PositionPreference position) {} - void DisplayChanged() {} - void OnBalloonClosed(Balloon* source) {} - const Balloons& GetActiveBalloons() { return balloons_; } - - Balloons balloons_; -}; - -// static -BalloonCollection* BalloonCollection::Create() { - return new BalloonCollectionStub; -} diff --git a/chrome/browser/notifications/balloon_collection_views.cc b/chrome/browser/notifications/balloon_collection_views.cc index 3c5e6ac..c436df88 100644 --- a/chrome/browser/notifications/balloon_collection_views.cc +++ b/chrome/browser/notifications/balloon_collection_views.cc @@ -49,6 +49,18 @@ void BalloonCollectionImpl::DidProcessEvent(const base::NativeEvent& event) { HandleMouseMoveEvent(); break; } +#elif defined(USE_AURA) + // This is deliberately used only in linux. For an aura build on windows, the + // above block of code is fine. + switch (ui::EventTypeFromNative(event)) { + case ui::ET_MOUSE_MOVED: + case ui::ET_MOUSE_DRAGGED: + case ui::ET_MOUSE_EXITED: + HandleMouseMoveEvent(); + break; + default: + break; + } #else NOTIMPLEMENTED(); #endif diff --git a/chrome/browser/ui/views/notifications/balloon_view_host.cc b/chrome/browser/ui/views/notifications/balloon_view_host.cc index 952593c..dd24447 100644 --- a/chrome/browser/ui/views/notifications/balloon_view_host.cc +++ b/chrome/browser/ui/views/notifications/balloon_view_host.cc @@ -7,18 +7,18 @@ #include "chrome/browser/notifications/balloon.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" -#if defined(OS_WIN) +#include "content/public/browser/content_browser_client.h" +#include "views/widget/widget.h" + +#if defined(USE_AURA) +#include "content/browser/renderer_host/render_widget_host_view_aura.h" +#elif defined(OS_WIN) #include "content/browser/renderer_host/render_widget_host_view_win.h" -#endif -#if defined(TOOLKIT_USES_GTK) -#if defined(TOUCH_UI) || defined(USE_AURA) +#elif defined(TOUCH_UI) #include "chrome/browser/renderer_host/render_widget_host_view_views.h" -#else +#elif defined(TOOLKIT_USES_GTK) #include "content/browser/renderer_host/render_widget_host_view_gtk.h" #endif -#endif -#include "content/public/browser/content_browser_client.h" -#include "views/widget/widget.h" class BalloonViewHostView : public views::NativeViewHost { public: @@ -67,8 +67,11 @@ void BalloonViewHost::InitRenderWidgetHostView() { // TODO(johnnyg): http://crbug.com/23954. Need a cross-platform solution. #if defined(USE_AURA) - // TODO(beng): (same as touch_ui probably). - NOTIMPLEMENTED(); + RenderWidgetHostViewAura* view_aura = + static_cast(render_widget_host_view_); + view_aura->Init(); + view_aura->Show(); + native_host_->Attach(view_aura->GetNativeView()); #elif defined(OS_WIN) RenderWidgetHostViewWin* view_win = static_cast(render_widget_host_view_); @@ -77,18 +80,16 @@ void BalloonViewHost::InitRenderWidgetHostView() { HWND hwnd = view_win->Create(parent_native_view_); view_win->ShowWindow(SW_SHOW); native_host_->Attach(hwnd); -#elif defined(TOOLKIT_USES_GTK) -#if defined(TOUCH_UI) +#elif defined(TOUCH_UI) RenderWidgetHostViewViews* view_views = static_cast(render_widget_host_view_); view_views->InitAsChild(); native_host_->AttachToView(view_views); -#else +#elif defined(TOOLKIT_USES_GTK) RenderWidgetHostViewGtk* view_gtk = static_cast(render_widget_host_view_); view_gtk->InitAsChild(); native_host_->Attach(view_gtk->native_view()); -#endif #else NOTIMPLEMENTED(); #endif -- cgit v1.1