| OLD | NEW | 
|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "ui/events/ozone/event_factory_ozone.h" | 5 #include "ui/events/ozone/event_factory_ozone.h" | 
| 6 | 6 | 
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" | 
|  | 8 #include "base/debug/trace_event.h" | 
| 8 #include "base/message_loop/message_pump_ozone.h" | 9 #include "base/message_loop/message_pump_ozone.h" | 
| 9 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" | 
|  | 11 #include "ui/events/event.h" | 
| 10 #include "ui/events/event_switches.h" | 12 #include "ui/events/event_switches.h" | 
| 11 | 13 | 
| 12 namespace ui { | 14 namespace ui { | 
| 13 | 15 | 
|  | 16 namespace { | 
|  | 17 | 
|  | 18 void DispatchEventTask(scoped_ptr<ui::Event> key) { | 
|  | 19   TRACE_EVENT1("ozone", "DispatchEventTask", "type", key->type()); | 
|  | 20   base::MessagePumpOzone::Current()->Dispatch(key.get()); | 
|  | 21 } | 
|  | 22 | 
|  | 23 }  // namespace | 
|  | 24 | 
| 14 // static | 25 // static | 
| 15 EventFactoryOzone* EventFactoryOzone::impl_ = NULL; | 26 EventFactoryOzone* EventFactoryOzone::impl_ = NULL; | 
| 16 | 27 | 
| 17 EventFactoryOzone::EventFactoryOzone() {} | 28 EventFactoryOzone::EventFactoryOzone() {} | 
| 18 | 29 | 
| 19 EventFactoryOzone::~EventFactoryOzone() {} | 30 EventFactoryOzone::~EventFactoryOzone() {} | 
| 20 | 31 | 
| 21 EventFactoryOzone* EventFactoryOzone::GetInstance() { | 32 EventFactoryOzone* EventFactoryOzone::GetInstance() { | 
| 22   CHECK(impl_) << "No EventFactoryOzone implementation set."; | 33   CHECK(impl_) << "No EventFactoryOzone implementation set."; | 
| 23   return impl_; | 34   return impl_; | 
| 24 } | 35 } | 
| 25 | 36 | 
| 26 void EventFactoryOzone::SetInstance(EventFactoryOzone* impl) { impl_ = impl; } | 37 void EventFactoryOzone::SetInstance(EventFactoryOzone* impl) { impl_ = impl; } | 
| 27 | 38 | 
| 28 void EventFactoryOzone::StartProcessingEvents() {} | 39 void EventFactoryOzone::StartProcessingEvents() {} | 
| 29 | 40 | 
|  | 41 // static | 
|  | 42 void EventFactoryOzone::DispatchEvent(scoped_ptr<ui::Event> event) { | 
|  | 43   base::MessageLoop::current()->PostTask( | 
|  | 44       FROM_HERE, base::Bind(&DispatchEventTask, base::Passed(&event))); | 
|  | 45 } | 
|  | 46 | 
| 30 }  // namespace ui | 47 }  // namespace ui | 
| OLD | NEW | 
|---|