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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2045363002: Routing IME Result Calls to the Correct RenderWidgetHost (Aura Only) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a comment Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 cursor_client->ShowCursor(); 1431 cursor_client->ShowCursor();
1432 } 1432 }
1433 1433
1434 host_->LostMouseLock(); 1434 host_->LostMouseLock();
1435 } 1435 }
1436 1436
1437 //////////////////////////////////////////////////////////////////////////////// 1437 ////////////////////////////////////////////////////////////////////////////////
1438 // RenderWidgetHostViewAura, ui::TextInputClient implementation: 1438 // RenderWidgetHostViewAura, ui::TextInputClient implementation:
1439 void RenderWidgetHostViewAura::SetCompositionText( 1439 void RenderWidgetHostViewAura::SetCompositionText(
1440 const ui::CompositionText& composition) { 1440 const ui::CompositionText& composition) {
1441 // TODO(wjmaclean): can host_ ever be null? 1441 if (!text_input_manager_ || !text_input_manager_->GetActiveWidget())
1442 if (!host_)
1443 return; 1442 return;
1444 1443
1445 // TODO(suzhe): convert both renderer_host and renderer to use 1444 // TODO(suzhe): convert both renderer_host and renderer to use
1446 // ui::CompositionText. 1445 // ui::CompositionText.
1447 std::vector<blink::WebCompositionUnderline> underlines; 1446 std::vector<blink::WebCompositionUnderline> underlines;
1448 underlines.reserve(composition.underlines.size()); 1447 underlines.reserve(composition.underlines.size());
1449 for (std::vector<ui::CompositionUnderline>::const_iterator it = 1448 for (std::vector<ui::CompositionUnderline>::const_iterator it =
1450 composition.underlines.begin(); 1449 composition.underlines.begin();
1451 it != composition.underlines.end(); ++it) { 1450 it != composition.underlines.end(); ++it) {
1452 underlines.push_back( 1451 underlines.push_back(
1453 blink::WebCompositionUnderline(static_cast<unsigned>(it->start_offset), 1452 blink::WebCompositionUnderline(static_cast<unsigned>(it->start_offset),
1454 static_cast<unsigned>(it->end_offset), 1453 static_cast<unsigned>(it->end_offset),
1455 it->color, 1454 it->color,
1456 it->thick, 1455 it->thick,
1457 it->background_color)); 1456 it->background_color));
1458 } 1457 }
1459 1458
1460 // TODO(suzhe): due to a bug of webkit, we can't use selection range with 1459 // TODO(suzhe): due to a bug of webkit, we can't use selection range with
1461 // composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788 1460 // composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788
1462 host_->ImeSetComposition(composition.text, underlines, 1461 text_input_manager_->GetActiveWidget()->ImeSetComposition(
1463 gfx::Range::InvalidRange(), 1462 composition.text, underlines, gfx::Range::InvalidRange(),
1464 composition.selection.end(), 1463 composition.selection.end(), composition.selection.end());
1465 composition.selection.end());
1466 1464
1467 has_composition_text_ = !composition.text.empty(); 1465 has_composition_text_ = !composition.text.empty();
1468 } 1466 }
1469 1467
1470 void RenderWidgetHostViewAura::ConfirmCompositionText() { 1468 void RenderWidgetHostViewAura::ConfirmCompositionText() {
1471 // TODO(wjmaclean): can host_ ever be null? 1469 if (text_input_manager_ && text_input_manager_->GetActiveWidget() &&
1472 if (host_ && has_composition_text_) { 1470 has_composition_text_) {
1473 host_->ImeConfirmComposition(base::string16(), gfx::Range::InvalidRange(), 1471 text_input_manager_->GetActiveWidget()->ImeConfirmComposition(
1474 false); 1472 base::string16(), gfx::Range::InvalidRange(), false);
1475 } 1473 }
1476 has_composition_text_ = false; 1474 has_composition_text_ = false;
1477 } 1475 }
1478 1476
1479 void RenderWidgetHostViewAura::ClearCompositionText() { 1477 void RenderWidgetHostViewAura::ClearCompositionText() {
1480 // TODO(wjmaclean): can host_ ever be null? 1478 if (text_input_manager_ && text_input_manager_->GetActiveWidget() &&
1481 if (host_ && has_composition_text_) 1479 has_composition_text_)
1482 host_->ImeCancelComposition(); 1480 text_input_manager_->GetActiveWidget()->ImeCancelComposition();
1483 has_composition_text_ = false; 1481 has_composition_text_ = false;
1484 } 1482 }
1485 1483
1486 void RenderWidgetHostViewAura::InsertText(const base::string16& text) { 1484 void RenderWidgetHostViewAura::InsertText(const base::string16& text) {
1487 DCHECK_NE(GetTextInputType(), ui::TEXT_INPUT_TYPE_NONE); 1485 DCHECK_NE(GetTextInputType(), ui::TEXT_INPUT_TYPE_NONE);
1488 1486
1489 // TODO(wjmaclean): can host_ ever be null? 1487 if (text_input_manager_ && text_input_manager_->GetActiveWidget())
Charlie Reis 2016/06/21 21:13:56 nit: Needs braces, since body doesn't fit on one l
EhsanK 2016/06/22 18:26:32 Done.
1490 if (host_) 1488 text_input_manager_->GetActiveWidget()->ImeConfirmComposition(
1491 host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false); 1489 text, gfx::Range::InvalidRange(), false);
1492 has_composition_text_ = false; 1490 has_composition_text_ = false;
1493 } 1491 }
1494 1492
1495 void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) { 1493 void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) {
1496 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { 1494 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) {
1497 popup_child_host_view_->InsertChar(event); 1495 popup_child_host_view_->InsertChar(event);
1498 return; 1496 return;
1499 } 1497 }
1500 1498
1501 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 1499 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 3014
3017 //////////////////////////////////////////////////////////////////////////////// 3015 ////////////////////////////////////////////////////////////////////////////////
3018 // RenderWidgetHostViewBase, public: 3016 // RenderWidgetHostViewBase, public:
3019 3017
3020 // static 3018 // static
3021 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 3019 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
3022 GetScreenInfoForWindow(results, NULL); 3020 GetScreenInfoForWindow(results, NULL);
3023 } 3021 }
3024 3022
3025 } // namespace content 3023 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698