| OLD | NEW | 
|     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/renderer/render_widget.h" |     5 #include "content/renderer/render_widget.h" | 
|     6  |     6  | 
|     7 #include <memory> |     7 #include <memory> | 
|     8 #include <utility> |     8 #include <utility> | 
|     9  |     9  | 
|    10 #include "base/auto_reset.h" |    10 #include "base/auto_reset.h" | 
| (...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1628     return; |  1628     return; | 
|  1629  |  1629  | 
|  1630 #if BUILDFLAG(ENABLE_PLUGINS) |  1630 #if BUILDFLAG(ENABLE_PLUGINS) | 
|  1631   if (focused_pepper_plugin_) { |  1631   if (focused_pepper_plugin_) { | 
|  1632     focused_pepper_plugin_->render_frame()->OnImeSetComposition( |  1632     focused_pepper_plugin_->render_frame()->OnImeSetComposition( | 
|  1633         text, underlines, selection_start, selection_end); |  1633         text, underlines, selection_start, selection_end); | 
|  1634     return; |  1634     return; | 
|  1635   } |  1635   } | 
|  1636 #endif |  1636 #endif | 
|  1637   ImeEventGuard guard(this); |  1637   ImeEventGuard guard(this); | 
 |  1638   input_handler_->set_ime_composition_replacement(replacement_range.IsValid()); | 
|  1638   blink::WebInputMethodController* controller = GetInputMethodController(); |  1639   blink::WebInputMethodController* controller = GetInputMethodController(); | 
|  1639   if (!controller || |  1640   if (!controller || | 
|  1640       !controller->SetComposition( |  1641       !controller->SetComposition( | 
|  1641           WebString::FromUTF16(text), |  1642           WebString::FromUTF16(text), | 
|  1642           WebVector<WebCompositionUnderline>(underlines), |  1643           WebVector<WebCompositionUnderline>(underlines), | 
|  1643           replacement_range.IsValid() |  1644           replacement_range.IsValid() | 
|  1644               ? WebRange(replacement_range.start(), replacement_range.length()) |  1645               ? WebRange(replacement_range.start(), replacement_range.length()) | 
|  1645               : WebRange(), |  1646               : WebRange(), | 
|  1646           selection_start, selection_end)) { |  1647           selection_start, selection_end)) { | 
|  1647     // If we failed to set the composition text, then we need to let the browser |  1648     // If we failed to set the composition text, then we need to let the browser | 
|  1648     // process to cancel the input method's ongoing composition session, to make |  1649     // process to cancel the input method's ongoing composition session, to make | 
|  1649     // sure we are in a consistent state. |  1650     // sure we are in a consistent state. | 
|  1650     Send(new InputHostMsg_ImeCancelComposition(routing_id())); |  1651     Send(new InputHostMsg_ImeCancelComposition(routing_id())); | 
|  1651   } |  1652   } | 
 |  1653   input_handler_->set_ime_composition_replacement(false); | 
|  1652   UpdateCompositionInfo(false /* not an immediate request */); |  1654   UpdateCompositionInfo(false /* not an immediate request */); | 
|  1653 } |  1655 } | 
|  1654  |  1656  | 
|  1655 void RenderWidget::OnImeCommitText( |  1657 void RenderWidget::OnImeCommitText( | 
|  1656     const base::string16& text, |  1658     const base::string16& text, | 
|  1657     const std::vector<WebCompositionUnderline>& underlines, |  1659     const std::vector<WebCompositionUnderline>& underlines, | 
|  1658     const gfx::Range& replacement_range, |  1660     const gfx::Range& replacement_range, | 
|  1659     int relative_cursor_pos) { |  1661     int relative_cursor_pos) { | 
|  1660   if (!ShouldHandleImeEvents()) |  1662   if (!ShouldHandleImeEvents()) | 
|  1661     return; |  1663     return; | 
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2385     // browser side (https://crbug.com/669219). |  2387     // browser side (https://crbug.com/669219). | 
|  2386     // If there is no WebFrameWidget, then there will be no |  2388     // If there is no WebFrameWidget, then there will be no | 
|  2387     // InputMethodControllers for a WebLocalFrame. |  2389     // InputMethodControllers for a WebLocalFrame. | 
|  2388     return nullptr; |  2390     return nullptr; | 
|  2389   } |  2391   } | 
|  2390   return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |  2392   return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 
|  2391       ->GetActiveWebInputMethodController(); |  2393       ->GetActiveWebInputMethodController(); | 
|  2392 } |  2394 } | 
|  2393  |  2395  | 
|  2394 }  // namespace content |  2396 }  // namespace content | 
| OLD | NEW |