OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_CLIENT_FEATURE_IME_FEATURE_H_ | 5 #ifndef BLIMP_CLIENT_FEATURE_IME_FEATURE_H_ |
6 #define BLIMP_CLIENT_FEATURE_IME_FEATURE_H_ | 6 #define BLIMP_CLIENT_FEATURE_IME_FEATURE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "blimp/client/blimp_client_export.h" | |
13 #include "blimp/net/blimp_message_processor.h" | 12 #include "blimp/net/blimp_message_processor.h" |
14 #include "ui/base/ime/text_input_type.h" | 13 #include "ui/base/ime/text_input_type.h" |
15 | 14 |
16 namespace blimp { | 15 namespace blimp { |
17 namespace client { | 16 namespace client { |
18 | 17 |
19 // Handles all incoming and outgoing protobuf messages for text input of type | 18 // Handles all incoming and outgoing protobuf messages for text input of type |
20 // BlimpMessage::IME for blimp client. | 19 // BlimpMessage::IME for blimp client. |
21 // Upon receiving a text input request from the engine, the ImeFeature caches | 20 // Upon receiving a text input request from the engine, the ImeFeature caches |
22 // the |tab_id_| and |render_widget_id_| for the request and | 21 // the |tab_id_| and |render_widget_id_| for the request and |
23 // delegates the request to the Delegate which then opens up the IME. | 22 // delegates the request to the Delegate which then opens up the IME. |
24 // After user is done typing, the text is passed back to ImeFeature, which then | 23 // After user is done typing, the text is passed back to ImeFeature, which then |
25 // sends the text to the engine over network along with the same |tab_id_| and | 24 // sends the text to the engine over network along with the same |tab_id_| and |
26 // |render_widget_id_|. | 25 // |render_widget_id_|. |
27 // Any time user taps on an input text, ImeMessage::SHOW_IME message will be | 26 // Any time user taps on an input text, ImeMessage::SHOW_IME message will be |
28 // sent to client. Similarly, any time the text input is out of focus (e.g. if | 27 // sent to client. Similarly, any time the text input is out of focus (e.g. if |
29 // user navigates away from the currently page or the page loads for the first | 28 // user navigates away from the currently page or the page loads for the first |
30 // time), ImeMessage::HIDE_IME will be sent. | 29 // time), ImeMessage::HIDE_IME will be sent. |
31 | 30 |
32 class BLIMP_CLIENT_EXPORT ImeFeature : public BlimpMessageProcessor { | 31 class ImeFeature : public BlimpMessageProcessor { |
33 public: | 32 public: |
34 // A delegate to be notified of text input requests. | 33 // A delegate to be notified of text input requests. |
35 class Delegate { | 34 class Delegate { |
36 public: | 35 public: |
37 virtual void OnShowImeRequested(ui::TextInputType input_type, | 36 virtual void OnShowImeRequested(ui::TextInputType input_type, |
38 const std::string& text) = 0; | 37 const std::string& text) = 0; |
39 virtual void OnHideImeRequested() = 0; | 38 virtual void OnHideImeRequested() = 0; |
40 }; | 39 }; |
41 | 40 |
42 ImeFeature(); | 41 ImeFeature(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Used to send BlimpMessage::IME messages to the engine. | 75 // Used to send BlimpMessage::IME messages to the engine. |
77 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; | 76 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; |
78 | 77 |
79 DISALLOW_COPY_AND_ASSIGN(ImeFeature); | 78 DISALLOW_COPY_AND_ASSIGN(ImeFeature); |
80 }; | 79 }; |
81 | 80 |
82 } // namespace client | 81 } // namespace client |
83 } // namespace blimp | 82 } // namespace blimp |
84 | 83 |
85 #endif // BLIMP_CLIENT_FEATURE_IME_FEATURE_H_ | 84 #endif // BLIMP_CLIENT_FEATURE_IME_FEATURE_H_ |
OLD | NEW |