| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 opener_id_(MSG_ROUTING_NONE), | 240 opener_id_(MSG_ROUTING_NONE), |
| 241 next_paint_flags_(0), | 241 next_paint_flags_(0), |
| 242 auto_resize_mode_(false), | 242 auto_resize_mode_(false), |
| 243 need_update_rect_for_auto_resize_(false), | 243 need_update_rect_for_auto_resize_(false), |
| 244 did_show_(false), | 244 did_show_(false), |
| 245 is_hidden_(hidden), | 245 is_hidden_(hidden), |
| 246 compositor_never_visible_(never_visible), | 246 compositor_never_visible_(never_visible), |
| 247 is_fullscreen_granted_(false), | 247 is_fullscreen_granted_(false), |
| 248 display_mode_(blink::WebDisplayModeUndefined), | 248 display_mode_(blink::WebDisplayModeUndefined), |
| 249 ime_event_guard_(nullptr), | 249 ime_event_guard_(nullptr), |
| 250 ime_in_batch_edit_(false), | |
| 251 closing_(false), | 250 closing_(false), |
| 252 host_closing_(false), | 251 host_closing_(false), |
| 253 is_swapped_out_(swapped_out), | 252 is_swapped_out_(swapped_out), |
| 254 for_oopif_(false), | 253 for_oopif_(false), |
| 255 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 254 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 256 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 255 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
| 257 text_input_flags_(0), | 256 text_input_flags_(0), |
| 258 can_compose_inline_(true), | 257 can_compose_inline_(true), |
| 259 composition_range_(gfx::Range::InvalidRange()), | 258 composition_range_(gfx::Range::InvalidRange()), |
| 260 popup_type_(popup_type), | 259 popup_type_(popup_type), |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 530 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
| 532 IPC_MESSAGE_HANDLER(ViewMsg_SetFrameSinkId, OnSetFrameSinkId) | 531 IPC_MESSAGE_HANDLER(ViewMsg_SetFrameSinkId, OnSetFrameSinkId) |
| 533 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, | 532 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, |
| 534 OnWaitNextFrameForTests) | 533 OnWaitNextFrameForTests) |
| 535 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, | 534 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, |
| 536 OnRequestCompositionUpdate) | 535 OnRequestCompositionUpdate) |
| 537 #if defined(OS_ANDROID) | 536 #if defined(OS_ANDROID) |
| 538 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) | 537 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
| 539 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, | 538 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, |
| 540 OnRequestTextInputStateUpdate) | 539 OnRequestTextInputStateUpdate) |
| 541 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, | |
| 542 OnImeBatchEdit) | |
| 543 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) | 540 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) |
| 544 #endif | 541 #endif |
| 545 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) | 542 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) |
| 546 IPC_MESSAGE_UNHANDLED(handled = false) | 543 IPC_MESSAGE_UNHANDLED(handled = false) |
| 547 IPC_END_MESSAGE_MAP() | 544 IPC_END_MESSAGE_MAP() |
| 548 return handled; | 545 return handled; |
| 549 } | 546 } |
| 550 | 547 |
| 551 bool RenderWidget::Send(IPC::Message* message) { | 548 bool RenderWidget::Send(IPC::Message* message) { |
| 552 // Don't send any messages after the browser has told us to close, and filter | 549 // Don't send any messages after the browser has told us to close, and filter |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 params.composition_start = new_info.compositionStart; | 992 params.composition_start = new_info.compositionStart; |
| 996 params.composition_end = new_info.compositionEnd; | 993 params.composition_end = new_info.compositionEnd; |
| 997 params.can_compose_inline = new_can_compose_inline; | 994 params.can_compose_inline = new_can_compose_inline; |
| 998 params.show_ime_if_needed = (show_ime == ShowIme::IF_NEEDED); | 995 params.show_ime_if_needed = (show_ime == ShowIme::IF_NEEDED); |
| 999 #if defined(USE_AURA) | 996 #if defined(USE_AURA) |
| 1000 params.is_non_ime_change = true; | 997 params.is_non_ime_change = true; |
| 1001 #endif | 998 #endif |
| 1002 #if defined(OS_ANDROID) | 999 #if defined(OS_ANDROID) |
| 1003 params.is_non_ime_change = | 1000 params.is_non_ime_change = |
| 1004 (change_source == ChangeSource::FROM_NON_IME) || text_field_is_dirty_; | 1001 (change_source == ChangeSource::FROM_NON_IME) || text_field_is_dirty_; |
| 1005 params.batch_edit = ime_in_batch_edit_; | |
| 1006 if (params.is_non_ime_change) | 1002 if (params.is_non_ime_change) |
| 1007 OnImeEventSentForAck(new_info); | 1003 OnImeEventSentForAck(new_info); |
| 1008 text_field_is_dirty_ = false; | 1004 text_field_is_dirty_ = false; |
| 1009 #endif | 1005 #endif |
| 1010 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); | 1006 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); |
| 1011 | 1007 |
| 1012 text_input_info_ = new_info; | 1008 text_input_info_ = new_info; |
| 1013 text_input_type_ = new_type; | 1009 text_input_type_ = new_type; |
| 1014 text_input_mode_ = new_mode; | 1010 text_input_mode_ = new_mode; |
| 1015 can_compose_inline_ = new_can_compose_inline; | 1011 can_compose_inline_ = new_can_compose_inline; |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 void RenderWidget::OnImeEventAck() { | 1656 void RenderWidget::OnImeEventAck() { |
| 1661 DCHECK_GE(text_input_info_history_.size(), 1u); | 1657 DCHECK_GE(text_input_info_history_.size(), 1u); |
| 1662 text_input_info_history_.pop_front(); | 1658 text_input_info_history_.pop_front(); |
| 1663 } | 1659 } |
| 1664 | 1660 |
| 1665 void RenderWidget::OnRequestTextInputStateUpdate() { | 1661 void RenderWidget::OnRequestTextInputStateUpdate() { |
| 1666 DCHECK(!ime_event_guard_); | 1662 DCHECK(!ime_event_guard_); |
| 1667 UpdateSelectionBounds(); | 1663 UpdateSelectionBounds(); |
| 1668 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); | 1664 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); |
| 1669 } | 1665 } |
| 1670 | |
| 1671 void RenderWidget::OnImeBatchEdit(bool begin) { | |
| 1672 if (begin) { | |
| 1673 ime_in_batch_edit_ = true; | |
| 1674 return; | |
| 1675 } | |
| 1676 if (!ime_in_batch_edit_) | |
| 1677 return; | |
| 1678 ime_in_batch_edit_ = false; | |
| 1679 DCHECK(!ime_event_guard_); | |
| 1680 UpdateSelectionBounds(); | |
| 1681 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); | |
| 1682 } | |
| 1683 #endif | 1666 #endif |
| 1684 | 1667 |
| 1685 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, | 1668 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, |
| 1686 bool monitor_request) { | 1669 bool monitor_request) { |
| 1687 monitor_composition_info_ = monitor_request; | 1670 monitor_composition_info_ = monitor_request; |
| 1688 if (!immediate_request) | 1671 if (!immediate_request) |
| 1689 return; | 1672 return; |
| 1690 UpdateCompositionInfo(true /* immediate request */); | 1673 UpdateCompositionInfo(true /* immediate request */); |
| 1691 } | 1674 } |
| 1692 | 1675 |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2206 bool RenderWidget::isPointerLocked() { | 2189 bool RenderWidget::isPointerLocked() { |
| 2207 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2190 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2208 webwidget_mouse_lock_target_.get()); | 2191 webwidget_mouse_lock_target_.get()); |
| 2209 } | 2192 } |
| 2210 | 2193 |
| 2211 blink::WebWidget* RenderWidget::GetWebWidget() const { | 2194 blink::WebWidget* RenderWidget::GetWebWidget() const { |
| 2212 return webwidget_internal_; | 2195 return webwidget_internal_; |
| 2213 } | 2196 } |
| 2214 | 2197 |
| 2215 } // namespace content | 2198 } // namespace content |
| OLD | NEW |