Android: Get rid of extra dup()s on launching child processes
[chromium-blink-merge.git] / ui / views / event_monitor.h
blob183e0950418c7a864ff7121535c96e9167664703
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_EVENT_MONITOR_H_
6 #define UI_VIEWS_EVENT_MONITOR_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/gfx/geometry/point.h"
10 #include "ui/gfx/native_widget_types.h"
11 #include "ui/views/views_export.h"
13 namespace ui {
14 class EventHandler;
17 namespace views {
19 // RAII-style class that forwards events to |event_handler| before they are
20 // dispatched.
21 class VIEWS_EXPORT EventMonitor {
22 public:
23 virtual ~EventMonitor() {}
25 // Create an instance for monitoring application events.
26 // Events will be forwarded to |event_handler| before they are dispatched to
27 // the application.
28 static scoped_ptr<EventMonitor> CreateApplicationMonitor(
29 ui::EventHandler* event_handler);
31 // Create an instance for monitoring events on a specific window.
32 // Events will be forwarded to |event_handler| before they are dispatched to
33 // |target_window|.
34 // The EventMonitor instance must be destroyed before |target_window|.
35 static scoped_ptr<EventMonitor> CreateWindowMonitor(
36 ui::EventHandler* event_handler,
37 gfx::NativeWindow target_window);
39 // Returns the last mouse location seen in a mouse event in screen
40 // coordinates.
41 static gfx::Point GetLastMouseLocation();
44 } // namespace views
46 #endif // UI_VIEWS_EVENT_MONITOR_H_