Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: blimp/client/core/contents/ime_feature.h

Issue 2393043004: Blimp: IME should submit form with text (Closed)
Patch Set: dtrainor@ comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 c8ff6a473116a032029f9e1e8f4db679ea5487c3..7b49c3b22750bc1b3975e4ac88eb26352ecfc943 100644
--- a/blimp/client/core/contents/ime_feature.h
+++ b/blimp/client/core/contents/ime_feature.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "blimp/net/blimp_message_processor.h"
#include "ui/base/ime/text_input_type.h"
@@ -27,16 +28,35 @@ namespace client {
class ImeFeature : public BlimpMessageProcessor {
public:
+ struct WebInputResponse;
+
// A callback to show IME.
- using ShowImeCallback = base::Callback<void(const std::string&)>;
+ using ShowImeCallback = base::Callback<void(const WebInputResponse&)>;
+
+ // A bundle of params required by the client.
+ struct WebInputRequest {
+ WebInputRequest();
+ ~WebInputRequest();
+
+ ui::TextInputType input_type;
+ std::string text;
+ ShowImeCallback show_ime_callback;
+ };
+
+ // A bundle of params to be sent to the engine.
+ struct WebInputResponse {
+ WebInputResponse();
+ ~WebInputResponse() = default;
+
+ std::string text;
+ bool submit;
+ };
// A delegate to be notified of text input requests.
class Delegate {
public:
virtual ~Delegate() {}
- virtual void OnShowImeRequested(ui::TextInputType input_type,
- const std::string& text,
- const ShowImeCallback& callback) = 0;
+ virtual void OnShowImeRequested(const WebInputRequest& request) = 0;
virtual void OnHideImeRequested() = 0;
};
@@ -63,7 +83,7 @@ class ImeFeature : public BlimpMessageProcessor {
// Sends text from IME to the blimp engine.
void OnImeTextEntered(int tab_id,
int render_widget_id,
- const std::string& text);
+ const WebInputResponse& response);
// Used to actually show or hide the IME. See notes on |set_delegate|.
Delegate* delegate_ = nullptr;
@@ -71,6 +91,8 @@ class ImeFeature : public BlimpMessageProcessor {
// Used to send BlimpMessage::IME messages to the engine.
std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
+ base::WeakPtrFactory<ImeFeature> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(ImeFeature);
};
« no previous file with comments | « blimp/client/core/contents/blimp_contents_view_impl_aura.cc ('k') | blimp/client/core/contents/ime_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698