Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2775553002: Adds the ability for WebContentsDelegate to decide if event should be updated (Closed)
Patch Set: Fix compile Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) { 1223 if (popup_child_host_view_ && popup_child_host_view_->NeedsInputGrab()) {
1224 popup_child_host_view_->InsertChar(event); 1224 popup_child_host_view_->InsertChar(event);
1225 return; 1225 return;
1226 } 1226 }
1227 1227
1228 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547 1228 // Ignore character messages for VKEY_RETURN sent on CTRL+M. crbug.com/315547
1229 // TODO(wjmaclean): can host_ ever be null? 1229 // TODO(wjmaclean): can host_ ever be null?
1230 if (host_ && (event_handler_->accept_return_character() || 1230 if (host_ && (event_handler_->accept_return_character() ||
1231 event.GetCharacter() != ui::VKEY_RETURN)) { 1231 event.GetCharacter() != ui::VKEY_RETURN)) {
1232 // Send a blink::WebInputEvent::Char event to |host_|. 1232 // Send a blink::WebInputEvent::Char event to |host_|.
1233 ForwardKeyboardEvent(NativeWebKeyboardEvent(event, event.GetCharacter())); 1233 ForwardKeyboardEvent(NativeWebKeyboardEvent(event, event.GetCharacter()),
1234 nullptr);
1234 } 1235 }
1235 } 1236 }
1236 1237
1237 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { 1238 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const {
1238 if (text_input_manager_ && text_input_manager_->GetTextInputState()) 1239 if (text_input_manager_ && text_input_manager_->GetTextInputState())
1239 return text_input_manager_->GetTextInputState()->type; 1240 return text_input_manager_->GetTextInputState()->type;
1240 return ui::TEXT_INPUT_TYPE_NONE; 1241 return ui::TEXT_INPUT_TYPE_NONE;
1241 } 1242 }
1242 1243
1243 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const { 1244 ui::TextInputMode RenderWidgetHostViewAura::GetTextInputMode() const {
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
2216 #endif 2217 #endif
2217 } 2218 }
2218 2219
2219 void RenderWidgetHostViewAura::DetachFromInputMethod() { 2220 void RenderWidgetHostViewAura::DetachFromInputMethod() {
2220 ui::InputMethod* input_method = GetInputMethod(); 2221 ui::InputMethod* input_method = GetInputMethod();
2221 if (input_method) 2222 if (input_method)
2222 input_method->DetachTextInputClient(this); 2223 input_method->DetachTextInputClient(this);
2223 } 2224 }
2224 2225
2225 void RenderWidgetHostViewAura::ForwardKeyboardEvent( 2226 void RenderWidgetHostViewAura::ForwardKeyboardEvent(
2226 const NativeWebKeyboardEvent& event) { 2227 const NativeWebKeyboardEvent& event,
2228 bool* update_event) {
2227 RenderWidgetHostImpl* target_host = host_; 2229 RenderWidgetHostImpl* target_host = host_;
2228 2230
2229 // If there are multiple widgets on the page (such as when there are 2231 // If there are multiple widgets on the page (such as when there are
2230 // out-of-process iframes), pick the one that should process this event. 2232 // out-of-process iframes), pick the one that should process this event.
2231 if (host_->delegate()) 2233 if (host_->delegate())
2232 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); 2234 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_);
2233 if (!target_host) 2235 if (!target_host)
2234 return; 2236 return;
2235 2237
2236 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 2238 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
2237 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate = 2239 ui::TextEditKeyBindingsDelegateAuraLinux* keybinding_delegate =
2238 ui::GetTextEditKeyBindingsDelegate(); 2240 ui::GetTextEditKeyBindingsDelegate();
2239 std::vector<ui::TextEditCommandAuraLinux> commands; 2241 std::vector<ui::TextEditCommandAuraLinux> commands;
2240 if (!event.skip_in_browser && 2242 if (!event.skip_in_browser &&
2241 keybinding_delegate && 2243 keybinding_delegate &&
2242 event.os_event && 2244 event.os_event &&
2243 keybinding_delegate->MatchEvent(*event.os_event, &commands)) { 2245 keybinding_delegate->MatchEvent(*event.os_event, &commands)) {
2244 // Transform from ui/ types to content/ types. 2246 // Transform from ui/ types to content/ types.
2245 EditCommands edit_commands; 2247 EditCommands edit_commands;
2246 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it = 2248 for (std::vector<ui::TextEditCommandAuraLinux>::const_iterator it =
2247 commands.begin(); it != commands.end(); ++it) { 2249 commands.begin(); it != commands.end(); ++it) {
2248 edit_commands.push_back(EditCommand(it->GetCommandString(), 2250 edit_commands.push_back(EditCommand(it->GetCommandString(),
2249 it->argument())); 2251 it->argument()));
2250 } 2252 }
2251 2253
2252 target_host->ForwardKeyboardEventWithCommands(event, &edit_commands); 2254 target_host->ForwardKeyboardEventWithCommands(event, &edit_commands,
2255 update_event);
2253 return; 2256 return;
2254 } 2257 }
2255 #endif 2258 #endif
2256 2259
2257 target_host->ForwardKeyboardEvent(event); 2260 target_host->ForwardKeyboardEventWithCommands(event, nullptr, update_event);
2258 } 2261 }
2259 2262
2260 void RenderWidgetHostViewAura::CreateSelectionController() { 2263 void RenderWidgetHostViewAura::CreateSelectionController() {
2261 ui::TouchSelectionController::Config tsc_config; 2264 ui::TouchSelectionController::Config tsc_config;
2262 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds( 2265 tsc_config.max_tap_duration = base::TimeDelta::FromMilliseconds(
2263 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); 2266 ui::GestureConfiguration::GetInstance()->long_press_time_in_ms());
2264 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance() 2267 tsc_config.tap_slop = ui::GestureConfiguration::GetInstance()
2265 ->max_touch_move_in_pixels_for_click(); 2268 ->max_touch_move_in_pixels_for_click();
2266 tsc_config.enable_longpress_drag_selection = false; 2269 tsc_config.enable_longpress_drag_selection = false;
2267 selection_controller_.reset(new ui::TouchSelectionController( 2270 selection_controller_.reset(new ui::TouchSelectionController(
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 2379
2377 void RenderWidgetHostViewAura::SetPopupChild( 2380 void RenderWidgetHostViewAura::SetPopupChild(
2378 RenderWidgetHostViewAura* popup_child_host_view) { 2381 RenderWidgetHostViewAura* popup_child_host_view) {
2379 popup_child_host_view_ = popup_child_host_view; 2382 popup_child_host_view_ = popup_child_host_view;
2380 event_handler_->SetPopupChild( 2383 event_handler_->SetPopupChild(
2381 popup_child_host_view, 2384 popup_child_host_view,
2382 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); 2385 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr);
2383 } 2386 }
2384 2387
2385 } // namespace content 2388 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698