| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 opener_id_(MSG_ROUTING_NONE), | 230 opener_id_(MSG_ROUTING_NONE), |
| 231 next_paint_flags_(0), | 231 next_paint_flags_(0), |
| 232 auto_resize_mode_(false), | 232 auto_resize_mode_(false), |
| 233 need_update_rect_for_auto_resize_(false), | 233 need_update_rect_for_auto_resize_(false), |
| 234 did_show_(false), | 234 did_show_(false), |
| 235 is_hidden_(hidden), | 235 is_hidden_(hidden), |
| 236 compositor_never_visible_(never_visible), | 236 compositor_never_visible_(never_visible), |
| 237 is_fullscreen_granted_(false), | 237 is_fullscreen_granted_(false), |
| 238 display_mode_(blink::WebDisplayModeUndefined), | 238 display_mode_(blink::WebDisplayModeUndefined), |
| 239 ime_event_guard_(nullptr), | 239 ime_event_guard_(nullptr), |
| 240 ime_in_batch_edit_(false), | |
| 241 closing_(false), | 240 closing_(false), |
| 242 host_closing_(false), | 241 host_closing_(false), |
| 243 is_swapped_out_(swapped_out), | 242 is_swapped_out_(swapped_out), |
| 244 for_oopif_(false), | 243 for_oopif_(false), |
| 245 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 244 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 246 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 245 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
| 247 text_input_flags_(0), | 246 text_input_flags_(0), |
| 248 can_compose_inline_(true), | 247 can_compose_inline_(true), |
| 249 composition_range_(gfx::Range::InvalidRange()), | 248 composition_range_(gfx::Range::InvalidRange()), |
| 250 popup_type_(popup_type), | 249 popup_type_(popup_type), |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 496 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
| 498 IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceClientId, OnSetSurfaceClientId) | 497 IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceClientId, OnSetSurfaceClientId) |
| 499 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, | 498 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, |
| 500 OnWaitNextFrameForTests) | 499 OnWaitNextFrameForTests) |
| 501 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, | 500 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, |
| 502 OnRequestCompositionUpdate) | 501 OnRequestCompositionUpdate) |
| 503 #if defined(OS_ANDROID) | 502 #if defined(OS_ANDROID) |
| 504 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) | 503 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
| 505 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, | 504 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, |
| 506 OnRequestTextInputStateUpdate) | 505 OnRequestTextInputStateUpdate) |
| 507 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, | |
| 508 OnImeBatchEdit) | |
| 509 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) | 506 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) |
| 510 #endif | 507 #endif |
| 511 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) | 508 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) |
| 512 IPC_MESSAGE_UNHANDLED(handled = false) | 509 IPC_MESSAGE_UNHANDLED(handled = false) |
| 513 IPC_END_MESSAGE_MAP() | 510 IPC_END_MESSAGE_MAP() |
| 514 return handled; | 511 return handled; |
| 515 } | 512 } |
| 516 | 513 |
| 517 bool RenderWidget::Send(IPC::Message* message) { | 514 bool RenderWidget::Send(IPC::Message* message) { |
| 518 // Don't send any messages after the browser has told us to close, and filter | 515 // Don't send any messages after the browser has told us to close, and filter |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 params.composition_start = new_info.compositionStart; | 953 params.composition_start = new_info.compositionStart; |
| 957 params.composition_end = new_info.compositionEnd; | 954 params.composition_end = new_info.compositionEnd; |
| 958 params.can_compose_inline = new_can_compose_inline; | 955 params.can_compose_inline = new_can_compose_inline; |
| 959 params.show_ime_if_needed = (show_ime == ShowIme::IF_NEEDED); | 956 params.show_ime_if_needed = (show_ime == ShowIme::IF_NEEDED); |
| 960 #if defined(USE_AURA) | 957 #if defined(USE_AURA) |
| 961 params.is_non_ime_change = true; | 958 params.is_non_ime_change = true; |
| 962 #endif | 959 #endif |
| 963 #if defined(OS_ANDROID) | 960 #if defined(OS_ANDROID) |
| 964 params.is_non_ime_change = | 961 params.is_non_ime_change = |
| 965 (change_source == ChangeSource::FROM_NON_IME) || text_field_is_dirty_; | 962 (change_source == ChangeSource::FROM_NON_IME) || text_field_is_dirty_; |
| 966 params.batch_edit = ime_in_batch_edit_; | |
| 967 if (params.is_non_ime_change) | 963 if (params.is_non_ime_change) |
| 968 OnImeEventSentForAck(new_info); | 964 OnImeEventSentForAck(new_info); |
| 969 text_field_is_dirty_ = false; | 965 text_field_is_dirty_ = false; |
| 970 #endif | 966 #endif |
| 971 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); | 967 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); |
| 972 | 968 |
| 973 text_input_info_ = new_info; | 969 text_input_info_ = new_info; |
| 974 text_input_type_ = new_type; | 970 text_input_type_ = new_type; |
| 975 text_input_mode_ = new_mode; | 971 text_input_mode_ = new_mode; |
| 976 can_compose_inline_ = new_can_compose_inline; | 972 can_compose_inline_ = new_can_compose_inline; |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 void RenderWidget::OnImeEventAck() { | 1600 void RenderWidget::OnImeEventAck() { |
| 1605 DCHECK_GE(text_input_info_history_.size(), 1u); | 1601 DCHECK_GE(text_input_info_history_.size(), 1u); |
| 1606 text_input_info_history_.pop_front(); | 1602 text_input_info_history_.pop_front(); |
| 1607 } | 1603 } |
| 1608 | 1604 |
| 1609 void RenderWidget::OnRequestTextInputStateUpdate() { | 1605 void RenderWidget::OnRequestTextInputStateUpdate() { |
| 1610 DCHECK(!ime_event_guard_); | 1606 DCHECK(!ime_event_guard_); |
| 1611 UpdateSelectionBounds(); | 1607 UpdateSelectionBounds(); |
| 1612 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); | 1608 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); |
| 1613 } | 1609 } |
| 1614 | |
| 1615 void RenderWidget::OnImeBatchEdit(bool begin) { | |
| 1616 if (begin) { | |
| 1617 ime_in_batch_edit_ = true; | |
| 1618 return; | |
| 1619 } | |
| 1620 if (!ime_in_batch_edit_) | |
| 1621 return; | |
| 1622 ime_in_batch_edit_ = false; | |
| 1623 DCHECK(!ime_event_guard_); | |
| 1624 UpdateSelectionBounds(); | |
| 1625 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); | |
| 1626 } | |
| 1627 #endif | 1610 #endif |
| 1628 | 1611 |
| 1629 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, | 1612 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, |
| 1630 bool monitor_request) { | 1613 bool monitor_request) { |
| 1631 monitor_composition_info_ = monitor_request; | 1614 monitor_composition_info_ = monitor_request; |
| 1632 if (!immediate_request) | 1615 if (!immediate_request) |
| 1633 return; | 1616 return; |
| 1634 UpdateCompositionInfo(true /* immediate request */); | 1617 UpdateCompositionInfo(true /* immediate request */); |
| 1635 } | 1618 } |
| 1636 | 1619 |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 void RenderWidget::requestPointerUnlock() { | 2109 void RenderWidget::requestPointerUnlock() { |
| 2127 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); | 2110 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); |
| 2128 } | 2111 } |
| 2129 | 2112 |
| 2130 bool RenderWidget::isPointerLocked() { | 2113 bool RenderWidget::isPointerLocked() { |
| 2131 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2114 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2132 webwidget_mouse_lock_target_.get()); | 2115 webwidget_mouse_lock_target_.get()); |
| 2133 } | 2116 } |
| 2134 | 2117 |
| 2135 } // namespace content | 2118 } // namespace content |
| OLD | NEW |