Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc

Issue 7942004: Consolidate/cleanup event cracking code; single out GdkEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix GdkEvent init, NativeWidgetGtk casting, and Get[Unmodified]Character checks. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc
diff --git a/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc b/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc
index 5b611bce1ace8be430988e8d2576438d2657ddca..42142ae2cafc26f1cf51161d882cdf4ae0097b05 100644
--- a/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc
+++ b/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc
@@ -72,9 +72,21 @@ class MouseObserver
private:
// TODO(mad): would be nice to have this on the views::Event class.
+#if !defined(USE_AURA)
+#if defined(OS_WIN)
bool IsMouseEvent(const views::NativeEvent& native_event);
+#elif defined(OS_LINUX)
Ben Goodger (Google) 2011/09/24 16:39:04 This should be TOOLKIT_USES_GTK, no?
msw 2011/09/26 05:08:00 Done.
+ bool IsMouseEvent(GdkEvent* gdk_event);
sadrul 2011/09/24 16:56:08 Are IsMouseEvent/IsSameTopLevelWindow not used/nec
msw 2011/09/26 05:08:00 The only caller, MouseObserver::DidProcessEvent, i
+#endif
+#endif
+#if !defined(USE_AURA)
+#if defined(OS_WIN)
bool IsSameTopLevelWindow(views::NativeEvent native_event);
+#elif defined(OS_LINUX)
+ bool IsSameTopLevelWindow(GdkEvent* gdk_event);
+#endif
+#endif
// Tests if the event occurred on the content area, using
// root window's coordinates.
@@ -145,35 +157,38 @@ void MouseObserver::StopObserving(MessageLoopForUI* loop) {
#endif
}
+#if !defined(USE_AURA)
+#if defined(OS_WIN)
bool MouseObserver::IsMouseEvent(const views::NativeEvent& native_event) {
-#if defined(OS_WIN) || defined(USE_AURA)
- return views::IsClientMouseEvent(native_event) ||
- views::IsNonClientMouseEvent(native_event);
+ return ui::IsMouseEvent(native_event);
+}
#elif defined(OS_LINUX)
- return native_event->type == GDK_MOTION_NOTIFY ||
- native_event->type == GDK_BUTTON_PRESS ||
- native_event->type == GDK_2BUTTON_PRESS ||
- native_event->type == GDK_3BUTTON_PRESS ||
- native_event->type == GDK_BUTTON_RELEASE;
-#endif
+bool MouseObserver::IsMouseEvent(GdkEvent* gdk_event) {
+ return gdk_event->type == GDK_MOTION_NOTIFY ||
+ gdk_event->type == GDK_BUTTON_PRESS ||
+ gdk_event->type == GDK_2BUTTON_PRESS ||
+ gdk_event->type == GDK_3BUTTON_PRESS ||
+ gdk_event->type == GDK_BUTTON_RELEASE;
}
+#endif
+#endif
+#if !defined(USE_AURA)
// TODO(mad): Would be nice to have a NativeEvent -> NativeWindow mapping.
// Then, with a GetTopLevel receiving a NativeWindow, we could do this in a
// platform independent way.
+#if defined(OS_WIN)
bool MouseObserver::IsSameTopLevelWindow(views::NativeEvent native_event) {
-#if defined(USE_AURA)
- // TODO(beng):
- NOTIMPLEMENTED();
- return false;
-#elif defined(OS_WIN)
return platform_util::GetTopLevel(native_event.hwnd) == top_level_window_;
+}
#elif defined(OS_LINUX)
+bool MouseObserver::IsSameTopLevelWindow(GdkEvent* gdk_event) {
return gdk_window_get_toplevel(
- reinterpret_cast<GdkEventAny*>(native_event)->window) ==
+ reinterpret_cast<GdkEventAny*>(gdk_event)->window) ==
top_level_window_->window;
-#endif
}
+#endif
+#endif
bool MouseObserver::HitContentArea(int x, int y) {
gfx::Point p(x, y);

Powered by Google App Engine
This is Rietveld 408576698