Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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_CLIENT_FEATURE_WEB_INPUT_FEATURE_H_ | |
| 6 #define BLIMP_CLIENT_FEATURE_WEB_INPUT_FEATURE_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "blimp/client/blimp_client_export.h" | |
| 13 #include "blimp/net/blimp_message_processor.h" | |
| 14 | |
| 15 namespace blimp { | |
| 16 namespace client { | |
| 17 | |
| 18 // Handles all incoming and outgoing protobuf messages for text input | |
| 19 // of type BlimpMessage::IME. The handling of the message is delegated to the | |
| 20 // WebInputFeatureDelegate. | |
| 21 class BLIMP_CLIENT_EXPORT WebInputFeature : public BlimpMessageProcessor { | |
|
haibinlu
2016/03/17 18:59:46
ImeFeature to be consistent with proto nameing?
| |
| 22 public: | |
| 23 // A delegate to be notified of text input events. | |
| 24 class WebInputFeatureDelegate { | |
| 25 public: | |
| 26 virtual void OnShowImeRequested(int input_type, | |
|
David Trainor- moved to gerrit
2016/03/17 21:53:29
Change to be ui::TextInputType?
| |
| 27 const std::string& text) = 0; | |
| 28 virtual void OnHideImeRequested() = 0; | |
| 29 }; | |
| 30 | |
| 31 WebInputFeature(); | |
| 32 ~WebInputFeature() override; | |
| 33 | |
| 34 // Set the BlimpMessageProcessor that will be used to send BlimpMessage::IME | |
| 35 // messages to the engine. | |
| 36 void set_outgoing_message_processor( | |
| 37 scoped_ptr<BlimpMessageProcessor> processor); | |
| 38 | |
| 39 // Sets a WebInputFeatureDelegate to be notified of all text input messages. | |
| 40 void SetDelegate(WebInputFeatureDelegate* delegate); | |
| 41 | |
| 42 // Sends text from IME to the blimp engine. | |
| 43 void SendImeTextToEngine(const std::string& text); | |
| 44 | |
| 45 private: | |
| 46 // BlimpMessageProcessor implementation. | |
| 47 void ProcessMessage(scoped_ptr<BlimpMessage> message, | |
| 48 const net::CompletionCallback& callback) override; | |
| 49 | |
| 50 WebInputFeatureDelegate* delegate_; | |
| 51 | |
| 52 int tab_id_; | |
|
David Trainor- moved to gerrit
2016/03/17 21:53:29
Add comments here. What are these and why do we n
| |
| 53 int render_widget_id_; | |
| 54 | |
| 55 // Used to send BlimpMessage::IME messages to the engine. | |
| 56 scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(WebInputFeature); | |
| 59 }; | |
| 60 | |
| 61 } // namespace client | |
| 62 } // namespace blimp | |
| 63 | |
| 64 #endif // BLIMP_CLIENT_FEATURE_WEB_INPUT_FEATURE_H_ | |
| OLD | NEW |