input_events_type_converters.h revision 5f1c94371a64b3196d4be9466099bb892df9b88e
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. 4 5#ifndef MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_ 6#define MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_ 7 8#include "base/memory/scoped_ptr.h" 9#include "mojo/services/public/cpp/input_events/mojo_input_events_export.h" 10#include "mojo/services/public/interfaces/input_events/input_events.mojom.h" 11#include "ui/events/event.h" 12 13namespace mojo { 14 15template<> 16class MOJO_INPUT_EVENTS_EXPORT TypeConverter<EventType, ui::EventType> { 17 public: 18 static EventType ConvertFrom(ui::EventType type); 19 static ui::EventType ConvertTo(EventType type); 20}; 21 22template<> 23class MOJO_INPUT_EVENTS_EXPORT TypeConverter<EventPtr, ui::Event> { 24 public: 25 static EventPtr ConvertFrom(const ui::Event& input); 26}; 27 28template<> 29class MOJO_INPUT_EVENTS_EXPORT TypeConverter<EventPtr, ui::KeyEvent> { 30 public: 31 static EventPtr ConvertFrom(const ui::KeyEvent& input); 32}; 33 34template<> 35class MOJO_INPUT_EVENTS_EXPORT TypeConverter<EventPtr, 36 scoped_ptr<ui::Event> > { 37 public: 38 static scoped_ptr<ui::Event> ConvertTo(const EventPtr& input); 39}; 40 41} // namespace mojo 42 43#endif // MOJO_SERVICES_PUBLIC_CPP_INPUT_EVENTS_INPUT_EVENTS_TYPE_CONVERTERS_H_ 44