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

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

Issue 2370393002: Extracting placeholder information from Webkit to Blimp (Closed)
Patch Set: Extracting info through RHVW 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/blimp_engine_session.h" 5 #include "blimp/engine/session/blimp_engine_session.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 std::unique_ptr<BlimpBrowserContext> browser_context, 221 std::unique_ptr<BlimpBrowserContext> browser_context,
222 net::NetLog* net_log, 222 net::NetLog* net_log,
223 BlimpEngineConfig* engine_config, 223 BlimpEngineConfig* engine_config,
224 SettingsManager* settings_manager) 224 SettingsManager* settings_manager)
225 : screen_(new BlimpScreen), 225 : screen_(new BlimpScreen),
226 browser_context_(std::move(browser_context)), 226 browser_context_(std::move(browser_context)),
227 engine_config_(engine_config), 227 engine_config_(engine_config),
228 settings_manager_(settings_manager), 228 settings_manager_(settings_manager),
229 settings_feature_(settings_manager_), 229 settings_feature_(settings_manager_),
230 render_widget_feature_(settings_manager_), 230 render_widget_feature_(settings_manager_),
231 net_components_(new EngineNetworkComponents(net_log)) { 231 net_components_(new EngineNetworkComponents(net_log)),
232 weak_factory_(this) {
232 DCHECK(engine_config_); 233 DCHECK(engine_config_);
233 DCHECK(settings_manager_); 234 DCHECK(settings_manager_);
234 235
235 screen_->UpdateDisplayScaleAndSize( 236 screen_->UpdateDisplayScaleAndSize(
236 kDefaultScaleFactor, 237 kDefaultScaleFactor,
237 gfx::Size(kDefaultDisplayWidth, kDefaultDisplayHeight)); 238 gfx::Size(kDefaultDisplayWidth, kDefaultDisplayHeight));
238 239
239 std::unique_ptr<HeliumBlobSenderDelegate> helium_blob_delegate( 240 std::unique_ptr<HeliumBlobSenderDelegate> helium_blob_delegate(
240 new HeliumBlobSenderDelegate); 241 new HeliumBlobSenderDelegate);
241 blob_delegate_ = helium_blob_delegate.get(); 242 blob_delegate_ = helium_blob_delegate.get();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // - the TextInputClient is changed (e.g. by a change of focus) 396 // - the TextInputClient is changed (e.g. by a change of focus)
396 // - the TextInputType of the TextInputClient changes 397 // - the TextInputType of the TextInputClient changes
397 void BlimpEngineSession::OnTextInputStateChanged( 398 void BlimpEngineSession::OnTextInputStateChanged(
398 const ui::TextInputClient* client) { 399 const ui::TextInputClient* client) {
399 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView()) 400 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView())
400 return; 401 return;
401 402
402 ui::TextInputType type = 403 ui::TextInputType type =
403 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; 404 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE;
404 405
405 // TODO(shaktisahu): Propagate the new type to the client.
406 // Hide IME, when text input is out of focus, i.e. if the text input type 406 // Hide IME, when text input is out of focus, i.e. if the text input type
407 // changes to ui::TEXT_INPUT_TYPE_NONE. For other text input types, 407 // changes to ui::TEXT_INPUT_TYPE_NONE. For other text input types,
408 // OnShowImeIfNeeded is used instead to send show IME request to client. 408 // OnShowImeIfNeeded is used instead to send show IME request to client.
409 if (type == ui::TEXT_INPUT_TYPE_NONE) 409 if (type == ui::TEXT_INPUT_TYPE_NONE)
410 render_widget_feature_.SendHideImeRequest( 410 render_widget_feature_.SendHideImeRequest(
411 tab_->tab_id(), 411 tab_->tab_id(),
412 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost()); 412 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost());
413 } 413 }
414 414
415 void BlimpEngineSession::OnInputMethodDestroyed( 415 void BlimpEngineSession::OnInputMethodDestroyed(
416 const ui::InputMethod* input_method) {} 416 const ui::InputMethod* input_method) {}
417 417
418 // Called when a user input should trigger showing the IME. 418 // Called when a user input should trigger showing the IME.
419 void BlimpEngineSession::OnShowImeIfNeeded() { 419 void BlimpEngineSession::OnShowImeIfNeeded() {
420 TRACE_EVENT0("blimp", "BlimpEngineSession::OnShowImeIfNeeded"); 420 TRACE_EVENT0("blimp", "BlimpEngineSession::OnShowImeIfNeeded");
421 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView() || 421 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView() ||
422 !window_tree_host_->GetInputMethod()->GetTextInputClient()) 422 !window_tree_host_->GetInputMethod()->GetTextInputClient())
423 return; 423 return;
424 424
425 base::Callback<void(const std::string&, const std::string&)> reply =
David Trainor- moved to gerrit 2016/10/26 01:36:42 This should probably live inside Tab so we can do
shaktisahu 2016/10/31 23:13:58 Done.
426 base::Bind(&BlimpEngineSession::FetchTextInputInfo,
427 weak_factory_.GetWeakPtr());
428
429 tab_->web_contents()->GetRenderWidgetHostView()->FetchTextInputInfo(reply);
430 }
431
432 void BlimpEngineSession::FetchTextInputInfo(const std::string& text,
433 const std::string& placeholder) {
434 ui::TextInputType type = window_tree_host_->GetInputMethod()
435 ->GetTextInputClient()
436 ->GetTextInputType();
425 render_widget_feature_.SendShowImeRequest( 437 render_widget_feature_.SendShowImeRequest(
426 tab_->tab_id(), 438 tab_->tab_id(),
427 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost(), 439 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost(),
428 window_tree_host_->GetInputMethod()->GetTextInputClient()); 440 type, text, placeholder);
429 } 441 }
430 442
431 void BlimpEngineSession::ProcessMessage( 443 void BlimpEngineSession::ProcessMessage(
432 std::unique_ptr<BlimpMessage> message, 444 std::unique_ptr<BlimpMessage> message,
433 const net::CompletionCallback& callback) { 445 const net::CompletionCallback& callback) {
434 TRACE_EVENT1("blimp", "BlimpEngineSession::ProcessMessage", "TabId", 446 TRACE_EVENT1("blimp", "BlimpEngineSession::ProcessMessage", "TabId",
435 message->target_tab_id()); 447 message->target_tab_id());
436 DCHECK(!callback.is_null()); 448 DCHECK(!callback.is_null());
437 DCHECK(BlimpMessage::kTabControl == message->feature_case() || 449 DCHECK(BlimpMessage::kTabControl == message->feature_case() ||
438 BlimpMessage::kNavigation == message->feature_case()); 450 BlimpMessage::kNavigation == message->feature_case());
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 parent->AddChild(content); 578 parent->AddChild(content);
567 content->Show(); 579 content->Show();
568 580
569 tab_ = base::MakeUnique<Tab>(std::move(new_contents), target_tab_id, 581 tab_ = base::MakeUnique<Tab>(std::move(new_contents), target_tab_id,
570 &render_widget_feature_, 582 &render_widget_feature_,
571 navigation_message_sender_.get()); 583 navigation_message_sender_.get());
572 } 584 }
573 585
574 } // namespace engine 586 } // namespace engine
575 } // namespace blimp 587 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698