Chromium Code Reviews| Index: blimp/client/core/contents/ime_feature.h |
| diff --git a/blimp/client/core/contents/ime_feature.h b/blimp/client/core/contents/ime_feature.h |
| index a1eebae2b285d805ed10be98964577f948db8433..851cdf4cfceeefc583ef5cb6544171f29db49310 100644 |
| --- a/blimp/client/core/contents/ime_feature.h |
| +++ b/blimp/client/core/contents/ime_feature.h |
| @@ -15,14 +15,14 @@ |
| namespace blimp { |
| namespace client { |
| +// A callback to show IME. |
| +typedef base::Callback<void(const std::string&)> ShowImeCallback; |
|
David Trainor- moved to gerrit
2016/08/31 05:59:10
- using instead of typedef?
- put this as a class
shaktisahu
2016/08/31 17:28:21
Done.
|
| + |
| // Handles all incoming and outgoing protobuf messages for text input of type |
| // BlimpMessage::IME for blimp client. |
| -// Upon receiving a text input request from the engine, the ImeFeature caches |
| -// the |tab_id_| and |render_widget_id_| for the request and |
| -// delegates the request to the Delegate which then opens up the IME. |
| -// After user is done typing, the text is passed back to ImeFeature, which then |
| -// sends the text to the engine over network along with the same |tab_id_| and |
| -// |render_widget_id_|. |
| +// Upon receiving a text input request from the engine, the ImeFeature |
| +// delegates the request to the appropriate Delegate to show IME along with a |
| +// Callback bound with respective tab id and render widget id. |
| // Any time user taps on an input text, ImeMessage::SHOW_IME message will be |
| // sent to client. Similarly, any time the text input is out of focus (e.g. if |
| // user navigates away from the currently page or the page loads for the first |
| @@ -35,7 +35,8 @@ class ImeFeature : public BlimpMessageProcessor { |
| public: |
| virtual ~Delegate() {} |
| virtual void OnShowImeRequested(ui::TextInputType input_type, |
| - const std::string& text) = 0; |
| + const std::string& text, |
| + const ShowImeCallback& callback) = 0; |
| virtual void OnHideImeRequested() = 0; |
| }; |
| @@ -55,7 +56,9 @@ class ImeFeature : public BlimpMessageProcessor { |
| void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
| // Sends text from IME to the blimp engine. |
| - void OnImeTextEntered(const std::string& text); |
| + void OnImeTextEntered(int tab_id, |
|
David Trainor- moved to gerrit
2016/08/31 05:59:10
Would it make sense to make this private if we're
shaktisahu
2016/08/31 17:28:22
Done.
|
| + int render_widget_id, |
| + const std::string& text); |
| // BlimpMessageProcessor implementation. |
| void ProcessMessage(std::unique_ptr<BlimpMessage> message, |
| @@ -65,14 +68,6 @@ class ImeFeature : public BlimpMessageProcessor { |
| // Used to actually show or hide the IME. See notes on |set_delegate|. |
| Delegate* delegate_ = nullptr; |
| - // Tab id and render widget id for the input field for which user input is |
| - // being requested. |
| - // The values are cached from the ImeMessage::SHOW_IME message and sent back |
| - // to engine in the subsequent ImeMessage::SET_TEXT message. |
| - // The cached values are cleared on receiving ImeMessage::HIDE_IME request. |
| - int tab_id_ = -1; |
| - int render_widget_id_ = 0; |
| - |
| // Used to send BlimpMessage::IME messages to the engine. |
| std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; |