summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/browser_window_gtk.h
diff options
context:
space:
mode:
authorsuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-10 06:01:48 +0000
committersuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-10 06:01:48 +0000
commit867125a08f77a22b770f197d90519a8672af83aa (patch)
tree3d2ba6406f0932155b333af29bb2d9bff3e2d276 /chrome/browser/gtk/browser_window_gtk.h
parent44d64924960f793fd92f964d1e349216757c1856 (diff)
downloadchromium_src-867125a08f77a22b770f197d90519a8672af83aa.zip
chromium_src-867125a08f77a22b770f197d90519a8672af83aa.tar.gz
chromium_src-867125a08f77a22b770f197d90519a8672af83aa.tar.bz2
Refactor the keyboard events handling code related to RenderViewHostDelegate::View and TabContentsDelegate interfaces.
Significant changes made by this CL: 1. The keyboard event handling code has been moved from TabContentsView implementation classes into BrowserWindow implementation classes. Please refer to this discussion thread: http://groups.google.com/group/chromium-dev/browse_thread/thread/e6e0b5cc105659b7/9953c4308bb0000c This change makes the keyboard event flow comply with the relationship between TabContents/TabContentsView and TabContentsDelegate/BrowserWindow. Besides it, the code is also simplified a lot, for example, the keyboard event handling code in chrome/browser/views/tab_contents/tab_contents_view_{gtk,win}.cc are now merged into one copy and moved into chrome/browser/views/frame/browser_view.cc. 2. A pre-handle phrase has been added into the keyboard event handling flow. A keyboard event will be first sent to the browser for pre-handling before being sent to the renderer. Then if the event was not handled by the renderer, it'll be sent to the browser again for post-handling. 3. The keyboard accelerator handling code of Windows and Linux ports have been optimized to get rid off extra command lookup. 4. The keyboard event message flow between the browser and the renderer is changed back to full async mode, all complex logics introduced by revision 29857 are removed. BUG=24479, 26054, 26131, 28839 TEST=See bug reports. Review URL: http://codereview.chromium.org/400012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34234 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/browser_window_gtk.h')
-rw-r--r--chrome/browser/gtk/browser_window_gtk.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h
index 7d55e6c..b379408 100644
--- a/chrome/browser/gtk/browser_window_gtk.h
+++ b/chrome/browser/gtk/browser_window_gtk.h
@@ -54,9 +54,6 @@ class BrowserWindowGtk : public BrowserWindow,
explicit BrowserWindowGtk(Browser* browser);
virtual ~BrowserWindowGtk();
- // Process a keyboard event which was not handled by webkit.
- bool HandleKeyboardEvent(GdkEventKey* event);
-
// Overridden from BrowserWindow
virtual void Show();
virtual void SetBounds(const gfx::Rect& bounds);
@@ -121,7 +118,9 @@ class BrowserWindowGtk : public BrowserWindow,
bool show_history);
virtual void ShowPageMenu();
virtual void ShowAppMenu();
- virtual int GetCommandId(const NativeWebKeyboardEvent& event);
+ virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
+ bool* is_keyboard_shortcut);
+ virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
virtual void ShowCreateShortcutsDialog(TabContents* tab_contents);
// Overridden from NotificationObserver:
@@ -279,19 +278,26 @@ class BrowserWindowGtk : public BrowserWindow,
// border during an expose.
static void DrawContentShadow(cairo_t* cr, BrowserWindowGtk* window);
+ // Callback for accelerator activation. |user_data| stores the command id
+ // of the matched accelerator.
static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group,
GObject* acceleratable,
guint keyval,
GdkModifierType modifier,
- BrowserWindowGtk* browser_window);
+ void* user_data);
+
+ // Key press event callback.
+ static gboolean OnKeyPress(GtkWidget* widget,
+ GdkEventKey* event,
+ BrowserWindowGtk* window);
// Mouse move and mouse button press callbacks.
static gboolean OnMouseMoveEvent(GtkWidget* widget,
GdkEventMotion* event,
- BrowserWindowGtk* browser);
+ BrowserWindowGtk* window);
static gboolean OnButtonPressEvent(GtkWidget* widget,
GdkEventButton* event,
- BrowserWindowGtk* browser);
+ BrowserWindowGtk* window);
// Maps and Unmaps the xid of |widget| to |window|.
static void MainWindowMapped(GtkWidget* widget, BrowserWindowGtk* window);
@@ -300,13 +306,14 @@ class BrowserWindowGtk : public BrowserWindow,
// Tracks focus state of browser.
static gboolean OnFocusIn(GtkWidget* widget,
GdkEventFocus* event,
- BrowserWindowGtk* browser);
+ BrowserWindowGtk* window);
static gboolean OnFocusOut(GtkWidget* widget,
GdkEventFocus* event,
- BrowserWindowGtk* browser);
+ BrowserWindowGtk* window);
// A small shim for browser_->ExecuteCommand.
- void ExecuteBrowserCommand(int id);
+ // Returns true if the command was executed.
+ bool ExecuteBrowserCommand(int id);
// Callback for the loading animation(s) associated with this window.
void LoadingAnimationCallback();