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

Unified Diff: blimp/engine/session/tab.cc

Issue 2520013002: Reland of Extracting placeholder information from Webkit to Blimp (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « blimp/engine/session/tab.h ('k') | chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/engine/session/tab.cc
diff --git a/blimp/engine/session/tab.cc b/blimp/engine/session/tab.cc
index 895902350dcc244a3438d8d417faa6f5cd83685c..49bba5de382a29d56f666c52e058d9c55539e290 100644
--- a/blimp/engine/session/tab.cc
+++ b/blimp/engine/session/tab.cc
@@ -19,6 +19,7 @@
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/form_field_data.h"
#include "content/public/common/renderer_preferences.h"
#include "ui/aura/window.h"
#include "ui/gfx/geometry/size.h"
@@ -34,7 +35,9 @@
tab_id_(tab_id),
render_widget_feature_(render_widget_feature),
navigation_message_sender_(navigation_message_sender),
- page_load_tracker_(web_contents_.get(), this) {
+ page_load_tracker_(web_contents_.get(), this),
+ current_form_request_id_(0),
+ weak_factory_(this) {
DCHECK(render_widget_feature_);
DCHECK(navigation_message_sender_);
@@ -168,6 +171,41 @@
render_widget_host->ForwardGestureEvent(*event);
}
+void Tab::ShowTextInputUI() {
+ current_form_request_id_++;
+ content::FormFieldDataCallback callback =
+ base::Bind(&Tab::ProcessTextInputInfo, weak_factory_.GetWeakPtr(),
+ current_form_request_id_);
+
+ content::RenderFrameHost* focused_frame = web_contents()->GetFocusedFrame();
+ if (focused_frame) {
+ focused_frame->RequestFocusedFormFieldData(callback);
+ }
+}
+
+void Tab::HideTextInputUI() {
+ current_form_request_id_++;
+ render_widget_feature_->SendHideImeRequest(
+ tab_id(),
+ web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost());
+}
+
+void Tab::ProcessTextInputInfo(int request_id,
+ const content::FormFieldData& field) {
+ if (field.text_input_type == ui::TEXT_INPUT_TYPE_NONE)
+ return;
+
+ // Discard the results for old requests.
+ if (request_id < current_form_request_id_) {
+ return;
+ }
+
+ // TODO(shaktisahu): Remove adding RenderWidgetHost info to the proto.
+ render_widget_feature_->SendShowImeRequest(
+ tab_id(),
+ web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost(), field);
+}
+
void Tab::OnCompositorMessageReceived(
content::RenderWidgetHost* render_widget_host,
const std::vector<uint8_t>& message) {
« no previous file with comments | « blimp/engine/session/tab.h ('k') | chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698