OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #ifndef CHROME_BROWSER_RENDERER_HOST_GTK_KEY_BINDINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_GTK_KEY_BINDINGS_HANDLER_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_GTK_KEY_BINDINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_GTK_KEY_BINDINGS_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 // themes only define editor key bindings exactly for GtkEntry and GtkTextView. | 23 // themes only define editor key bindings exactly for GtkEntry and GtkTextView. |
24 // Then, the only way for us to intercept editor key bindings defined in | 24 // Then, the only way for us to intercept editor key bindings defined in |
25 // keyboard theme, is to create a GtkEntry or GtkTextView object and call | 25 // keyboard theme, is to create a GtkEntry or GtkTextView object and call |
26 // gtk_bindings_activate_event() against it for the key events. If a key event | 26 // gtk_bindings_activate_event() against it for the key events. If a key event |
27 // matches a predefined key binding, corresponding signal will be emitted. | 27 // matches a predefined key binding, corresponding signal will be emitted. |
28 // GtkTextView is used here because it supports more key bindings than GtkEntry, | 28 // GtkTextView is used here because it supports more key bindings than GtkEntry, |
29 // but in order to minimize the side effect of using a GtkTextView object, a new | 29 // but in order to minimize the side effect of using a GtkTextView object, a new |
30 // class derived from GtkTextView is used, which overrides all signals related | 30 // class derived from GtkTextView is used, which overrides all signals related |
31 // to key bindings, to make sure GtkTextView won't receive them. | 31 // to key bindings, to make sure GtkTextView won't receive them. |
32 // | 32 // |
33 // See third_party/WebKit/WebCore/editing/EditorCommand.cpp for detailed | 33 // See third_party/WebKit/Source/WebCore/editing/EditorCommand.cpp for detailed |
34 // definition of webkit edit commands. | 34 // definition of webkit edit commands. |
35 // See webkit/glue/editor_client_impl.cc for key bindings predefined in our | 35 // See webkit/glue/editor_client_impl.cc for key bindings predefined in our |
36 // webkit glue. | 36 // webkit glue. |
37 class GtkKeyBindingsHandler { | 37 class GtkKeyBindingsHandler { |
38 public: | 38 public: |
39 explicit GtkKeyBindingsHandler(GtkWidget* parent_widget); | 39 explicit GtkKeyBindingsHandler(GtkWidget* parent_widget); |
40 ~GtkKeyBindingsHandler(); | 40 ~GtkKeyBindingsHandler(); |
41 | 41 |
42 // Matches a key event against predefined gtk key bindings, false will be | 42 // Matches a key event against predefined gtk key bindings, false will be |
43 // returned if the key event doesn't correspond to a predefined key binding. | 43 // returned if the key event doesn't correspond to a predefined key binding. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Handler of "move-focus" signal. | 119 // Handler of "move-focus" signal. |
120 static void MoveFocus(GtkWidget* widget, GtkDirectionType arg1); | 120 static void MoveFocus(GtkWidget* widget, GtkDirectionType arg1); |
121 | 121 |
122 OwnedWidgetGtk handler_; | 122 OwnedWidgetGtk handler_; |
123 | 123 |
124 // Buffer to store the match results. | 124 // Buffer to store the match results. |
125 EditCommands edit_commands_; | 125 EditCommands edit_commands_; |
126 }; | 126 }; |
127 | 127 |
128 #endif // CHROME_BROWSER_RENDERER_HOST_GTK_KEY_BINDINGS_HANDLER_H_ | 128 #endif // CHROME_BROWSER_RENDERER_HOST_GTK_KEY_BINDINGS_HANDLER_H_ |
OLD | NEW |