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

Side by Side Diff: blimp/engine/session/tab.cc

Issue 2513333002: Revert 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 unified diff | Download patch
OLDNEW
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 #include "blimp/engine/session/tab.h" 5 #include "blimp/engine/session/tab.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "blimp/common/create_blimp_message.h" 9 #include "blimp/common/create_blimp_message.h"
10 #include "blimp/common/proto/blimp_message.pb.h" 10 #include "blimp/common/proto/blimp_message.pb.h"
11 #include "blimp/common/proto/render_widget.pb.h" 11 #include "blimp/common/proto/render_widget.pb.h"
12 #include "blimp/common/proto/tab_control.pb.h" 12 #include "blimp/common/proto/tab_control.pb.h"
13 #include "blimp/engine/common/blimp_user_agent.h" 13 #include "blimp/engine/common/blimp_user_agent.h"
14 #include "blimp/engine/feature/engine_render_widget_feature.h" 14 #include "blimp/engine/feature/engine_render_widget_feature.h"
15 #include "blimp/net/blimp_message_processor.h" 15 #include "blimp/net/blimp_message_processor.h"
16 #include "content/public/browser/navigation_controller.h" 16 #include "content/public/browser/navigation_controller.h"
17 #include "content/public/browser/navigation_entry.h" 17 #include "content/public/browser/navigation_entry.h"
18 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/render_widget_host.h" 19 #include "content/public/browser/render_widget_host.h"
20 #include "content/public/browser/render_widget_host_view.h" 20 #include "content/public/browser/render_widget_host_view.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "content/public/common/form_field_data.h"
23 #include "content/public/common/renderer_preferences.h" 22 #include "content/public/common/renderer_preferences.h"
24 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
25 #include "ui/gfx/geometry/size.h" 24 #include "ui/gfx/geometry/size.h"
26 25
27 namespace blimp { 26 namespace blimp {
28 namespace engine { 27 namespace engine {
29 28
30 Tab::Tab(std::unique_ptr<content::WebContents> web_contents, 29 Tab::Tab(std::unique_ptr<content::WebContents> web_contents,
31 const int tab_id, 30 const int tab_id,
32 EngineRenderWidgetFeature* render_widget_feature, 31 EngineRenderWidgetFeature* render_widget_feature,
33 BlimpMessageProcessor* navigation_message_sender) 32 BlimpMessageProcessor* navigation_message_sender)
34 : web_contents_(std::move(web_contents)), 33 : web_contents_(std::move(web_contents)),
35 tab_id_(tab_id), 34 tab_id_(tab_id),
36 render_widget_feature_(render_widget_feature), 35 render_widget_feature_(render_widget_feature),
37 navigation_message_sender_(navigation_message_sender), 36 navigation_message_sender_(navigation_message_sender),
38 page_load_tracker_(web_contents_.get(), this), 37 page_load_tracker_(web_contents_.get(), this) {
39 current_form_request_id_(0),
40 weak_factory_(this) {
41 DCHECK(render_widget_feature_); 38 DCHECK(render_widget_feature_);
42 DCHECK(navigation_message_sender_); 39 DCHECK(navigation_message_sender_);
43 40
44 // A Tab is created upon client's request, thus an updated 41 // A Tab is created upon client's request, thus an updated
45 // user agent info (containing client OS info) is available, and we will use 42 // user agent info (containing client OS info) is available, and we will use
46 // that to override user agent string from BlimpContentRendererClient. 43 // that to override user agent string from BlimpContentRendererClient.
47 web_contents_->SetUserAgentOverride(GetBlimpEngineUserAgent()); 44 web_contents_->SetUserAgentOverride(GetBlimpEngineUserAgent());
48 45
49 render_widget_feature_->SetDelegate(tab_id_, this); 46 render_widget_feature_->SetDelegate(tab_id_, this);
50 47
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 navigation_message_sender_->ProcessMessage(std::move(message), 161 navigation_message_sender_->ProcessMessage(std::move(message),
165 net::CompletionCallback()); 162 net::CompletionCallback());
166 } 163 }
167 164
168 void Tab::OnWebGestureEvent(content::RenderWidgetHost* render_widget_host, 165 void Tab::OnWebGestureEvent(content::RenderWidgetHost* render_widget_host,
169 std::unique_ptr<blink::WebGestureEvent> event) { 166 std::unique_ptr<blink::WebGestureEvent> event) {
170 TRACE_EVENT1("blimp", "Tab::OnWebGestureEvent", "type", event->type); 167 TRACE_EVENT1("blimp", "Tab::OnWebGestureEvent", "type", event->type);
171 render_widget_host->ForwardGestureEvent(*event); 168 render_widget_host->ForwardGestureEvent(*event);
172 } 169 }
173 170
174 void Tab::ShowTextInputUI() {
175 current_form_request_id_++;
176 content::FormFieldDataCallback callback =
177 base::Bind(&Tab::ProcessTextInputInfo, weak_factory_.GetWeakPtr(),
178 current_form_request_id_);
179
180 content::RenderFrameHost* focused_frame = web_contents()->GetFocusedFrame();
181 if (focused_frame) {
182 focused_frame->RequestFocusedFormFieldData(callback);
183 }
184 }
185
186 void Tab::HideTextInputUI() {
187 current_form_request_id_++;
188 render_widget_feature_->SendHideImeRequest(
189 tab_id(),
190 web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost());
191 }
192
193 void Tab::ProcessTextInputInfo(int request_id,
194 const content::FormFieldData& field) {
195 if (field.text_input_type == ui::TEXT_INPUT_TYPE_NONE)
196 return;
197
198 // Discard the results for old requests.
199 if (request_id < current_form_request_id_) {
200 return;
201 }
202
203 // TODO(shaktisahu): Remove adding RenderWidgetHost info to the proto.
204 render_widget_feature_->SendShowImeRequest(
205 tab_id(),
206 web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost(), field);
207 }
208
209 void Tab::OnCompositorMessageReceived( 171 void Tab::OnCompositorMessageReceived(
210 content::RenderWidgetHost* render_widget_host, 172 content::RenderWidgetHost* render_widget_host,
211 const std::vector<uint8_t>& message) { 173 const std::vector<uint8_t>& message) {
212 TRACE_EVENT0("blimp", "Tab::OnCompositorMessageReceived"); 174 TRACE_EVENT0("blimp", "Tab::OnCompositorMessageReceived");
213 175
214 render_widget_host->HandleCompositorProto(message); 176 render_widget_host->HandleCompositorProto(message);
215 } 177 }
216 178
217 } // namespace engine 179 } // namespace engine
218 } // namespace blimp 180 } // namespace blimp
OLDNEW
« 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