Workaround for xkbcommon dead keys.
[chromium-blink-merge.git] / ui / views / event_monitor_aura.cc
blobf5331d707af872eb9f26f60d21bdb7ce9249d770
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 #include "ui/views/event_monitor_aura.h"
7 #include "base/logging.h"
8 #include "ui/aura/env.h"
9 #include "ui/aura/window.h"
10 #include "ui/events/event_target.h"
12 namespace views {
14 // static
15 scoped_ptr<EventMonitor> EventMonitor::CreateApplicationMonitor(
16 ui::EventHandler* event_handler) {
17 return scoped_ptr<EventMonitor>(
18 new EventMonitorAura(event_handler, aura::Env::GetInstance()));
21 // static
22 scoped_ptr<EventMonitor> EventMonitor::CreateWindowMonitor(
23 ui::EventHandler* event_handler,
24 gfx::NativeWindow target_window) {
25 return scoped_ptr<EventMonitor>(
26 new EventMonitorAura(event_handler, target_window));
29 // static
30 gfx::Point EventMonitor::GetLastMouseLocation() {
31 return aura::Env::GetInstance()->last_mouse_location();
34 EventMonitorAura::EventMonitorAura(ui::EventHandler* event_handler,
35 ui::EventTarget* event_target)
36 : event_handler_(event_handler), event_target_(event_target) {
37 DCHECK(event_handler_);
38 DCHECK(event_target_);
39 event_target_->AddPreTargetHandler(event_handler_);
42 EventMonitorAura::~EventMonitorAura() {
43 event_target_->RemovePreTargetHandler(event_handler_);
46 } // namespace views