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/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 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { | 1197 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { |
1198 popup_child_host_view_->InsertChar(event); | 1198 popup_child_host_view_->InsertChar(event); |
1199 return; | 1199 return; |
1200 } | 1200 } |
1201 | 1201 |
1202 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 | 1202 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 |
1203 // TODO(wjmaclean): can host_ ever be null? | 1203 // TODO(wjmaclean): can host_ ever be null? |
1204 if (host_ && (event_handler_->accept_return_character() || | 1204 if (host_ && (event_handler_->accept_return_character() || |
1205 event.GetCharacter() != ui::VKEY_RETURN)) { | 1205 event.GetCharacter() != ui::VKEY_RETURN)) { |
1206 // Send a blink::WebInputEvent::Char event to |host_|. | 1206 // Send a blink::WebInputEvent::Char event to |host_|. |
1207 ForwardKeyboardEvent(NativeWebKeyboardEvent(event, event.GetCharacter()), | 1207 ForwardKeyboardEventWithLatencyInfo( |
1208 nullptr); | 1208 NativeWebKeyboardEvent(event, event.GetCharacter()), *event.latency(), |
| 1209 nullptr); |
1209 } | 1210 } |
1210 } | 1211 } |
1211 | 1212 |
1212 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { | 1213 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { |
1213 if (text_input_manager_ && text_input_manager_->GetTextInputState()) | 1214 if (text_input_manager_ && text_input_manager_->GetTextInputState()) |
1214 return text_input_manager_->GetTextInputState()->type; | 1215 return text_input_manager_->GetTextInputState()->type; |
1215 return ui::TEXT_INPUT_TYPE_NONE; | 1216 return ui::TEXT_INPUT_TYPE_NONE; |
1216 } | 1217 } |
1217 | 1218 |
1218 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const { | 1219 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const { |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); | 2192 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); |
2192 #endif | 2193 #endif |
2193 } | 2194 } |
2194 | 2195 |
2195 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 2196 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
2196 ui::InputMethod* input_method = GetInputMethod(); | 2197 ui::InputMethod* input_method = GetInputMethod(); |
2197 if (input_method) | 2198 if (input_method) |
2198 input_method->DetachTextInputClient(this); | 2199 input_method->DetachTextInputClient(this); |
2199 } | 2200 } |
2200 | 2201 |
2201 void RenderWidgetHostViewAura::ForwardKeyboardEvent( | 2202 void RenderWidgetHostViewAura::ForwardKeyboardEventWithLatencyInfo( |
2202 const NativeWebKeyboardEvent& event, | 2203 const NativeWebKeyboardEvent& event, |
| 2204 const ui::LatencyInfo& latency, |
2203 bool* update_event) { | 2205 bool* update_event) { |
2204 RenderWidgetHostImpl* target_host = host_; | 2206 RenderWidgetHostImpl* target_host = host_; |
2205 | 2207 |
2206 // If there are multiple widgets on the page (such as when there are | 2208 // If there are multiple widgets on the page (such as when there are |
2207 // out-of-process iframes), pick the one that should process this event. | 2209 // out-of-process iframes), pick the one that should process this event. |
2208 if (host_->delegate()) | 2210 if (host_->delegate()) |
2209 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); | 2211 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); |
2210 if (!target_host) | 2212 if (!target_host) |
2211 return; | 2213 return; |
2212 | 2214 |
2213 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 2215 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
2214 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = | 2216 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = |
2215 ui::GetTextEditKeyBindingsDelegate(); | 2217 ui::GetTextEditKeyBindingsDelegate(); |
2216 std::vector<ui::TextEditCommandAuraLinux> commands; | 2218 std::vector<ui::TextEditCommandAuraLinux> commands; |
2217 if (!event.skip_in_browser && | 2219 if (!event.skip_in_browser && |
2218 keybinding_delegate && | 2220 keybinding_delegate && |
2219 event.os_event && | 2221 event.os_event && |
2220 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { | 2222 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { |
2221 // Transform from ui/ types to content/ types. | 2223 // Transform from ui/ types to content/ types. |
2222 EditCommands edit_commands; | 2224 EditCommands edit_commands; |
2223 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = | 2225 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = |
2224 commands.begin(); it != commands.end(); ++it) { | 2226 commands.begin(); it != commands.end(); ++it) { |
2225 edit_commands.push_back(EditCommand(it->GetCommandString(), | 2227 edit_commands.push_back(EditCommand(it->GetCommandString(), |
2226 it->argument())); | 2228 it->argument())); |
2227 } | 2229 } |
2228 | 2230 |
2229 target_host->ForwardKeyboardEventWithCommands(event, &edit_commands, | 2231 target_host->ForwardKeyboardEventWithCommands(event, latency, |
2230 update_event); | 2232 &edit_commands, update_event); |
2231 return; | 2233 return; |
2232 } | 2234 } |
2233 #endif | 2235 #endif |
2234 | 2236 |
2235 target_host->ForwardKeyboardEventWithCommands(event, nullptr, update_event); | 2237 target_host->ForwardKeyboardEventWithCommands(event, latency, nullptr, |
| 2238 update_event); |
2236 } | 2239 } |
2237 | 2240 |
2238 void RenderWidgetHostViewAura::CreateSelectionController() { | 2241 void RenderWidgetHostViewAura::CreateSelectionController() { |
2239 ui::TouchSelectionController::Config tsc_config; | 2242 ui::TouchSelectionController::Config tsc_config; |
2240 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( | 2243 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( |
2241 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); | 2244 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); |
2242 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() | 2245 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() |
2243 ->max_touch_move_in_pixels_for_click(); | 2246 ->max_touch_move_in_pixels_for_click(); |
2244 tsc_config.enable_longpress_drag_selection = false; | 2247 tsc_config.enable_longpress_drag_selection = false; |
2245 selection_controller_.reset(new ui::TouchSelectionController( | 2248 selection_controller_.reset(new ui::TouchSelectionController( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 } | 2349 } |
2347 | 2350 |
2348 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { | 2351 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { |
2349 if (!delegated_frame_host_) | 2352 if (!delegated_frame_host_) |
2350 return; | 2353 return; |
2351 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || | 2354 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || |
2352 needs_flush_input_); | 2355 needs_flush_input_); |
2353 } | 2356 } |
2354 | 2357 |
2355 } // namespace content | 2358 } // namespace content |
OLD | NEW |