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

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: KeyboardCodeFromNative, Wayland, cleanup and consolidate. 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..55f3b33ffadfda5c44ed3d39bdc1d020e7429596 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
@@ -25,6 +25,7 @@
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/common/notification_source.h"
#include "ui/base/animation/slide_animation.h"
+#include "ui/base/events.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/gfx/rect.h"
#include "views/controls/scrollbar/native_scroll_bar.h"
@@ -71,10 +72,7 @@ class MouseObserver
void StopObserving(MessageLoopForUI* loop);
private:
- // TODO(mad): would be nice to have this on the views::Event class.
- bool IsMouseEvent(const views::NativeEvent& native_event);
-
- bool IsSameTopLevelWindow(views::NativeEvent native_event);
+ bool IsSameTopLevelWindow(ui::NativeEvent native_event);
// Tests if the event occurred on the content area, using
// root window's coordinates.
@@ -116,7 +114,7 @@ void MouseObserver::DidProcessEvent(GdkEvent* native_event) {
#endif
// Hide the location bar iff the mouse is pressed on the
// BrowserView's content area.
- if (!IsMouseEvent(native_event))
+ if (!ui::IsMouseEvent(native_event))
return;
views::MouseEvent event(native_event);
if (event.type() == ui::ET_MOUSE_PRESSED &&
@@ -145,23 +143,10 @@ void MouseObserver::StopObserving(MessageLoopForUI* loop) {
#endif
}
-bool MouseObserver::IsMouseEvent(const views::NativeEvent& native_event) {
-#if defined(OS_WIN) || defined(USE_AURA)
- return views::IsClientMouseEvent(native_event) ||
- views::IsNonClientMouseEvent(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
-}
-
// 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.
-bool MouseObserver::IsSameTopLevelWindow(views::NativeEvent native_event) {
+bool MouseObserver::IsSameTopLevelWindow(ui::NativeEvent native_event) {
#if defined(USE_AURA)
// TODO(beng):
NOTIMPLEMENTED();

Powered by Google App Engine
This is Rietveld 408576698