| 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 72%
|
| copy from content/browser/renderer_host/gtk_key_bindings_handler.h
|
| copy to chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h
|
| index 9006f5d0727163882f7305a24abc0f5295703c66..2701310d042a80b853e39b59b6151207b7cefded 100644
|
| --- a/content/browser/renderer_host/gtk_key_bindings_handler.h
|
| +++ b/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h
|
| @@ -2,19 +2,27 @@
|
| // 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 <vector>
|
|
|
| -#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 "ui/wm/public/text_edit_command_x11.h"
|
|
|
| namespace content {
|
| struct NativeWebKeyboardEvent;
|
| +}
|
| +
|
| +namespace ui {
|
| +class Event;
|
| +}
|
| +
|
| +namespace libgtk2ui {
|
|
|
| // This class is a convenience class for handling editor key bindings defined
|
| // in gtk keyboard theme.
|
| @@ -35,22 +43,23 @@ 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:
|
| - 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);
|
| + // Edit commands matched with |event| will be stored in |edit_commands|, if
|
| + // non-NULL.
|
| + bool MatchEvent(const ui::Event& event,
|
| + std::vector<ui::wm::TextEditCommandX11>* commands);
|
|
|
| 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.
|
| @@ -62,7 +71,13 @@ class CONTENT_EXPORT GtkKeyBindingsHandler {
|
| GtkWidget* CreateNewHandler();
|
|
|
| // Adds an edit command to the key event.
|
| - void EditCommandMatched(const std::string& name, const std::string& value);
|
| + void EditCommandMatched(ui::wm::TextEditCommandX11::CommandId id,
|
| + const std::string& value,
|
| + bool extend_selection);
|
| +
|
| + // 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 +88,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 +136,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_;
|
| + std::vector<ui::wm::TextEditCommandX11> 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_
|
|
|