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 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { | 1224 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { |
1225 popup_child_host_view_->InsertChar(event); | 1225 popup_child_host_view_->InsertChar(event); |
1226 return; | 1226 return; |
1227 } | 1227 } |
1228 | 1228 |
1229 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 | 1229 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 |
1230 // TODO(wjmaclean): can host_ ever be null? | 1230 // TODO(wjmaclean): can host_ ever be null? |
1231 if (host_ && (event_handler_->accept_return_character() || | 1231 if (host_ && (event_handler_->accept_return_character() || |
1232 event.GetCharacter() != ui::VKEY_RETURN)) { | 1232 event.GetCharacter() != ui::VKEY_RETURN)) { |
1233 // Send a blink::WebInputEvent::Char event to |host_|. | 1233 // Send a blink::WebInputEvent::Char event to |host_|. |
1234 ForwardKeyboardEvent(NativeWebKeyboardEvent(event, event.GetCharacter()), | 1234 ForwardKeyboardEventWithLatencyInfo( |
1235 nullptr); | 1235 NativeWebKeyboardEvent(event, event.GetCharacter()), *event.latency(), |
| 1236 nullptr); |
1236 } | 1237 } |
1237 } | 1238 } |
1238 | 1239 |
1239 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { | 1240 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { |
1240 if (text_input_manager_ && text_input_manager_->GetTextInputState()) | 1241 if (text_input_manager_ && text_input_manager_->GetTextInputState()) |
1241 return text_input_manager_->GetTextInputState()->type; | 1242 return text_input_manager_->GetTextInputState()->type; |
1242 return ui::TEXT_INPUT_TYPE_NONE; | 1243 return ui::TEXT_INPUT_TYPE_NONE; |
1243 } | 1244 } |
1244 | 1245 |
1245 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const { | 1246 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const { |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 2230 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
2230 ui::InputMethod* input_method = GetInputMethod(); | 2231 ui::InputMethod* input_method = GetInputMethod(); |
2231 if (input_method) { | 2232 if (input_method) { |
2232 input_method->DetachTextInputClient(this); | 2233 input_method->DetachTextInputClient(this); |
2233 #if defined(OS_CHROMEOS) | 2234 #if defined(OS_CHROMEOS) |
2234 wm::RestoreWindowBoundsOnClientFocusLost(window_->GetToplevelWindow()); | 2235 wm::RestoreWindowBoundsOnClientFocusLost(window_->GetToplevelWindow()); |
2235 #endif // defined(OS_CHROMEOS) | 2236 #endif // defined(OS_CHROMEOS) |
2236 } | 2237 } |
2237 } | 2238 } |
2238 | 2239 |
2239 void RenderWidgetHostViewAura::ForwardKeyboardEvent( | 2240 void RenderWidgetHostViewAura::ForwardKeyboardEventWithLatencyInfo( |
2240 const NativeWebKeyboardEvent& event, | 2241 const NativeWebKeyboardEvent& event, |
| 2242 const ui::LatencyInfo& latency, |
2241 bool* update_event) { | 2243 bool* update_event) { |
2242 RenderWidgetHostImpl* target_host = host_; | 2244 RenderWidgetHostImpl* target_host = host_; |
2243 | 2245 |
2244 // If there are multiple widgets on the page (such as when there are | 2246 // If there are multiple widgets on the page (such as when there are |
2245 // out-of-process iframes), pick the one that should process this event. | 2247 // out-of-process iframes), pick the one that should process this event. |
2246 if (host_->delegate()) | 2248 if (host_->delegate()) |
2247 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); | 2249 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); |
2248 if (!target_host) | 2250 if (!target_host) |
2249 return; | 2251 return; |
2250 | 2252 |
2251 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 2253 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
2252 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = | 2254 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = |
2253 ui::GetTextEditKeyBindingsDelegate(); | 2255 ui::GetTextEditKeyBindingsDelegate(); |
2254 std::vector<ui::TextEditCommandAuraLinux> commands; | 2256 std::vector<ui::TextEditCommandAuraLinux> commands; |
2255 if (!event.skip_in_browser && | 2257 if (!event.skip_in_browser && |
2256 keybinding_delegate && | 2258 keybinding_delegate && |
2257 event.os_event && | 2259 event.os_event && |
2258 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { | 2260 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { |
2259 // Transform from ui/ types to content/ types. | 2261 // Transform from ui/ types to content/ types. |
2260 EditCommands edit_commands; | 2262 EditCommands edit_commands; |
2261 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = | 2263 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = |
2262 commands.begin(); it != commands.end(); ++it) { | 2264 commands.begin(); it != commands.end(); ++it) { |
2263 edit_commands.push_back(EditCommand(it->GetCommandString(), | 2265 edit_commands.push_back(EditCommand(it->GetCommandString(), |
2264 it->argument())); | 2266 it->argument())); |
2265 } | 2267 } |
2266 | 2268 |
2267 target_host->ForwardKeyboardEventWithCommands(event, &edit_commands, | 2269 target_host->ForwardKeyboardEventWithCommands(event, latency, |
2268 update_event); | 2270 &edit_commands, update_event); |
2269 return; | 2271 return; |
2270 } | 2272 } |
2271 #endif | 2273 #endif |
2272 | 2274 |
2273 target_host->ForwardKeyboardEventWithCommands(event, nullptr, update_event); | 2275 target_host->ForwardKeyboardEventWithCommands(event, latency, nullptr, |
| 2276 update_event); |
2274 } | 2277 } |
2275 | 2278 |
2276 void RenderWidgetHostViewAura::CreateSelectionController() { | 2279 void RenderWidgetHostViewAura::CreateSelectionController() { |
2277 ui::TouchSelectionController::Config tsc_config; | 2280 ui::TouchSelectionController::Config tsc_config; |
2278 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( | 2281 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( |
2279 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); | 2282 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); |
2280 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() | 2283 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() |
2281 ->max_touch_move_in_pixels_for_click(); | 2284 ->max_touch_move_in_pixels_for_click(); |
2282 tsc_config.enable_longpress_drag_selection = false; | 2285 tsc_config.enable_longpress_drag_selection = false; |
2283 selection_controller_.reset(new ui::TouchSelectionController( | 2286 selection_controller_.reset(new ui::TouchSelectionController( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2387 } | 2390 } |
2388 | 2391 |
2389 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { | 2392 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { |
2390 if (!delegated_frame_host_) | 2393 if (!delegated_frame_host_) |
2391 return; | 2394 return; |
2392 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || | 2395 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || |
2393 needs_flush_input_); | 2396 needs_flush_input_); |
2394 } | 2397 } |
2395 | 2398 |
2396 } // namespace content | 2399 } // namespace content |
OLD | NEW |