| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 BLIMP_NET_INPUT_MESSAGE_CONVERTER_H_ | |
| 6 #define BLIMP_NET_INPUT_MESSAGE_CONVERTER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "blimp/common/proto/ime.pb.h" | |
| 12 #include "blimp/net/blimp_net_export.h" | |
| 13 #include "ui/base/ime/text_input_type.h" | |
| 14 | |
| 15 namespace blink { | |
| 16 class WebGestureEvent; | |
| 17 } | |
| 18 | |
| 19 namespace blimp { | |
| 20 | |
| 21 class InputMessage; | |
| 22 | |
| 23 // A generic class to provide conversion utilities for protos such as : | |
| 24 // 1) Creating WebGestureEvents from a stream of InputMessage protos. | |
| 25 // This class may be stateful to optimize the size of the serialized | |
| 26 // transmission | |
| 27 // data. See InputMessageConverter for the deserialize code. | |
| 28 // 2) Conversion between ui::TextInputType and ImeMessage proto. | |
| 29 class BLIMP_NET_EXPORT InputMessageConverter { | |
| 30 public: | |
| 31 InputMessageConverter(); | |
| 32 ~InputMessageConverter(); | |
| 33 | |
| 34 // Process an InputMessage and create a WebGestureEvent from it. This might | |
| 35 // make use of state from previous messages. | |
| 36 std::unique_ptr<blink::WebGestureEvent> ProcessMessage( | |
| 37 const InputMessage& message); | |
| 38 | |
| 39 // Converts a ui::TextInputType to ImeMessage proto. | |
| 40 static ImeMessage_InputType TextInputTypeToProto(ui::TextInputType type); | |
| 41 static ui::TextInputType TextInputTypeFromProto(ImeMessage_InputType type); | |
| 42 | |
| 43 private: | |
| 44 DISALLOW_COPY_AND_ASSIGN(InputMessageConverter); | |
| 45 }; | |
| 46 | |
| 47 } // namespace blimp | |
| 48 | |
| 49 #endif // BLIMP_NET_INPUT_MESSAGE_CONVERTER_H_ | |
| OLD | NEW |