| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_GTK_BROWSER_WINDOW_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 void UpdateDevToolsForContents(content::WebContents* contents); | 197 void UpdateDevToolsForContents(content::WebContents* contents); |
| 198 | 198 |
| 199 // Shows docked devtools. | 199 // Shows docked devtools. |
| 200 void ShowDevToolsContainer(); | 200 void ShowDevToolsContainer(); |
| 201 | 201 |
| 202 // Hides docked devtools. | 202 // Hides docked devtools. |
| 203 void HideDevToolsContainer(); | 203 void HideDevToolsContainer(); |
| 204 | 204 |
| 205 void OnDebouncedBoundsChanged(); | 205 void OnDebouncedBoundsChanged(); |
| 206 | 206 |
| 207 // Request the underlying window to unmaximize. Also tries to work around | 207 // Request the underlying window to unmaximize. |
| 208 // a window manager "feature" that can prevent this in some edge cases. | |
| 209 void UnMaximize(); | 208 void UnMaximize(); |
| 210 | 209 |
| 211 // Returns false if we're not ready to close yet. E.g., a tab may have an | 210 // Returns false if we're not ready to close yet. E.g., a tab may have an |
| 212 // onbeforeunload handler that prevents us from closing. | 211 // onbeforeunload handler that prevents us from closing. |
| 213 bool CanClose() const; | 212 bool CanClose() const; |
| 214 | 213 |
| 215 // Returns whether to draw the content drop shadow on the sides and bottom | 214 // Returns whether to draw the content drop shadow on the sides and bottom |
| 216 // of the browser window. When false, we still draw a shadow on the top of | 215 // of the browser window. When false, we still draw a shadow on the top of |
| 217 // the toolbar (under the tab strip), but do not round the top corners. | 216 // the toolbar (under the tab strip), but do not round the top corners. |
| 218 bool ShouldDrawContentDropShadow() const; | 217 bool ShouldDrawContentDropShadow() const; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge); | 271 virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge); |
| 273 | 272 |
| 274 // Returns the window shape for the window with |width| and |height|. | 273 // Returns the window shape for the window with |width| and |height|. |
| 275 // The caller is responsible for destroying the region if non-null region is | 274 // The caller is responsible for destroying the region if non-null region is |
| 276 // returned. | 275 // returned. |
| 277 virtual GdkRegion* GetWindowShape(int width, int height) const; | 276 virtual GdkRegion* GetWindowShape(int width, int height) const; |
| 278 | 277 |
| 279 // Draws the frame, including background, border and drop shadow. | 278 // Draws the frame, including background, border and drop shadow. |
| 280 virtual void DrawFrame(GtkWidget* widget, GdkEventExpose* event); | 279 virtual void DrawFrame(GtkWidget* widget, GdkEventExpose* event); |
| 281 | 280 |
| 282 virtual bool HandleTitleBarLeftMousePress(GdkEventButton* event, | 281 virtual bool HandleTitleBarLeftMousePress(GdkEventButton* event); |
| 283 guint32 last_click_time, | |
| 284 gfx::Point last_click_position); | |
| 285 | 282 |
| 286 // Returns true if handled. | 283 // Returns true if handled. |
| 287 virtual bool HandleWindowEdgeLeftMousePress(GtkWindow* window, | 284 virtual bool HandleWindowEdgeLeftMousePress(GtkWindow* window, |
| 288 GdkWindowEdge edge, | 285 GdkWindowEdge edge, |
| 289 GdkEventButton* event); | 286 GdkEventButton* event); |
| 290 | 287 |
| 291 // Save the window position in the prefs. | 288 // Save the window position in the prefs. |
| 292 virtual void SaveWindowPosition(); | 289 virtual void SaveWindowPosition(); |
| 293 | 290 |
| 294 // Sets the default size for the window and the way the user is allowed to | 291 // Sets the default size for the window and the way the user is allowed to |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 452 |
| 456 // Hides UI elements for unsupported window features. | 453 // Hides UI elements for unsupported window features. |
| 457 void HideUnsupportedWindowFeatures(); | 454 void HideUnsupportedWindowFeatures(); |
| 458 | 455 |
| 459 // Helper functions that query |browser_| concerning support for UI features | 456 // Helper functions that query |browser_| concerning support for UI features |
| 460 // in this window. (For example, a popup window might not support a tabstrip). | 457 // in this window. (For example, a popup window might not support a tabstrip). |
| 461 bool IsTabStripSupported() const; | 458 bool IsTabStripSupported() const; |
| 462 bool IsToolbarSupported() const; | 459 bool IsToolbarSupported() const; |
| 463 bool IsBookmarkBarSupported() const; | 460 bool IsBookmarkBarSupported() const; |
| 464 | 461 |
| 465 // Returns |true| if the window bounds match the monitor size. | |
| 466 bool BoundsMatchMonitorSize(); | |
| 467 | |
| 468 // Put the bookmark bar where it belongs. | 462 // Put the bookmark bar where it belongs. |
| 469 void PlaceBookmarkBar(bool is_floating); | 463 void PlaceBookmarkBar(bool is_floating); |
| 470 | 464 |
| 471 // Determine whether we use should default to native decorations or the custom | 465 // Determine whether we use should default to native decorations or the custom |
| 472 // frame based on the currently-running window manager. | 466 // frame based on the currently-running window manager. |
| 473 static bool GetCustomFramePrefDefault(); | 467 static bool GetCustomFramePrefDefault(); |
| 474 | 468 |
| 475 // The position and size of the current window. | 469 // The position and size of the current window. |
| 476 gfx::Rect bounds_; | 470 gfx::Rect bounds_; |
| 477 | 471 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 | 539 |
| 546 // The current window cursor. We set it to a resize cursor when over the | 540 // The current window cursor. We set it to a resize cursor when over the |
| 547 // custom frame border. We set it to NULL if we want the default cursor. | 541 // custom frame border. We set it to NULL if we want the default cursor. |
| 548 GdkCursor* frame_cursor_; | 542 GdkCursor* frame_cursor_; |
| 549 | 543 |
| 550 // True if the window manager thinks the window is active. Not all window | 544 // True if the window manager thinks the window is active. Not all window |
| 551 // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case | 545 // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case |
| 552 // this will always be true. | 546 // this will always be true. |
| 553 bool is_active_; | 547 bool is_active_; |
| 554 | 548 |
| 555 // Keep track of the last click time and the last click position so we can | |
| 556 // filter out extra GDK_BUTTON_PRESS events when a double click happens. | |
| 557 guint32 last_click_time_; | |
| 558 gfx::Point last_click_position_; | |
| 559 | |
| 560 // Optionally maximize or minimize the window after we call | 549 // Optionally maximize or minimize the window after we call |
| 561 // BrowserWindow::Show for the first time. This is to work around a compiz | 550 // BrowserWindow::Show for the first time. This is to work around a compiz |
| 562 // bug. | 551 // bug. |
| 563 ui::WindowShowState show_state_after_show_; | 552 ui::WindowShowState show_state_after_show_; |
| 564 | 553 |
| 565 // If true, don't call gdk_window_raise() when we get a click in the title | 554 // If true, don't call gdk_window_raise() when we get a click in the title |
| 566 // bar or window border. This is to work around a compiz bug. | 555 // bar or window border. This is to work around a compiz bug. |
| 567 bool suppress_window_raise_; | 556 bool suppress_window_raise_; |
| 568 | 557 |
| 569 // The accelerator group used to handle accelerators, owned by this object. | 558 // The accelerator group used to handle accelerators, owned by this object. |
| 570 GtkAccelGroup* accel_group_; | 559 GtkAccelGroup* accel_group_; |
| 571 | 560 |
| 572 scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_; | 561 scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_; |
| 573 | 562 |
| 574 FullscreenExitBubbleType fullscreen_exit_bubble_type_; | 563 FullscreenExitBubbleType fullscreen_exit_bubble_type_; |
| 575 | 564 |
| 576 content::NotificationRegistrar registrar_; | 565 content::NotificationRegistrar registrar_; |
| 577 | 566 |
| 578 DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk); | 567 DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk); |
| 579 }; | 568 }; |
| 580 | 569 |
| 581 #endif // CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_ | 570 #endif // CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_ |
| OLD | NEW |