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

Unified Diff: chrome/browser/ui/views/tabs/tab_drag_controller.cc

Issue 678823002: MacViews: Create abstraction for event monitoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@views-tabs
Patch Set: Rebase Created 6 years, 2 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
« no previous file with comments | « no previous file | ui/views/event_monitor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab_drag_controller.cc
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
index 7c737fd3426c3c3d424b5b89a570ab90cc80fd34..07d2fbc011a728b10f104ae0ea3de4736db8ec45 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
@@ -29,12 +29,11 @@
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_function_dispatcher.h"
-#include "ui/aura/env.h"
-#include "ui/aura/window.h"
#include "ui/events/event_constants.h"
#include "ui/events/gestures/gesture_recognizer.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/screen.h"
+#include "ui/views/event_monitor.h"
#include "ui/views/focus/view_storage.h"
#include "ui/views/widget/root_view.h"
#include "ui/views/widget/widget.h"
@@ -48,6 +47,8 @@
#endif
#if defined(USE_AURA)
+#include "ui/aura/env.h"
+#include "ui/aura/window.h"
#include "ui/wm/core/window_modality_controller.h"
#endif
@@ -141,17 +142,13 @@ class WindowPositionManagedUpdater : public views::WidgetObserver {
}
};
-// EscapeTracker installs itself as a pre-target handler on aura::Env and runs a
-// callback when it receives the escape key.
+// EscapeTracker installs an event monitor and runs a callback when it receives
+// the escape key.
class EscapeTracker : public ui::EventHandler {
public:
explicit EscapeTracker(const base::Closure& callback)
- : escape_callback_(callback) {
- aura::Env::GetInstance()->AddPreTargetHandler(this);
- }
-
- virtual ~EscapeTracker() {
- aura::Env::GetInstance()->RemovePreTargetHandler(this);
+ : escape_callback_(callback),
+ event_monitor_(views::EventMonitor::Create(this)) {
}
private:
@@ -164,6 +161,7 @@ class EscapeTracker : public ui::EventHandler {
}
base::Closure escape_callback_;
+ scoped_ptr<views::EventMonitor> event_monitor_;
DISALLOW_COPY_AND_ASSIGN(EscapeTracker);
};
« no previous file with comments | « no previous file | ui/views/event_monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698