| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_GTK_BROWSER_WINDOW_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_BROWSER_WINDOW_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_BROWSER_WINDOW_GTK_H_ | 6 #define CHROME_BROWSER_GTK_BROWSER_WINDOW_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // it needs to manipulate the window. | 47 // it needs to manipulate the window. |
| 48 | 48 |
| 49 class BrowserWindowGtk : public BrowserWindow, | 49 class BrowserWindowGtk : public BrowserWindow, |
| 50 public NotificationObserver, | 50 public NotificationObserver, |
| 51 public TabStripModelObserver, | 51 public TabStripModelObserver, |
| 52 public ActiveWindowWatcherX::Observer { | 52 public ActiveWindowWatcherX::Observer { |
| 53 public: | 53 public: |
| 54 explicit BrowserWindowGtk(Browser* browser); | 54 explicit BrowserWindowGtk(Browser* browser); |
| 55 virtual ~BrowserWindowGtk(); | 55 virtual ~BrowserWindowGtk(); |
| 56 | 56 |
| 57 // Process a keyboard event which was not handled by webkit. | |
| 58 bool HandleKeyboardEvent(GdkEventKey* event); | |
| 59 | |
| 60 // Overridden from BrowserWindow | 57 // Overridden from BrowserWindow |
| 61 virtual void Show(); | 58 virtual void Show(); |
| 62 virtual void SetBounds(const gfx::Rect& bounds); | 59 virtual void SetBounds(const gfx::Rect& bounds); |
| 63 virtual void Close(); | 60 virtual void Close(); |
| 64 virtual void Activate(); | 61 virtual void Activate(); |
| 65 virtual bool IsActive() const; | 62 virtual bool IsActive() const; |
| 66 virtual void FlashFrame(); | 63 virtual void FlashFrame(); |
| 67 virtual gfx::NativeWindow GetNativeHandle(); | 64 virtual gfx::NativeWindow GetNativeHandle(); |
| 68 virtual BrowserWindowTesting* GetBrowserWindowTesting(); | 65 virtual BrowserWindowTesting* GetBrowserWindowTesting(); |
| 69 virtual StatusBubble* GetStatusBubble(); | 66 virtual StatusBubble* GetStatusBubble(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 gfx::NativeWindow parent_window); | 111 gfx::NativeWindow parent_window); |
| 115 virtual void UserChangedTheme(); | 112 virtual void UserChangedTheme(); |
| 116 virtual int GetExtraRenderViewHeight() const; | 113 virtual int GetExtraRenderViewHeight() const; |
| 117 virtual void TabContentsFocused(TabContents* tab_contents); | 114 virtual void TabContentsFocused(TabContents* tab_contents); |
| 118 virtual void ShowPageInfo(Profile* profile, | 115 virtual void ShowPageInfo(Profile* profile, |
| 119 const GURL& url, | 116 const GURL& url, |
| 120 const NavigationEntry::SSLStatus& ssl, | 117 const NavigationEntry::SSLStatus& ssl, |
| 121 bool show_history); | 118 bool show_history); |
| 122 virtual void ShowPageMenu(); | 119 virtual void ShowPageMenu(); |
| 123 virtual void ShowAppMenu(); | 120 virtual void ShowAppMenu(); |
| 124 virtual int GetCommandId(const NativeWebKeyboardEvent& event); | 121 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| 122 bool* is_keyboard_shortcut); |
| 123 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 125 virtual void ShowCreateShortcutsDialog(TabContents* tab_contents); | 124 virtual void ShowCreateShortcutsDialog(TabContents* tab_contents); |
| 126 | 125 |
| 127 // Overridden from NotificationObserver: | 126 // Overridden from NotificationObserver: |
| 128 virtual void Observe(NotificationType type, | 127 virtual void Observe(NotificationType type, |
| 129 const NotificationSource& source, | 128 const NotificationSource& source, |
| 130 const NotificationDetails& details); | 129 const NotificationDetails& details); |
| 131 | 130 |
| 132 // Overridden from TabStripModelObserver: | 131 // Overridden from TabStripModelObserver: |
| 133 virtual void TabDetachedAt(TabContents* contents, int index); | 132 virtual void TabDetachedAt(TabContents* contents, int index); |
| 134 virtual void TabSelectedAt(TabContents* old_contents, | 133 virtual void TabSelectedAt(TabContents* old_contents, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 void SetBoundsImpl(const gfx::Rect& bounds, bool exterior); | 271 void SetBoundsImpl(const gfx::Rect& bounds, bool exterior); |
| 273 | 272 |
| 274 // Callback for when the custom frame alignment needs to be redrawn. | 273 // Callback for when the custom frame alignment needs to be redrawn. |
| 275 // The content area includes the toolbar and web page but not the tab strip. | 274 // The content area includes the toolbar and web page but not the tab strip. |
| 276 static gboolean OnCustomFrameExpose(GtkWidget* widget, GdkEventExpose* event, | 275 static gboolean OnCustomFrameExpose(GtkWidget* widget, GdkEventExpose* event, |
| 277 BrowserWindowGtk* window); | 276 BrowserWindowGtk* window); |
| 278 // A helper method that draws the shadow above the toolbar and in the frame | 277 // A helper method that draws the shadow above the toolbar and in the frame |
| 279 // border during an expose. | 278 // border during an expose. |
| 280 static void DrawContentShadow(cairo_t* cr, BrowserWindowGtk* window); | 279 static void DrawContentShadow(cairo_t* cr, BrowserWindowGtk* window); |
| 281 | 280 |
| 281 // Callback for accelerator activation. |user_data| stores the command id |
| 282 // of the matched accelerator. |
| 282 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group, | 283 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group, |
| 283 GObject* acceleratable, | 284 GObject* acceleratable, |
| 284 guint keyval, | 285 guint keyval, |
| 285 GdkModifierType modifier, | 286 GdkModifierType modifier, |
| 286 BrowserWindowGtk* browser_window); | 287 void* user_data); |
| 288 |
| 289 // Key press event callback. |
| 290 static gboolean OnKeyPress(GtkWidget* widget, |
| 291 GdkEventKey* event, |
| 292 BrowserWindowGtk* window); |
| 287 | 293 |
| 288 // Mouse move and mouse button press callbacks. | 294 // Mouse move and mouse button press callbacks. |
| 289 static gboolean OnMouseMoveEvent(GtkWidget* widget, | 295 static gboolean OnMouseMoveEvent(GtkWidget* widget, |
| 290 GdkEventMotion* event, | 296 GdkEventMotion* event, |
| 291 BrowserWindowGtk* browser); | 297 BrowserWindowGtk* window); |
| 292 static gboolean OnButtonPressEvent(GtkWidget* widget, | 298 static gboolean OnButtonPressEvent(GtkWidget* widget, |
| 293 GdkEventButton* event, | 299 GdkEventButton* event, |
| 294 BrowserWindowGtk* browser); | 300 BrowserWindowGtk* window); |
| 295 | 301 |
| 296 // Maps and Unmaps the xid of |widget| to |window|. | 302 // Maps and Unmaps the xid of |widget| to |window|. |
| 297 static void MainWindowMapped(GtkWidget* widget, BrowserWindowGtk* window); | 303 static void MainWindowMapped(GtkWidget* widget, BrowserWindowGtk* window); |
| 298 static void MainWindowUnMapped(GtkWidget* widget, BrowserWindowGtk* window); | 304 static void MainWindowUnMapped(GtkWidget* widget, BrowserWindowGtk* window); |
| 299 | 305 |
| 300 // Tracks focus state of browser. | 306 // Tracks focus state of browser. |
| 301 static gboolean OnFocusIn(GtkWidget* widget, | 307 static gboolean OnFocusIn(GtkWidget* widget, |
| 302 GdkEventFocus* event, | 308 GdkEventFocus* event, |
| 303 BrowserWindowGtk* browser); | 309 BrowserWindowGtk* window); |
| 304 static gboolean OnFocusOut(GtkWidget* widget, | 310 static gboolean OnFocusOut(GtkWidget* widget, |
| 305 GdkEventFocus* event, | 311 GdkEventFocus* event, |
| 306 BrowserWindowGtk* browser); | 312 BrowserWindowGtk* window); |
| 307 | 313 |
| 308 // A small shim for browser_->ExecuteCommand. | 314 // A small shim for browser_->ExecuteCommand. |
| 309 void ExecuteBrowserCommand(int id); | 315 // Returns true if the command was executed. |
| 316 bool ExecuteBrowserCommand(int id); |
| 310 | 317 |
| 311 // Callback for the loading animation(s) associated with this window. | 318 // Callback for the loading animation(s) associated with this window. |
| 312 void LoadingAnimationCallback(); | 319 void LoadingAnimationCallback(); |
| 313 | 320 |
| 314 // Shows UI elements for supported window features. | 321 // Shows UI elements for supported window features. |
| 315 void ShowSupportedWindowFeatures(); | 322 void ShowSupportedWindowFeatures(); |
| 316 | 323 |
| 317 // Hides UI elements for unsupported window features. | 324 // Hides UI elements for unsupported window features. |
| 318 void HideUnsupportedWindowFeatures(); | 325 void HideUnsupportedWindowFeatures(); |
| 319 | 326 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 438 |
| 432 // The accelerator group used to handle accelerators, owned by this object. | 439 // The accelerator group used to handle accelerators, owned by this object. |
| 433 GtkAccelGroup* accel_group_; | 440 GtkAccelGroup* accel_group_; |
| 434 | 441 |
| 435 scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_; | 442 scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_; |
| 436 | 443 |
| 437 DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk); | 444 DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk); |
| 438 }; | 445 }; |
| 439 | 446 |
| 440 #endif // CHROME_BROWSER_GTK_BROWSER_WINDOW_GTK_H_ | 447 #endif // CHROME_BROWSER_GTK_BROWSER_WINDOW_GTK_H_ |
| OLD | NEW |