| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 bool ShouldShowWindowIcon() const; | 121 bool ShouldShowWindowIcon() const; |
| 122 | 122 |
| 123 // Add the find bar widget to the window hierarchy. | 123 // Add the find bar widget to the window hierarchy. |
| 124 void AddFindBar(FindBarGtk* findbar); | 124 void AddFindBar(FindBarGtk* findbar); |
| 125 | 125 |
| 126 // Sets whether a drag is active. If a drag is active the window will not | 126 // Sets whether a drag is active. If a drag is active the window will not |
| 127 // close. | 127 // close. |
| 128 void set_drag_active(bool drag_active) { drag_active_ = drag_active; } | 128 void set_drag_active(bool drag_active) { drag_active_ = drag_active; } |
| 129 | 129 |
| 130 // Reset the mouse cursor to the default cursor if it was set to something |
| 131 // else for the custom frame. |
| 132 void ResetCustomFrameCursor(); |
| 133 |
| 130 // Returns the BrowserWindowGtk registered with |window|. | 134 // Returns the BrowserWindowGtk registered with |window|. |
| 131 static BrowserWindowGtk* GetBrowserWindowForNativeWindow( | 135 static BrowserWindowGtk* GetBrowserWindowForNativeWindow( |
| 132 gfx::NativeWindow window); | 136 gfx::NativeWindow window); |
| 133 | 137 |
| 134 // Retrieves the GtkWindow associated with |xid|, which is the X Window | 138 // Retrieves the GtkWindow associated with |xid|, which is the X Window |
| 135 // ID of the top-level X window of this object. | 139 // ID of the top-level X window of this object. |
| 136 static GtkWindow* GetBrowserWindowForXID(XID xid); | 140 static GtkWindow* GetBrowserWindowForXID(XID xid); |
| 137 | 141 |
| 138 Browser* browser() { | 142 Browser* browser() { |
| 139 return browser_.get(); | 143 return browser_.get(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // The content area includes the toolbar and web page but not the tab strip. | 202 // The content area includes the toolbar and web page but not the tab strip. |
| 199 static gboolean OnCustomFrameExpose(GtkWidget* widget, GdkEventExpose* event, | 203 static gboolean OnCustomFrameExpose(GtkWidget* widget, GdkEventExpose* event, |
| 200 BrowserWindowGtk* window); | 204 BrowserWindowGtk* window); |
| 201 | 205 |
| 202 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group, | 206 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group, |
| 203 GObject* acceleratable, | 207 GObject* acceleratable, |
| 204 guint keyval, | 208 guint keyval, |
| 205 GdkModifierType modifier, | 209 GdkModifierType modifier, |
| 206 BrowserWindowGtk* browser_window); | 210 BrowserWindowGtk* browser_window); |
| 207 | 211 |
| 212 // Mouse move and mouse button press callbacks. |
| 213 static gboolean OnMouseMoveEvent(GtkWidget* widget, |
| 214 GdkEventMotion* event, |
| 215 BrowserWindowGtk* browser); |
| 216 static gboolean OnButtonPressEvent(GtkWidget* widget, |
| 217 GdkEventButton* event, |
| 218 BrowserWindowGtk* browser); |
| 219 |
| 208 // Maps and Unmaps the xid of |widget| to |window|. | 220 // Maps and Unmaps the xid of |widget| to |window|. |
| 209 static void MainWindowMapped(GtkWidget* widget, BrowserWindowGtk* window); | 221 static void MainWindowMapped(GtkWidget* widget, BrowserWindowGtk* window); |
| 210 static void MainWindowUnMapped(GtkWidget* widget, BrowserWindowGtk* window); | 222 static void MainWindowUnMapped(GtkWidget* widget, BrowserWindowGtk* window); |
| 211 | 223 |
| 212 // A small shim for browser_->ExecuteCommand. | 224 // A small shim for browser_->ExecuteCommand. |
| 213 void ExecuteBrowserCommand(int id); | 225 void ExecuteBrowserCommand(int id); |
| 214 | 226 |
| 215 // Callback for the loading animation(s) associated with this window. | 227 // Callback for the loading animation(s) associated with this window. |
| 216 void LoadingAnimationCallback(); | 228 void LoadingAnimationCallback(); |
| 217 | 229 |
| 218 // Shows UI elements for supported window features. | 230 // Shows UI elements for supported window features. |
| 219 void ShowSupportedWindowFeatures(); | 231 void ShowSupportedWindowFeatures(); |
| 220 | 232 |
| 221 // Hides UI elements for unsupported window features. | 233 // Hides UI elements for unsupported window features. |
| 222 void HideUnsupportedWindowFeatures(); | 234 void HideUnsupportedWindowFeatures(); |
| 223 | 235 |
| 224 // Helper functions that query |browser_| concerning support for UI features | 236 // Helper functions that query |browser_| concerning support for UI features |
| 225 // in this window. (For example, a popup window might not support a tabstrip). | 237 // in this window. (For example, a popup window might not support a tabstrip). |
| 226 bool IsTabStripSupported(); | 238 bool IsTabStripSupported(); |
| 227 bool IsToolbarSupported(); | 239 bool IsToolbarSupported(); |
| 228 bool IsBookmarkBarSupported(); | 240 bool IsBookmarkBarSupported(); |
| 229 | 241 |
| 242 // Checks to see if the mouse pointer at |x|, |y| is over the border of the |
| 243 // custom frame (a spot that should trigger a window resize). Returns true if |
| 244 // it should and sets |edge|. |
| 245 bool GetWindowEdge(int x, int y, GdkWindowEdge* edge); |
| 246 |
| 230 NotificationRegistrar registrar_; | 247 NotificationRegistrar registrar_; |
| 231 | 248 |
| 232 gfx::Rect bounds_; | 249 gfx::Rect bounds_; |
| 233 GdkWindowState state_; | 250 GdkWindowState state_; |
| 234 | 251 |
| 235 // Whether we are full screen. Since IsFullscreen() gets called before | 252 // Whether we are full screen. Since IsFullscreen() gets called before |
| 236 // OnStateChanged(), we can't rely on |state_| & GDK_WINDOW_STATE_FULLSCREEN. | 253 // OnStateChanged(), we can't rely on |state_| & GDK_WINDOW_STATE_FULLSCREEN. |
| 237 bool full_screen_; | 254 bool full_screen_; |
| 238 | 255 |
| 239 // The container for the titlebar + tab strip. | 256 // The container for the titlebar + tab strip. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 265 // Whether we're showing the custom chrome frame or the window manager | 282 // Whether we're showing the custom chrome frame or the window manager |
| 266 // decorations. | 283 // decorations. |
| 267 BooleanPrefMember use_custom_frame_; | 284 BooleanPrefMember use_custom_frame_; |
| 268 | 285 |
| 269 // True if a drag is active. See description above setter for details. | 286 // True if a drag is active. See description above setter for details. |
| 270 bool drag_active_; | 287 bool drag_active_; |
| 271 | 288 |
| 272 // A map which translates an X Window ID into its respective GtkWindow. | 289 // A map which translates an X Window ID into its respective GtkWindow. |
| 273 static std::map<XID, GtkWindow*> xid_map_; | 290 static std::map<XID, GtkWindow*> xid_map_; |
| 274 | 291 |
| 292 // The current window cursor. We set it to a resize cursor when over the |
| 293 // custom frame border. We set it to NULL if we want the default cursor. |
| 294 GdkCursor* frame_cursor_; |
| 295 |
| 275 DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk); | 296 DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk); |
| 276 }; | 297 }; |
| 277 | 298 |
| 278 #endif // CHROME_BROWSER_GTK_BROWSER_WINDOW_GTK_H_ | 299 #endif // CHROME_BROWSER_GTK_BROWSER_WINDOW_GTK_H_ |
| OLD | NEW |