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