Chromium Code Reviews| Index: blimp/client/feature/web_input_feature.h |
| diff --git a/blimp/client/feature/web_input_feature.h b/blimp/client/feature/web_input_feature.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5471d58506b1f06aa3ac99247df88acaf0e5941f |
| --- /dev/null |
| +++ b/blimp/client/feature/web_input_feature.h |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BLIMP_CLIENT_FEATURE_WEB_INPUT_FEATURE_H_ |
| +#define BLIMP_CLIENT_FEATURE_WEB_INPUT_FEATURE_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "blimp/client/blimp_client_export.h" |
| +#include "blimp/net/blimp_message_processor.h" |
| + |
| +namespace blimp { |
| +namespace client { |
| + |
| +// Handles all incoming and outgoing protobuf messages for text input |
| +// of type BlimpMessage::IME. The handling of the message is delegated to the |
| +// WebInputFeatureDelegate. |
| +class BLIMP_CLIENT_EXPORT WebInputFeature : public BlimpMessageProcessor { |
|
haibinlu
2016/03/17 18:59:46
ImeFeature to be consistent with proto nameing?
|
| + public: |
| + // A delegate to be notified of text input events. |
| + class WebInputFeatureDelegate { |
| + public: |
| + virtual void OnShowImeRequested(int input_type, |
|
David Trainor- moved to gerrit
2016/03/17 21:53:29
Change to be ui::TextInputType?
|
| + const std::string& text) = 0; |
| + virtual void OnHideImeRequested() = 0; |
| + }; |
| + |
| + WebInputFeature(); |
| + ~WebInputFeature() override; |
| + |
| + // Set the BlimpMessageProcessor that will be used to send BlimpMessage::IME |
| + // messages to the engine. |
| + void set_outgoing_message_processor( |
| + scoped_ptr<BlimpMessageProcessor> processor); |
| + |
| + // Sets a WebInputFeatureDelegate to be notified of all text input messages. |
| + void SetDelegate(WebInputFeatureDelegate* delegate); |
| + |
| + // Sends text from IME to the blimp engine. |
| + void SendImeTextToEngine(const std::string& text); |
| + |
| + private: |
| + // BlimpMessageProcessor implementation. |
| + void ProcessMessage(scoped_ptr<BlimpMessage> message, |
| + const net::CompletionCallback& callback) override; |
| + |
| + WebInputFeatureDelegate* delegate_; |
| + |
| + 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
|
| + int render_widget_id_; |
| + |
| + // Used to send BlimpMessage::IME messages to the engine. |
| + scoped_ptr<BlimpMessageProcessor> outgoing_message_processor_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebInputFeature); |
| +}; |
| + |
| +} // namespace client |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_CLIENT_FEATURE_WEB_INPUT_FEATURE_H_ |