summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-04 00:10:47 +0000
committeroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-04 00:10:47 +0000
commit2e5597c7a7dad2a5255979752de155358c485ad4 (patch)
tree13ba82ec946edc07c058ed35cf2999d402914033
parent8e1eaf972ae4e682b00a75fe4bfc54b2da2199b3 (diff)
downloadchromium_src-2e5597c7a7dad2a5255979752de155358c485ad4.zip
chromium_src-2e5597c7a7dad2a5255979752de155358c485ad4.tar.gz
chromium_src-2e5597c7a7dad2a5255979752de155358c485ad4.tar.bz2
Consolidate message observer API for MessagePumpX and MessagePumWin
This is an attempt to simplify the code around message pump observer. BUG=none TEST=none Review URL: http://codereview.chromium.org/8021009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103825 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/message_loop.h2
-rw-r--r--base/message_pump_observer.h54
-rw-r--r--base/message_pump_win.cc8
-rw-r--r--base/message_pump_win.h24
-rw-r--r--base/message_pump_x.cc18
-rw-r--r--base/message_pump_x.h21
-rw-r--r--chrome/browser/automation/ui_controls_gtk.cc10
-rw-r--r--chrome/browser/chromeos/system_key_event_listener.cc11
-rw-r--r--chrome/browser/chromeos/system_key_event_listener.h5
-rw-r--r--chrome/browser/jankometer.cc18
-rw-r--r--chrome/browser/notifications/balloon_collection_gtk.cc (renamed from chrome/browser/notifications/balloon_collection_linux.cc)14
-rw-r--r--chrome/browser/notifications/balloon_collection_impl.h14
-rw-r--r--chrome/browser/notifications/balloon_collection_win.cc9
-rw-r--r--chrome/browser/ui/panels/panel_browser_frame_view.cc19
-rw-r--r--chrome/browser/ui/panels/panel_browser_frame_view.h9
-rw-r--r--chrome/browser/ui/panels/panel_browser_view_browsertest.cc6
-rw-r--r--chrome/browser/ui/views/html_dialog_view_browsertest.cc37
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view.h2
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_controller.cc20
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_controller.h9
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--views/mouse_watcher.cc27
-rw-r--r--views/widget/native_widget_gtk.cc9
-rw-r--r--views/widget/native_widget_win.cc6
-rw-r--r--views/widget/native_widget_win.h5
-rw-r--r--views/widget/tooltip_manager_views.cc19
-rw-r--r--views/widget/tooltip_manager_views.h10
27 files changed, 251 insertions, 137 deletions
diff --git a/base/message_loop.h b/base/message_loop.h
index fffcd2f..bc98c4c 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -84,7 +84,7 @@ class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate {
public:
#if defined(OS_WIN)
typedef base::MessagePumpWin::Dispatcher Dispatcher;
- typedef base::MessagePumpForUI::Observer Observer;
+ typedef base::MessagePumpObserver Observer;
#elif !defined(OS_MACOSX) && !defined(OS_ANDROID)
typedef base::MessagePumpDispatcher Dispatcher;
typedef base::MessagePumpObserver Observer;
diff --git a/base/message_pump_observer.h b/base/message_pump_observer.h
new file mode 100644
index 0000000..d12f221
--- /dev/null
+++ b/base/message_pump_observer.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_MESSAGE_PUMP_OBSERVER_H
+#define BASE_MESSAGE_PUMP_OBSERVER_H
+
+#if defined(USE_X11)
+typedef union _XEvent XEvent;
+#endif
+
+namespace base {
+
+#if defined(OS_WIN)
+typedef MSG NativeEvent;
+#elif defined(USE_X11)
+typedef XEvent* NativeEvent;
+#endif
+
+enum EventStatus {
+ EVENT_CONTINUE, // The event should be dispatched as normal.
+#if defined(USE_X11)
+ EVENT_HANDLED // The event should not be processed any farther.
+#endif
+};
+
+// A MessagePumpObserver is an object that receives global
+// notifications from the UI MessageLoop with MessagePumpWin or
+// MessagePumpX.
+//
+// NOTE: An Observer implementation should be extremely fast!
+//
+// For use with MessagePumpX, please see message_pump_glib.h for more
+// info about how this is invoked in this environment.
+class BASE_EXPORT MessagePumpObserver {
+ public:
+ // This method is called before processing a NativeEvent. If the
+ // method returns EVENT_HANDLED, it indicates the event has already
+ // been handled, so the event is not processed any farther. If the
+ // method returns EVENT_CONTINUE, the event dispatching proceeds as
+ // normal.
+ virtual EventStatus WillProcessEvent(const NativeEvent& event) = 0;
+
+ // This method is called after processing a message. This method
+ // will not be called if WillProcessEvent returns EVENT_HANDLED.
+ virtual void DidProcessEvent(const NativeEvent& event) = 0;
+
+ protected:
+ virtual ~MessagePumpObserver() {}
+};
+
+} // namespace base
+
+#endif // BASE_MESSAGE_PUMP_OBSERVER_VIEWS_H
diff --git a/base/message_pump_win.cc b/base/message_pump_win.cc
index 9d0ec53..740ddd9 100644
--- a/base/message_pump_win.cc
+++ b/base/message_pump_win.cc
@@ -21,20 +21,20 @@ static const int kMsgHaveWork = WM_USER + 1;
//-----------------------------------------------------------------------------
// MessagePumpWin public:
-void MessagePumpWin::AddObserver(Observer* observer) {
+void MessagePumpWin::AddObserver(MessagePumpObserver* observer) {
observers_.AddObserver(observer);
}
-void MessagePumpWin::RemoveObserver(Observer* observer) {
+void MessagePumpWin::RemoveObserver(MessagePumpObserver* observer) {
observers_.RemoveObserver(observer);
}
void MessagePumpWin::WillProcessMessage(const MSG& msg) {
- FOR_EACH_OBSERVER(Observer, observers_, WillProcessMessage(msg));
+ FOR_EACH_OBSERVER(MessagePumpObserver, observers_, WillProcessEvent(msg));
}
void MessagePumpWin::DidProcessMessage(const MSG& msg) {
- FOR_EACH_OBSERVER(Observer, observers_, DidProcessMessage(msg));
+ FOR_EACH_OBSERVER(MessagePumpObserver, observers_, DidProcessEvent(msg));
}
void MessagePumpWin::RunWithDispatcher(
diff --git a/base/message_pump_win.h b/base/message_pump_win.h
index 5f17610..d0d32f6 100644
--- a/base/message_pump_win.h
+++ b/base/message_pump_win.h
@@ -13,6 +13,7 @@
#include "base/base_export.h"
#include "base/basictypes.h"
#include "base/message_pump.h"
+#include "base/message_pump_observer.h"
#include "base/observer_list.h"
#include "base/time.h"
#include "base/win/scoped_handle.h"
@@ -24,23 +25,6 @@ namespace base {
// controlling the lifetime of the message pump.
class BASE_EXPORT MessagePumpWin : public MessagePump {
public:
- // An Observer is an object that receives global notifications from the
- // UI MessageLoop.
- //
- // NOTE: An Observer implementation should be extremely fast!
- //
- class BASE_EXPORT Observer {
- public:
- virtual ~Observer() {}
-
- // This method is called before processing a message.
- // The message may be undefined in which case msg.message is 0
- virtual void WillProcessMessage(const MSG& msg) = 0;
-
- // This method is called when control returns from processing a UI message.
- // The message may be undefined in which case msg.message is 0
- virtual void DidProcessMessage(const MSG& msg) = 0;
- };
// Dispatcher is used during a nested invocation of Run to dispatch events.
// If Run is invoked with a non-NULL Dispatcher, MessageLoop does not
@@ -62,11 +46,11 @@ class BASE_EXPORT MessagePumpWin : public MessagePump {
virtual ~MessagePumpWin() {}
// Add an Observer, which will start receiving notifications immediately.
- void AddObserver(Observer* observer);
+ void AddObserver(MessagePumpObserver* observer);
// Remove an Observer. It is safe to call this method while an Observer is
// receiving a notification callback.
- void RemoveObserver(Observer* observer);
+ void RemoveObserver(MessagePumpObserver* observer);
// Give a chance to code processing additional messages to notify the
// message loop observers that another message has been processed.
@@ -95,7 +79,7 @@ class BASE_EXPORT MessagePumpWin : public MessagePump {
virtual void DoRunLoop() = 0;
int GetCurrentDelay() const;
- ObserverList<Observer> observers_;
+ ObserverList<MessagePumpObserver> observers_;
// The time at which delayed work should run.
TimeTicks delayed_work_time_;
diff --git a/base/message_pump_x.cc b/base/message_pump_x.cc
index 33ca2d5..45f24a6 100644
--- a/base/message_pump_x.cc
+++ b/base/message_pump_x.cc
@@ -193,7 +193,7 @@ bool MessagePumpX::ProcessXEvent(XEvent* xev) {
have_cookie = true;
}
- if (WillProcessXEvent(xev) == MessagePumpObserver::EVENT_CONTINUE) {
+ if (WillProcessXEvent(xev) == EVENT_CONTINUE) {
MessagePumpDispatcher::DispatchStatus status =
GetDispatcher()->Dispatch(xev);
@@ -203,6 +203,7 @@ bool MessagePumpX::ProcessXEvent(XEvent* xev) {
} else if (status == MessagePumpDispatcher::EVENT_IGNORED) {
VLOG(1) << "Event (" << xev->type << ") not handled.";
}
+ DidProcessXEvent(xev);
}
if (have_cookie) {
@@ -264,12 +265,20 @@ bool MessagePumpX::WillProcessXEvent(XEvent* xevent) {
ObserverListBase<MessagePumpObserver>::Iterator it(observers());
MessagePumpObserver* obs;
while ((obs = it.GetNext()) != NULL) {
- if (obs->WillProcessXEvent(xevent))
+ if (obs->WillProcessEvent(xevent))
return true;
}
return false;
}
+void MessagePumpX::DidProcessXEvent(XEvent* xevent) {
+ ObserverListBase<MessagePumpObserver>::Iterator it(observers());
+ MessagePumpObserver* obs;
+ while ((obs = it.GetNext()) != NULL) {
+ obs->DidProcessEvent(xevent);
+ }
+}
+
#if defined(TOOLKIT_USES_GTK)
GdkFilterReturn MessagePumpX::GdkEventFilter(GdkXEvent* gxevent,
GdkEvent* gevent,
@@ -328,9 +337,4 @@ COMPILE_ASSERT(XLASTEvent >= LASTEvent, XLASTEvent_too_small);
#endif // defined(TOOLKIT_USES_GTK)
-MessagePumpObserver::EventStatus
- MessagePumpObserver::WillProcessXEvent(XEvent* xev) {
- return EVENT_CONTINUE;
-}
-
} // namespace base
diff --git a/base/message_pump_x.h b/base/message_pump_x.h
index eab6f6b..39d7d9c 100644
--- a/base/message_pump_x.h
+++ b/base/message_pump_x.h
@@ -7,6 +7,7 @@
#include "base/message_pump.h"
#include "base/message_pump_glib.h"
+#include "base/message_pump_observer.h"
#include <bitset>
@@ -16,30 +17,11 @@
#include <gtk/gtk.h>
#endif
-typedef union _XEvent XEvent;
typedef struct _XDisplay Display;
namespace base {
// The documentation for this class is in message_pump_glib.h
-class BASE_EXPORT MessagePumpObserver {
- public:
- enum EventStatus {
- EVENT_CONTINUE, // The event should be dispatched as normal.
- EVENT_HANDLED // The event should not be processed any farther.
- };
-
- // This method is called before processing an XEvent. If the method returns
- // EVENT_HANDLED, it indicates the event has already been handled, so the
- // event is not processed any farther. If the method returns EVENT_CONTINUE,
- // the event dispatching proceeds as normal.
- virtual EventStatus WillProcessXEvent(XEvent* xevent);
-
- protected:
- virtual ~MessagePumpObserver() {}
-};
-
-// The documentation for this class is in message_pump_glib.h
//
// The nested loop is exited by either posting a quit, or returning EVENT_QUIT
// from Dispatch.
@@ -97,6 +79,7 @@ class BASE_EXPORT MessagePumpX : public MessagePumpGlib {
// not send the event to any other observers and returns true. Returns false
// if no observer returns true.
bool WillProcessXEvent(XEvent* xevent);
+ void DidProcessXEvent(XEvent* xevent);
#if defined(TOOLKIT_USES_GTK)
// Some XEvent's can't be directly read from X event queue and will go
// through GDK's dispatching process and may get discarded. This function
diff --git a/chrome/browser/automation/ui_controls_gtk.cc b/chrome/browser/automation/ui_controls_gtk.cc
index 6c7c5f7..db52ea2 100644
--- a/chrome/browser/automation/ui_controls_gtk.cc
+++ b/chrome/browser/automation/ui_controls_gtk.cc
@@ -41,7 +41,16 @@ class EventWaiter : public MessageLoopForUI::Observer {
virtual ~EventWaiter() {
MessageLoopForUI::current()->RemoveObserver(this);
}
+#if defined(TOUCH_UI)
+ // MessageLoop::Observer implementation:
+ virtual base::EventStatus WillProcessEvent(const base::NativeEvent& event) {
+ NOTIMPLEMENTED();
+ return base::EVENT_CONTINUE;
+ }
+ virtual void DidProcessEvent(const base::NativeEvent& event) {
+ }
+#else
// MessageLoop::Observer implementation:
virtual void WillProcessEvent(GdkEvent* event) {
if ((event->type == type_) && (--count_ == 0)) {
@@ -59,6 +68,7 @@ class EventWaiter : public MessageLoopForUI::Observer {
virtual void DidProcessEvent(GdkEvent* event) {
// No-op.
}
+#endif
private:
// We pass ownership of task_ to MessageLoop when the current event is
diff --git a/chrome/browser/chromeos/system_key_event_listener.cc b/chrome/browser/chromeos/system_key_event_listener.cc
index 4a168a9..8a666ec 100644
--- a/chrome/browser/chromeos/system_key_event_listener.cc
+++ b/chrome/browser/chromeos/system_key_event_listener.cc
@@ -176,10 +176,13 @@ void SystemKeyEventListener::ProcessWmMessage(const WmIpc::Message& message,
}
}
-#if defined(TOUCH_UI)
-base::MessagePumpObserver::EventStatus
- SystemKeyEventListener::WillProcessXEvent(XEvent* xevent) {
- return ProcessedXEvent(xevent) ? EVENT_HANDLED : EVENT_CONTINUE;
+#if defined(TOUCH_UI) || defined(USE_AURA)
+base::EventStatus SystemKeyEventListener::WillProcessEvent(
+ const base::NativeEvent& event) {
+ return ProcessedXEvent(event) ? EVENT_HANDLED : EVENT_CONTINUE;
+}
+
+void SystemKeyEventListener::DidProcessEvent(const NativeEvent& event) {
}
#else // defined(TOUCH_UI)
// static
diff --git a/chrome/browser/chromeos/system_key_event_listener.h b/chrome/browser/chromeos/system_key_event_listener.h
index 9cfd844..9b66995 100644
--- a/chrome/browser/chromeos/system_key_event_listener.h
+++ b/chrome/browser/chromeos/system_key_event_listener.h
@@ -56,9 +56,10 @@ class SystemKeyEventListener : public WmMessageListener::Observer,
AudioHandler* GetAudioHandler() const;
-#if defined(TOUCH_UI)
+#if defined(TOUCH_UI) || defined(USE_AURA)
// MessageLoopForUI::Observer overrides.
- virtual EventStatus WillProcessXEvent(XEvent* xevent) OVERRIDE;
+ virtual EventStatus WillProcessEvent(const NativeEvent& event) OVERRIDE;
+ virtual void DidProcessEvent(const NativeEvent& event) OVERRIDE;
#else
// This event filter intercepts events before they reach GDK, allowing us to
// check for system level keyboard events regardless of which window has
diff --git a/chrome/browser/jankometer.cc b/chrome/browser/jankometer.cc
index eeb4a18..e9919e5 100644
--- a/chrome/browser/jankometer.cc
+++ b/chrome/browser/jankometer.cc
@@ -304,9 +304,10 @@ class UIJankObserver : public base::RefCountedThreadSafe<UIJankObserver>,
}
#if defined(OS_WIN)
- virtual void WillProcessMessage(const MSG& msg) {
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE {
if (!helper_.MessageWillBeMeasured())
- return;
+ return base::EVENT_CONTINUE;
// GetMessageTime returns a LONG (signed 32-bit) and GetTickCount returns
// a DWORD (unsigned 32-bit). They both wrap around when the time is longer
// than they can hold. I'm not sure if GetMessageTime wraps around to 0,
@@ -316,17 +317,26 @@ class UIJankObserver : public base::RefCountedThreadSafe<UIJankObserver>,
// Therefore, I cast to DWORD so if it wraps to -1 we will correct it. If
// it doesn't, then our time delta will be negative if a message happens
// to straddle the wraparound point, it will still be OK.
- DWORD cur_message_issue_time = static_cast<DWORD>(msg.time);
+ DWORD cur_message_issue_time = static_cast<DWORD>(event.time);
DWORD cur_time = GetTickCount();
base::TimeDelta queueing_time =
base::TimeDelta::FromMilliseconds(cur_time - cur_message_issue_time);
helper_.StartProcessingTimers(queueing_time);
+ return base::EVENT_CONTINUE;
}
- virtual void DidProcessMessage(const MSG& msg) {
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
helper_.EndProcessingTimers();
}
+#elif defined(TOUCH_UI) || defined(USE_AURA)
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE {
+ return base::EVENT_CONTINUE;
+ }
+
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
+ }
#elif defined(TOOLKIT_USES_GTK)
virtual void WillProcessEvent(GdkEvent* event) {
if (!helper_.MessageWillBeMeasured())
diff --git a/chrome/browser/notifications/balloon_collection_linux.cc b/chrome/browser/notifications/balloon_collection_gtk.cc
index 0255ae8..2420735 100644
--- a/chrome/browser/notifications/balloon_collection_linux.cc
+++ b/chrome/browser/notifications/balloon_collection_gtk.cc
@@ -39,6 +39,19 @@ void BalloonCollectionImpl::PositionBalloons(bool reposition) {
PositionBalloonsInternal(reposition);
}
+#if defined(TOUCH_UI)
+base::EventStatus BalloonCollectionImpl::WillProcessEvent(
+ const base::NativeEvent& event) {
+ return base::EVENT_CONTINUE;
+}
+
+void BalloonCollectionImpl::DidProcessEvent(const base::NativeEvent& event) {
+ NOTIMPLEMENTED();
+}
+#else
+void BalloonCollectionImpl::WillProcessEvent(GdkEvent* event) {
+}
+
void BalloonCollectionImpl::DidProcessEvent(GdkEvent* event) {
switch (event->type) {
case GDK_MOTION_NOTIFY:
@@ -49,6 +62,7 @@ void BalloonCollectionImpl::DidProcessEvent(GdkEvent* event) {
break;
}
}
+#endif
bool BalloonCollectionImpl::IsCursorInBalloonCollection() const {
GdkScreen* screen = gdk_screen_get_default();
diff --git a/chrome/browser/notifications/balloon_collection_impl.h b/chrome/browser/notifications/balloon_collection_impl.h
index 2680146..2f8e0f7 100644
--- a/chrome/browser/notifications/balloon_collection_impl.h
+++ b/chrome/browser/notifications/balloon_collection_impl.h
@@ -54,13 +54,13 @@ class BalloonCollectionImpl : public BalloonCollection
virtual const Balloons& GetActiveBalloons();
// MessageLoopForUI::Observer interface.
-#if defined(OS_WIN)
- virtual void WillProcessMessage(const MSG& event) {}
- virtual void DidProcessMessage(const MSG& event);
-#endif
-#if defined(TOOLKIT_USES_GTK)
- virtual void WillProcessEvent(GdkEvent* event) {}
- virtual void DidProcessEvent(GdkEvent* event);
+#if defined(OS_WIN) || defined(TOUCH_UI) || defined(USE_AURA)
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE;
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
+#elif defined(TOOLKIT_USES_GTK)
+ virtual void WillProcessEvent(GdkEvent* event) OVERRIDE;
+ virtual void DidProcessEvent(GdkEvent* event) OVERRIDE;
#endif
protected:
diff --git a/chrome/browser/notifications/balloon_collection_win.cc b/chrome/browser/notifications/balloon_collection_win.cc
index 821b5f4..15690a0 100644
--- a/chrome/browser/notifications/balloon_collection_win.cc
+++ b/chrome/browser/notifications/balloon_collection_win.cc
@@ -33,8 +33,13 @@ void BalloonCollectionImpl::PositionBalloons(bool reposition) {
PositionBalloonsInternal(reposition);
}
-void BalloonCollectionImpl::DidProcessMessage(const MSG& msg) {
- switch (msg.message) {
+base::EventStatus BalloonCollectionImpl::WillProcessEvent(
+ const base::NativeEvent& event) {
+ return base::EVENT_CONTINUE;
+}
+
+void BalloonCollectionImpl::DidProcessEvent(const base::NativeEvent& event) {
+ switch (event.message) {
case WM_MOUSEMOVE:
case WM_MOUSELEAVE:
case WM_NCMOUSELEAVE:
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc
index a72c266..b76a1e1 100644
--- a/chrome/browser/ui/panels/panel_browser_frame_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc
@@ -170,11 +170,14 @@ bool PanelBrowserFrameView::MouseWatcher::IsCursorInViewBounds() const {
}
#if defined(OS_WIN)
-void PanelBrowserFrameView::MouseWatcher::WillProcessMessage(const MSG& msg) {
+base::EventStatus PanelBrowserFrameView::MouseWatcher::WillProcessEvent(
+ const base::NativeEvent& event) {
+ return base::EVENT_CONTINUE;
}
-void PanelBrowserFrameView::MouseWatcher::DidProcessMessage(const MSG& msg) {
- switch (msg.message) {
+void PanelBrowserFrameView::MouseWatcher::DidProcessEvent(
+ const base::NativeEvent& event) {
+ switch (event.message) {
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
case WM_MOUSELEAVE:
@@ -185,6 +188,16 @@ void PanelBrowserFrameView::MouseWatcher::DidProcessMessage(const MSG& msg) {
break;
}
}
+#elif defined(TOUCH_UI) || defined(USE_AURA)
+base::EventStatus PanelBrowserFrameView::MouseWatcher::WillProcessEvent(
+ const base::NativeEvent& event) {
+ return base::EVENT_CONTINUE;
+}
+
+void PanelBrowserFrameView::MouseWatcher::DidProcessEvent(
+ const base::NativeEvent& event) {
+ NOTIMPLEMENTED();
+}
#elif defined(TOOLKIT_USES_GTK)
void PanelBrowserFrameView::MouseWatcher::WillProcessEvent(GdkEvent* event) {
}
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.h b/chrome/browser/ui/panels/panel_browser_frame_view.h
index d761b7a..f204c92 100644
--- a/chrome/browser/ui/panels/panel_browser_frame_view.h
+++ b/chrome/browser/ui/panels/panel_browser_frame_view.h
@@ -114,14 +114,13 @@ class PanelBrowserFrameView : public BrowserNonClientFrameView,
virtual bool IsCursorInViewBounds() const;
- #if defined(OS_WIN)
- virtual void WillProcessMessage(const MSG& msg) OVERRIDE;
- virtual void DidProcessMessage(const MSG& msg) OVERRIDE;
+ #if defined(OS_WIN) || defined(TOUCH_UI) || defined(USE_AURA)
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE;
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
#elif defined(TOOLKIT_USES_GTK)
virtual void WillProcessEvent(GdkEvent* event) OVERRIDE;
virtual void DidProcessEvent(GdkEvent* event) OVERRIDE;
- #elif defined(USE_AURA)
- virtual EventStatus WillProcessXEvent(XEvent* xevent) OVERRIDE;
#endif
private:
diff --git a/chrome/browser/ui/panels/panel_browser_view_browsertest.cc b/chrome/browser/ui/panels/panel_browser_view_browsertest.cc
index d622574..f1eef17 100644
--- a/chrome/browser/ui/panels/panel_browser_view_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_browser_view_browsertest.cc
@@ -48,8 +48,10 @@ class PanelBrowserViewTest : public BasePanelBrowserTest {
#if defined(OS_WIN)
MSG msg;
msg.message = WM_MOUSEMOVE;
- DidProcessMessage(msg);
-#else
+ DidProcessEvent(msg);
+#elif defined(TOUCH_UI) || defined(USE_AURA)
+ NOTIMPLEMENTED();
+#elif defined(TOOLKIT_USES_GTK)
GdkEvent event;
event.type = GDK_MOTION_NOTIFY;
DidProcessEvent(&event);
diff --git a/chrome/browser/ui/views/html_dialog_view_browsertest.cc b/chrome/browser/ui/views/html_dialog_view_browsertest.cc
index 276e28b..ab27321 100644
--- a/chrome/browser/ui/views/html_dialog_view_browsertest.cc
+++ b/chrome/browser/ui/views/html_dialog_view_browsertest.cc
@@ -67,7 +67,6 @@ class HtmlDialogBrowserTest : public InProcessBrowserTest {
public:
HtmlDialogBrowserTest() {}
-#if defined(OS_WIN)
class WindowChangedObserver : public MessageLoopForUI::Observer {
public:
WindowChangedObserver() {}
@@ -76,41 +75,49 @@ class HtmlDialogBrowserTest : public InProcessBrowserTest {
return Singleton<WindowChangedObserver>::get();
}
+#if defined(OS_WIN)
// This method is called before processing a message.
- virtual void WillProcessMessage(const MSG& msg) {}
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE {
+ return base::EVENT_CONTINUE;
+ }
// This method is called after processing a message.
- virtual void DidProcessMessage(const MSG& msg) {
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
// Either WM_PAINT or WM_TIMER indicates the actual work of
// pushing through the window resizing messages is done since
// they are lower priority (we don't get to see the
// WM_WINDOWPOSCHANGED message here).
- if (msg.message == WM_PAINT || msg.message == WM_TIMER)
+ if (event.message == WM_PAINT || event.message == WM_TIMER)
MessageLoop::current()->Quit();
}
- };
-#elif !defined(OS_MACOSX)
- class WindowChangedObserver : public MessageLoopForUI::Observer {
- public:
- WindowChangedObserver() {}
-
- static WindowChangedObserver* GetInstance() {
- return Singleton<WindowChangedObserver>::get();
+#elif defined(TOUCH_UI) || defined(USE_AURA)
+ // This method is called before processing a message.
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE {
+ return base::EVENT_CONTINUE;
}
+ // This method is called after processing a message.
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
+ // TODO(oshima): X11/Xlib.h imports various definitions that
+ // caused compilation error.
+ NOTIMPLEMENTED();
+ }
+#elif defined(TOOLKIT_USES_GTK)
// This method is called before processing a message.
- virtual void WillProcessEvent(GdkEvent* event) {}
+ virtual void WillProcessEvent(GdkEvent* event) OVERRIDE {}
// This method is called after processing a message.
- virtual void DidProcessEvent(GdkEvent* event) {
+ virtual void DidProcessEvent(GdkEvent* event) OVERRIDE {
// Quit once the GDK_CONFIGURE event has been processed - seeing
// this means the window sizing request that was made actually
// happened.
if (event->type == GDK_CONFIGURE)
MessageLoop::current()->Quit();
}
- };
#endif
+ };
};
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
diff --git a/chrome/browser/ui/views/notifications/balloon_view.h b/chrome/browser/ui/views/notifications/balloon_view.h
index be1195e..a06932c 100644
--- a/chrome/browser/ui/views/notifications/balloon_view.h
+++ b/chrome/browser/ui/views/notifications/balloon_view.h
@@ -52,7 +52,7 @@ class BalloonViewImpl : public BalloonView,
public ui::AnimationDelegate {
public:
explicit BalloonViewImpl(BalloonCollection* collection);
- ~BalloonViewImpl();
+ virtual ~BalloonViewImpl();
// BalloonView interface.
virtual void Show(Balloon* balloon) OVERRIDE;
diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
index ab44dd5..00d9a5c 100644
--- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
@@ -505,21 +505,27 @@ void DraggedTabController::Observe(int type,
// DraggedTabController, MessageLoop::Observer implementation:
#if defined(OS_WIN)
-void DraggedTabController::WillProcessMessage(const MSG& msg) {
+base::EventStatus DraggedTabController::WillProcessEvent(
+ const base::NativeEvent& event) {
+ return base::EVENT_CONTINUE;
}
-void DraggedTabController::DidProcessMessage(const MSG& msg) {
+void DraggedTabController::DidProcessEvent(const base::NativeEvent& event) {
// If the user presses ESC during a drag, we need to abort and revert things
// to the way they were. This is the most reliable way to do this since no
// single view or window reliably receives events throughout all the various
// kinds of tab dragging.
- if (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE)
+ if (event.message == WM_KEYDOWN && event.wParam == VK_ESCAPE)
EndDrag(true);
}
-#elif defined(TOUCH_UI)
-base::MessagePumpObserver::EventStatus
- DraggedTabController::WillProcessXEvent(XEvent* xevent) {
- return EVENT_CONTINUE;
+#elif defined(TOUCH_UI) || defined(USE_AURA)
+base::EventStatus DraggedTabController::WillProcessEvent(
+ const base::NativeEvent& event) {
+ return base::EVENT_CONTINUE;
+}
+
+void DraggedTabController::DidProcessEvent(const base::NativeEvent& event) {
+ NOTIMPLEMENTED();
}
#elif defined(TOOLKIT_USES_GTK)
void DraggedTabController::WillProcessEvent(GdkEvent* event) {
diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.h b/chrome/browser/ui/views/tabs/dragged_tab_controller.h
index 1e30728..b2f22ea 100644
--- a/chrome/browser/ui/views/tabs/dragged_tab_controller.h
+++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.h
@@ -153,11 +153,10 @@ class DraggedTabController : public TabContentsDelegate,
const NotificationDetails& details) OVERRIDE;
// Overridden from MessageLoop::Observer:
-#if defined(OS_WIN)
- virtual void WillProcessMessage(const MSG& msg) OVERRIDE;
- virtual void DidProcessMessage(const MSG& msg) OVERRIDE;
-#elif defined(TOUCH_UI)
- virtual EventStatus WillProcessXEvent(XEvent* xevent) OVERRIDE;
+#if defined(OS_WIN) || defined(TOUCH_UI) || defined(USE_AURA)
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE;
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
#elif defined(TOOLKIT_USES_GTK)
virtual void WillProcessEvent(GdkEvent* event) OVERRIDE;
virtual void DidProcessEvent(GdkEvent* event) OVERRIDE;
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index b04b297..33d9e402 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1596,7 +1596,7 @@
'browser/notifications/balloon_collection_base.h',
'browser/notifications/balloon_collection_impl.cc',
'browser/notifications/balloon_collection_impl.h',
- 'browser/notifications/balloon_collection_linux.cc',
+ 'browser/notifications/balloon_collection_gtk.cc',
'browser/notifications/balloon_collection_mac.mm',
'browser/notifications/balloon_collection_win.cc',
'browser/notifications/balloon_host.cc',
diff --git a/views/mouse_watcher.cc b/views/mouse_watcher.cc
index df5adeb..5daab25 100644
--- a/views/mouse_watcher.cc
+++ b/views/mouse_watcher.cc
@@ -35,10 +35,12 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
// MessageLoop::Observer implementation:
#if defined(OS_WIN)
- void WillProcessMessage(const MSG& msg) OVERRIDE {
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE {
+ return base::EVENT_CONTINUE;
}
- void DidProcessMessage(const MSG& msg) OVERRIDE {
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
// We spy on three different Windows messages here to see if the mouse has
// moved out of the bounds of the view. The messages are:
//
@@ -50,7 +52,7 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
// WM_NCMOUSELEAVE:
// For notification when the mouse leaves the _non-client_ area.
//
- switch (msg.message) {
+ switch (event.message) {
case WM_MOUSEMOVE:
HandleGlobalMouseMoveEvent(false);
break;
@@ -61,7 +63,7 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
}
}
#elif defined(USE_WAYLAND)
- MessageLoopForUI::Observer::EventStatus WillProcessEvent(
+ virtual MessageLoopForUI::Observer::EventStatus WillProcessEvent(
ui::WaylandEvent* event) OVERRIDE {
switch (event->type) {
case ui::WAYLAND_MOTION:
@@ -76,11 +78,19 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
}
return EVENT_CONTINUE;
}
+#elif defined(TOUCH_UI) || defined(USE_AURA)
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE {
+ return base::EVENT_CONTINUE;
+ }
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
+ NOTIMPLEMENTED();
+ }
#elif defined(TOOLKIT_USES_GTK)
- void WillProcessEvent(GdkEvent* event) OVERRIDE {
+ virtual void WillProcessEvent(GdkEvent* event) OVERRIDE {
}
- void DidProcessEvent(GdkEvent* event) OVERRIDE {
+ virtual void DidProcessEvent(GdkEvent* event) OVERRIDE {
switch (event->type) {
case GDK_MOTION_NOTIFY:
HandleGlobalMouseMoveEvent(false);
@@ -92,11 +102,6 @@ class MouseWatcher::Observer : public MessageLoopForUI::Observer {
break;
}
}
-#else
- EventStatus WillProcessXEvent(XEvent* event) OVERRIDE {
- // TODO(davemoore) Implement.
- return EVENT_CONTINUE;
- }
#endif
private:
diff --git a/views/widget/native_widget_gtk.cc b/views/widget/native_widget_gtk.cc
index 0b4abe8..6ca4190 100644
--- a/views/widget/native_widget_gtk.cc
+++ b/views/widget/native_widget_gtk.cc
@@ -260,7 +260,15 @@ class NativeWidgetGtk::DropObserver : public MessageLoopForUI::Observer {
static DropObserver* GetInstance() {
return Singleton<DropObserver>::get();
}
+#if defined(TOUCH_UI)
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE {
+ return base::EVENT_CONTINUE;
+ }
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
+ }
+#else
virtual void WillProcessEvent(GdkEvent* event) {
if (event->type == GDK_DROP_START) {
NativeWidgetGtk* widget = GetNativeWidgetGtkForEvent(event);
@@ -271,6 +279,7 @@ class NativeWidgetGtk::DropObserver : public MessageLoopForUI::Observer {
virtual void DidProcessEvent(GdkEvent* event) {
}
+#endif
private:
NativeWidgetGtk* GetNativeWidgetGtkForEvent(GdkEvent* event) {
diff --git a/views/widget/native_widget_win.cc b/views/widget/native_widget_win.cc
index 1acf3c9..1afcb41 100644
--- a/views/widget/native_widget_win.cc
+++ b/views/widget/native_widget_win.cc
@@ -1121,10 +1121,12 @@ gfx::Rect NativeWidgetWin::GetWorkAreaBoundsInScreen() const {
////////////////////////////////////////////////////////////////////////////////
// NativeWidgetWin, MessageLoop::Observer implementation:
-void NativeWidgetWin::WillProcessMessage(const MSG& msg) {
+base::EventStatus NativeWidgetWin::WillProcessEvent(
+ const base::NativeEvent& event) {
+ return base::EVENT_CONTINUE;
}
-void NativeWidgetWin::DidProcessMessage(const MSG& msg) {
+void NativeWidgetWin::DidProcessEvent(const base::NativeEvent& event) {
RedrawInvalidRect();
}
diff --git a/views/widget/native_widget_win.h b/views/widget/native_widget_win.h
index 252d6cd..c9f056f 100644
--- a/views/widget/native_widget_win.h
+++ b/views/widget/native_widget_win.h
@@ -279,8 +279,9 @@ class VIEWS_EXPORT NativeWidgetWin : public ui::WindowImpl,
};
// Overridden from MessageLoop::Observer:
- void WillProcessMessage(const MSG& msg) OVERRIDE;
- virtual void DidProcessMessage(const MSG& msg) OVERRIDE;
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE;
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
// Overridden from WindowImpl:
virtual HICON GetDefaultWindowIcon() const OVERRIDE;
diff --git a/views/widget/tooltip_manager_views.cc b/views/widget/tooltip_manager_views.cc
index 2537d7e..2a1c95a 100644
--- a/views/widget/tooltip_manager_views.cc
+++ b/views/widget/tooltip_manager_views.cc
@@ -114,23 +114,28 @@ base::MessagePumpObserver::EventStatus TooltipManagerViews::WillProcessEvent(
return base::MessagePumpObserver::EVENT_CONTINUE;
}
#elif defined(USE_X11)
-base::MessagePumpObserver::EventStatus TooltipManagerViews::WillProcessXEvent(
- XEvent* xevent) {
- XGenericEventCookie* cookie = &xevent->xcookie;
+base::EventStatus TooltipManagerViews::WillProcessEvent(
+ const base::NativeEvent& event) {
+ XGenericEventCookie* cookie = &event->xcookie;
if (cookie->evtype == XI_Motion) {
- XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data);
+ const XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(cookie->data);
OnMouseMoved(static_cast<int>(xievent->event_x),
static_cast<int>(xievent->event_y));
}
- return base::MessagePumpObserver::EVENT_CONTINUE;
+ return base::EVENT_CONTINUE;
+}
+
+void TooltipManagerViews::DidProcessEvent(const base::NativeEvent& event) {
}
#elif defined(OS_WIN)
-void TooltipManagerViews::WillProcessMessage(const MSG& msg) {
+base::EventStatus TooltipManagerViews::WillProcessEvent(
+ const base::NativeEvent& event) {
if (msg.message == WM_MOUSEMOVE)
OnMouseMoved(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam));
+ return base::EVENT_CONTINUE;
}
-void TooltipManagerViews::DidProcessMessage(const MSG& msg) {
+void TooltipManagerViews::DidProcessEvent(const base::NativeEvent& event) {
}
#endif
diff --git a/views/widget/tooltip_manager_views.h b/views/widget/tooltip_manager_views.h
index ced0ea2..c2d63cd 100644
--- a/views/widget/tooltip_manager_views.h
+++ b/views/widget/tooltip_manager_views.h
@@ -45,13 +45,11 @@ class TooltipManagerViews : public TooltipManager,
#if defined(USE_WAYLAND)
virtual base::MessagePumpObserver::EventStatus WillProcessEvent(
ui::WaylandEvent* event) OVERRIDE;
-#elif defined(USE_X11)
+#else
// MessageLoopForUI::Observer
- virtual base::MessagePumpObserver::EventStatus WillProcessXEvent(
- XEvent* xevent) OVERRIDE;
-#elif defined(OS_WIN)
- virtual void WillProcessMessage(const MSG& msg) OVERRIDE;
- virtual void DidProcessMessage(const MSG& msg) OVERRIDE;
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE;
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
#endif
private: