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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 235693002: Merge 260900 "linux_aura: Port GtkKeybindingsHandler to Aura." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1916/src/
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
===================================================================
--- content/browser/renderer_host/render_widget_host_view_aura.cc (revision 263301)
+++ content/browser/renderer_host/render_widget_host_view_aura.cc (working copy)
@@ -94,6 +94,12 @@
#include "ui/gfx/win/dpi.h"
#endif
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#include "content/common/input_messages.h"
+#include "ui/events/x/text_edit_command_x11.h"
+#include "ui/events/x/text_edit_key_bindings_delegate_x11.h"
+#endif
+
using gfx::RectToSkIRect;
using gfx::SkIRectToRect;
@@ -2405,7 +2411,7 @@
ch,
flags,
now);
- host_->ForwardKeyboardEvent(webkit_event);
+ ForwardKeyboardEvent(webkit_event);
}
}
@@ -2793,10 +2799,10 @@
event->is_char() ? event->GetCharacter() : event->key_code(),
event->flags(),
ui::EventTimeForNow().InSecondsF());
- host_->ForwardKeyboardEvent(webkit_event);
+ ForwardKeyboardEvent(webkit_event);
} else {
NativeWebKeyboardEvent webkit_event(event);
- host_->ForwardKeyboardEvent(webkit_event);
+ ForwardKeyboardEvent(webkit_event);
}
}
event->SetHandled();
@@ -3569,6 +3575,35 @@
input_method->SetFocusedTextInputClient(NULL);
}
+void RenderWidgetHostViewAura::ForwardKeyboardEvent(
+ const NativeWebKeyboardEvent& event) {
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ ui::TextEditKeyBindingsDelegateX11* keybinding_delegate =
+ ui::GetTextEditKeyBindingsDelegate();
+ std::vector<ui::TextEditCommandX11> commands;
+ if (!event.skip_in_browser &&
+ keybinding_delegate &&
+ event.os_event &&
+ keybinding_delegate->MatchEvent(*event.os_event, &commands)) {
+ // Transform from ui/ types to content/ types.
+ EditCommands edit_commands;
+ for (std::vector<ui::TextEditCommandX11>::const_iterator it =
+ commands.begin(); it != commands.end(); ++it) {
+ edit_commands.push_back(EditCommand(it->GetCommandString(),
+ it->argument()));
+ }
+ host_->Send(new InputMsg_SetEditCommandsForNextKeyEvent(
+ host_->GetRoutingID(), edit_commands));
+ NativeWebKeyboardEvent copy_event(event);
+ copy_event.match_edit_command = true;
+ host_->ForwardKeyboardEvent(copy_event);
+ return;
+ }
+#endif
+
+ host_->ForwardKeyboardEvent(event);
+}
+
void RenderWidgetHostViewAura::LockResources() {
DCHECK(frame_provider_);
delegated_frame_evictor_->LockFrame();
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | content/public/browser/native_web_keyboard_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698