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

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

Issue 213283004: linux_aura: Port GtkKeybindingsHandler to Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for sadrul Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 009b912c965f356f490d141b2bc0fa6d65e9385b..84936607b01433d82c25f3d7e8ff39f4c47686c4 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -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 @@ void RenderWidgetHostViewAura::InsertChar(base::char16 ch, int flags) {
ch,
flags,
now);
- host_->ForwardKeyboardEvent(webkit_event);
+ ForwardKeyboardEvent(webkit_event);
}
}
@@ -2793,10 +2799,10 @@ void RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) {
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 @@ void RenderWidgetHostViewAura::DetachFromInputMethod() {
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