| Index: chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h
|
| diff --git a/content/browser/renderer_host/gtk_key_bindings_handler.h b/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h
|
| similarity index 74%
|
| copy from content/browser/renderer_host/gtk_key_bindings_handler.h
|
| copy to chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h
|
| index 9006f5d0727163882f7305a24abc0f5295703c66..7cd7e291c4c24d0bc934dae4475119d38674d74c 100644
|
| --- a/content/browser/renderer_host/gtk_key_bindings_handler.h
|
| +++ b/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h
|
| @@ -2,19 +2,23 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CONTENT_BROWSER_RENDERER_HOST_GTK_KEY_BINDINGS_HANDLER_H_
|
| -#define CONTENT_BROWSER_RENDERER_HOST_GTK_KEY_BINDINGS_HANDLER_H_
|
| +#ifndef CHROME_BROWSER_UI_LIBGTK2UI_GTK2_KEY_BINDINGS_HANDLER_H_
|
| +#define CHROME_BROWSER_UI_LIBGTK2UI_GTK2_KEY_BINDINGS_HANDLER_H_
|
|
|
| #include <gtk/gtk.h>
|
|
|
| #include <string>
|
|
|
| -#include "content/common/edit_command.h"
|
| -#include "content/common/content_export.h"
|
| -#include "ui/base/gtk/owned_widget_gtk.h"
|
| +#include "base/event_types.h"
|
| +#include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h"
|
| +#include "content/public/browser/keybinding_handler_aurax11.h"
|
| +#include "content/public/common/edit_command.h"
|
|
|
| namespace content {
|
| struct NativeWebKeyboardEvent;
|
| +}
|
| +
|
| +namespace libgtk2ui {
|
|
|
| // This class is a convenience class for handling editor key bindings defined
|
| // in gtk keyboard theme.
|
| @@ -35,22 +39,20 @@ struct NativeWebKeyboardEvent;
|
| // definition of webkit edit commands.
|
| // See webkit/glue/editor_client_impl.cc for key bindings predefined in our
|
| // webkit glue.
|
| -class CONTENT_EXPORT GtkKeyBindingsHandler {
|
| +class Gtk2KeyBindingsHandler : public content::KeybindingHandlerAuraX11 {
|
| public:
|
| - explicit GtkKeyBindingsHandler(GtkWidget* parent_widget);
|
| - ~GtkKeyBindingsHandler();
|
| + Gtk2KeyBindingsHandler();
|
| + virtual ~Gtk2KeyBindingsHandler();
|
|
|
| - // Matches a key event against predefined gtk key bindings, false will be
|
| - // returned if the key event doesn't correspond to a predefined key binding.
|
| - // Edit commands matched with |wke| will be stored in |edit_commands|.
|
| - bool Match(const NativeWebKeyboardEvent& wke,
|
| - EditCommands* edit_commands);
|
| + // Overridden from content::KeybindingHandlerAuraX11:
|
| + virtual bool Match(const content::NativeWebKeyboardEvent& wke,
|
| + content::EditCommands* edit_commands) OVERRIDE;
|
|
|
| private:
|
| // Object structure of Handler class, which is derived from GtkTextView.
|
| struct Handler {
|
| GtkTextView parent_object;
|
| - GtkKeyBindingsHandler *owner;
|
| + Gtk2KeyBindingsHandler *owner;
|
| };
|
|
|
| // Class structure of Handler class.
|
| @@ -64,6 +66,10 @@ class CONTENT_EXPORT GtkKeyBindingsHandler {
|
| // Adds an edit command to the key event.
|
| void EditCommandMatched(const std::string& name, const std::string& value);
|
|
|
| + // Builds a fake GdkEventKey from an XEvent.
|
| + void BuildGdkEventKeyFromXEvent(const base::NativeEvent& xevent,
|
| + GdkEventKey* gdk_event);
|
| +
|
| // Initializes Handler structure.
|
| static void HandlerInit(Handler *self);
|
|
|
| @@ -73,8 +79,8 @@ class CONTENT_EXPORT GtkKeyBindingsHandler {
|
| // Registeres Handler class to GObject type system and return its type id.
|
| static GType HandlerGetType();
|
|
|
| - // Gets the GtkKeyBindingsHandler object which owns the Handler object.
|
| - static GtkKeyBindingsHandler* GetHandlerOwner(GtkTextView* text_view);
|
| + // Gets the Gtk2KeyBindingsHandler object which owns the Handler object.
|
| + static Gtk2KeyBindingsHandler* GetHandlerOwner(GtkTextView* text_view);
|
|
|
| // Handler of "backspace" signal.
|
| static void BackSpace(GtkTextView* text_view);
|
| @@ -121,12 +127,17 @@ class CONTENT_EXPORT GtkKeyBindingsHandler {
|
| // Handler of "move-focus" signal.
|
| static void MoveFocus(GtkWidget* widget, GtkDirectionType arg1);
|
|
|
| - ui::OwnedWidgetGtk handler_;
|
| + GtkWidget* fake_window_;
|
| +
|
| + libgtk2ui::OwnedWidgetGtk handler_;
|
|
|
| // Buffer to store the match results.
|
| - EditCommands edit_commands_;
|
| + content::EditCommands edit_commands_;
|
| +
|
| + // Whether the current X server has the XKeyboard extension.
|
| + bool has_xkb_;
|
| };
|
|
|
| -} // namespace content
|
| +} // namespace libgtk2ui
|
|
|
| -#endif // CONTENT_BROWSER_RENDERER_HOST_GTK_KEY_BINDINGS_HANDLER_H_
|
| +#endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_KEY_BINDINGS_HANDLER_H_
|
|
|