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

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: 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 // TODO(wjmaclean): can host_ ever be null?
kenrb 2016/06/13 19:37:47 Nit: That comment can be removed.
EhsanK 2016/06/17 22:36:19 Acknowledged.
1442 if (!host_) 1442 if (!text_input_manager_ || !text_input_manager_->GetActiveWidget())
1443 return; 1443 return;
1444 1444
1445 // TODO(suzhe): convert both renderer_host and renderer to use 1445 // TODO(suzhe): convert both renderer_host and renderer to use
1446 // ui::CompositionText. 1446 // ui::CompositionText.
1447 std::vector<blink::WebCompositionUnderline> underlines; 1447 std::vector<blink::WebCompositionUnderline> underlines;
1448 underlines.reserve(composition.underlines.size()); 1448 underlines.reserve(composition.underlines.size());
1449 for (std::vector<ui::CompositionUnderline>::const_iterator it = 1449 for (std::vector<ui::CompositionUnderline>::const_iterator it =
1450 composition.underlines.begin(); 1450 composition.underlines.begin();
1451 it != composition.underlines.end(); ++it) { 1451 it != composition.underlines.end(); ++it) {
1452 underlines.push_back( 1452 underlines.push_back(
1453 blink::WebCompositionUnderline(static_cast<unsigned>(it->start_offset), 1453 blink::WebCompositionUnderline(static_cast<unsigned>(it->start_offset),
1454 static_cast<unsigned>(it->end_offset), 1454 static_cast<unsigned>(it->end_offset),
1455 it->color, 1455 it->color,
1456 it->thick, 1456 it->thick,
1457 it->background_color)); 1457 it->background_color));
1458 } 1458 }
1459 1459
1460 // TODO(suzhe): due to a bug of webkit, we can't use selection range with 1460 // 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 1461 // composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788
1462 host_->ImeSetComposition(composition.text, underlines, 1462 text_input_manager_->GetActiveWidget()->ImeSetComposition(
kenrb 2016/06/13 19:37:47 I have a slight concern about nullptr derefs here.
EhsanK 2016/06/17 22:36:19 Agreed. I think it is safe to unregister here rath
kenrb 2016/06/20 16:04:06 You need to either address that problem before thi
EhsanK 2016/06/22 18:26:32 We already early return on top when GetActiveWidge
kenrb 2016/06/22 19:39:50 Okay, I had missed the line above. This seems fine
EhsanK 2016/06/22 20:56:43 Sorry for that confusing line. I was thinking of a
1463 gfx::Range::InvalidRange(), 1463 composition.text, underlines, gfx::Range::InvalidRange(),
1464 composition.selection.end(), 1464 composition.selection.end(), composition.selection.end());
1465 composition.selection.end());
1466 1465
1467 has_composition_text_ = !composition.text.empty(); 1466 has_composition_text_ = !composition.text.empty();
1468 } 1467 }
1469 1468
1470 void RenderWidgetHostViewAura::ConfirmCompositionText() { 1469 void RenderWidgetHostViewAura::ConfirmCompositionText() {
1471 // TODO(wjmaclean): can host_ ever be null? 1470 // TODO(wjmaclean): can host_ ever be null?
1472 if (host_ && has_composition_text_) { 1471 if (text_input_manager_ && text_input_manager_->GetActiveWidget() &&
1473 host_->ImeConfirmComposition(base::string16(), gfx::Range::InvalidRange(), 1472 has_composition_text_) {
1474 false); 1473 text_input_manager_->GetActiveWidget()->ImeConfirmComposition(
1474 base::string16(), gfx::Range::InvalidRange(), false);
1475 } 1475 }
1476 has_composition_text_ = false; 1476 has_composition_text_ = false;
1477 } 1477 }
1478 1478
1479 void RenderWidgetHostViewAura::ClearCompositionText() { 1479 void RenderWidgetHostViewAura::ClearCompositionText() {
1480 // TODO(wjmaclean): can host_ ever be null? 1480 // TODO(wjmaclean): can host_ ever be null?
1481 if (host_ && has_composition_text_) 1481 if (text_input_manager_ && text_input_manager_->GetActiveWidget() &&
1482 host_->ImeCancelComposition(); 1482 has_composition_text_)
1483 text_input_manager_->GetActiveWidget()->ImeCancelComposition();
1483 has_composition_text_ = false; 1484 has_composition_text_ = false;
1484 } 1485 }
1485 1486
1486 void RenderWidgetHostViewAura::InsertText(const base::string16& text) { 1487 void RenderWidgetHostViewAura::InsertText(const base::string16& text) {
1487 DCHECK_NE(GetTextInputType(), ui::TEXT_INPUT_TYPE_NONE); 1488 DCHECK_NE(GetTextInputType(), ui::TEXT_INPUT_TYPE_NONE);
1488 1489
1489 // TODO(wjmaclean): can host_ ever be null? 1490 // TODO(wjmaclean): can host_ ever be null?
1490 if (host_) 1491 if (text_input_manager_ && text_input_manager_->GetActiveWidget())
1491 host_->ImeConfirmComposition(text, gfx::Range::InvalidRange(), false); 1492 text_input_manager_->GetActiveWidget()->ImeConfirmComposition(
1493 text, gfx::Range::InvalidRange(), false);
1492 has_composition_text_ = false; 1494 has_composition_text_ = false;
1493 } 1495 }
1494 1496
1495 void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) { 1497 void RenderWidgetHostViewAura::InsertChar(const ui::KeyEvent& event) {
1496 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { 1498 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) {
1497 popup_child_host_view_->InsertChar(event); 1499 popup_child_host_view_->InsertChar(event);
1498 return; 1500 return;
1499 } 1501 }
1500 1502
1501 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 1503 // 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 3018
3017 //////////////////////////////////////////////////////////////////////////////// 3019 ////////////////////////////////////////////////////////////////////////////////
3018 // RenderWidgetHostViewBase, public: 3020 // RenderWidgetHostViewBase, public:
3019 3021
3020 // static 3022 // static
3021 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 3023 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
3022 GetScreenInfoForWindow(results, NULL); 3024 GetScreenInfoForWindow(results, NULL);
3023 } 3025 }
3024 3026
3025 } // namespace content 3027 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698