1// Copyright 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_
6#define CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_
7
8#include <gtk/gtk.h>
9
10#include <string>
11
12#include "base/basictypes.h"
13#include "base/compiler_specific.h"
14#include "base/memory/scoped_ptr.h"
15#include "base/prefs/pref_member.h"
16#include "base/timer/timer.h"
17#include "build/build_config.h"
18#include "chrome/browser/devtools/devtools_window.h"
19#include "chrome/browser/extensions/extension_keybinding_registry.h"
20#include "chrome/browser/infobars/infobar_container.h"
21#include "chrome/browser/ui/browser_window.h"
22#include "chrome/browser/ui/host_desktop.h"
23#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
24#include "ui/base/gtk/gtk_signal.h"
25#include "ui/base/ui_base_types.h"
26#include "ui/base/x/active_window_watcher_x_observer.h"
27#include "ui/base/x/x11_util.h"
28#include "ui/gfx/rect.h"
29
30class BookmarkBarGtk;
31class Browser;
32class BrowserTitlebar;
33class BrowserToolbarGtk;
34class DevToolsWindow;
35class DownloadShelfGtk;
36class ExtensionKeybindingRegistryGtk;
37class FindBarGtk;
38class FullscreenExitBubbleGtk;
39class GlobalMenuBar;
40class InfoBarContainerGtk;
41class InstantOverlayControllerGtk;
42class LocationBar;
43class StatusBubbleGtk;
44class TabContentsContainerGtk;
45class TabStripGtk;
46
47namespace autofill {
48class PasswordGenerator;
49}
50
51namespace extensions {
52class ActiveTabPermissionGranter;
53class Extension;
54}
55
56namespace user_prefs {
57class PrefRegistrySyncable;
58}
59
60// An implementation of BrowserWindow for GTK. Cross-platform code will interact
61// with this object when it needs to manipulate the window.
62class BrowserWindowGtk
63    : public BrowserWindow,
64      public content::NotificationObserver,
65      public TabStripModelObserver,
66      public ui::ActiveWindowWatcherXObserver,
67      public InfoBarContainer::Delegate,
68      public extensions::ExtensionKeybindingRegistry::Delegate {
69 public:
70  explicit BrowserWindowGtk(Browser* browser);
71  virtual ~BrowserWindowGtk();
72
73  // Separating initialization from constructor.
74  void Init();
75
76  // Overridden from BrowserWindow:
77  virtual void Show() OVERRIDE;
78  virtual void ShowInactive() OVERRIDE;
79  virtual void Hide() OVERRIDE;
80  virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
81  virtual void Close() OVERRIDE;
82  virtual void Activate() OVERRIDE;
83  virtual void Deactivate() OVERRIDE;
84  virtual bool IsActive() const OVERRIDE;
85  virtual void FlashFrame(bool flash) OVERRIDE;
86  virtual bool IsAlwaysOnTop() const OVERRIDE;
87  virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
88  virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
89  virtual BrowserWindowTesting* GetBrowserWindowTesting() OVERRIDE;
90  virtual StatusBubble* GetStatusBubble() OVERRIDE;
91  virtual void UpdateTitleBar() OVERRIDE;
92  virtual void BookmarkBarStateChanged(
93      BookmarkBar::AnimateChangeType change_type) OVERRIDE;
94  virtual void UpdateDevTools() OVERRIDE;
95  virtual void UpdateLoadingAnimations(bool should_animate) OVERRIDE;
96  virtual void SetStarredState(bool is_starred) OVERRIDE;
97  virtual void SetTranslateIconToggled(bool is_lit) OVERRIDE;
98  virtual void OnActiveTabChanged(content::WebContents* old_contents,
99                                  content::WebContents* new_contents,
100                                  int index,
101                                  int reason) OVERRIDE;
102  virtual void ZoomChangedForActiveTab(bool can_show_bubble) OVERRIDE;
103  virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
104  virtual ui::WindowShowState GetRestoredState() const OVERRIDE;
105  virtual gfx::Rect GetBounds() const OVERRIDE;
106  virtual bool IsMaximized() const OVERRIDE;
107  virtual bool IsMinimized() const OVERRIDE;
108  virtual void Maximize() OVERRIDE;
109  virtual void Minimize() OVERRIDE;
110  virtual void Restore() OVERRIDE;
111  virtual void EnterFullscreen(
112      const GURL& url, FullscreenExitBubbleType type) OVERRIDE;
113  virtual void ExitFullscreen() OVERRIDE;
114  virtual void UpdateFullscreenExitBubbleContent(
115      const GURL& url,
116      FullscreenExitBubbleType bubble_type) OVERRIDE;
117  virtual bool ShouldHideUIForFullscreen() const OVERRIDE;
118  virtual bool IsFullscreen() const OVERRIDE;
119  virtual bool IsFullscreenBubbleVisible() const OVERRIDE;
120  virtual LocationBar* GetLocationBar() const OVERRIDE;
121  virtual void SetFocusToLocationBar(bool select_all) OVERRIDE;
122  virtual void UpdateReloadStopState(bool is_loading, bool force) OVERRIDE;
123  virtual void UpdateToolbar(content::WebContents* contents) OVERRIDE;
124  virtual void FocusToolbar() OVERRIDE;
125  virtual void FocusAppMenu() OVERRIDE;
126  virtual void FocusBookmarksToolbar() OVERRIDE;
127  virtual void FocusInfobars() OVERRIDE;
128  virtual void RotatePaneFocus(bool forwards) OVERRIDE;
129  virtual bool IsBookmarkBarVisible() const OVERRIDE;
130  virtual bool IsBookmarkBarAnimating() const OVERRIDE;
131  virtual bool IsTabStripEditable() const OVERRIDE;
132  virtual bool IsToolbarVisible() const OVERRIDE;
133  virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
134  virtual void ConfirmAddSearchProvider(TemplateURL* template_url,
135                                        Profile* profile) OVERRIDE;
136  virtual void ShowUpdateChromeDialog() OVERRIDE;
137  virtual void ShowBookmarkBubble(const GURL& url,
138                                  bool already_bookmarked) OVERRIDE;
139  virtual void ShowTranslateBubble(
140      content::WebContents* contents,
141      TranslateBubbleModel::ViewState view_state,
142      TranslateErrors::Type error_type) OVERRIDE;
143#if defined(ENABLE_ONE_CLICK_SIGNIN)
144  virtual void ShowOneClickSigninBubble(
145      OneClickSigninBubbleType type,
146      const base::string16& email,
147      const base::string16& error_message,
148      const StartSyncCallback& start_sync_callback) OVERRIDE;
149#endif
150  virtual bool IsDownloadShelfVisible() const OVERRIDE;
151  virtual DownloadShelf* GetDownloadShelf() OVERRIDE;
152  virtual void ConfirmBrowserCloseWithPendingDownloads(
153      int download_count,
154      Browser::DownloadClosePreventionType dialog_type,
155      bool app_modal,
156      const base::Callback<void(bool)>& callback) OVERRIDE;
157  virtual void UserChangedTheme() OVERRIDE;
158  virtual int GetExtraRenderViewHeight() const OVERRIDE;
159  virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE;
160  virtual void ShowWebsiteSettings(Profile* profile,
161                                   content::WebContents* web_contents,
162                                   const GURL& url,
163                                   const content::SSLStatus& ssl) OVERRIDE;
164  virtual void ShowAppMenu() OVERRIDE;
165  virtual bool PreHandleKeyboardEvent(
166      const content::NativeWebKeyboardEvent& event,
167      bool* is_keyboard_shortcut) OVERRIDE;
168  virtual void HandleKeyboardEvent(
169      const content::NativeWebKeyboardEvent& event) OVERRIDE;
170  virtual void Cut() OVERRIDE;
171  virtual void Copy() OVERRIDE;
172  virtual void Paste() OVERRIDE;
173  virtual WindowOpenDisposition GetDispositionForPopupBounds(
174      const gfx::Rect& bounds) OVERRIDE;
175  virtual FindBar* CreateFindBar() OVERRIDE;
176  virtual web_modal::WebContentsModalDialogHost*
177      GetWebContentsModalDialogHost() OVERRIDE;
178  virtual void ShowAvatarBubble(content::WebContents* web_contents,
179                                const gfx::Rect& rect) OVERRIDE;
180  virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE;
181  virtual void ShowPasswordGenerationBubble(
182      const gfx::Rect& rect,
183      const autofill::PasswordForm& form,
184      autofill::PasswordGenerator* password_generator) OVERRIDE;
185  virtual int GetRenderViewHeightInsetWithDetachedBookmarkBar() OVERRIDE;
186
187  // Overridden from NotificationObserver:
188  virtual void Observe(int type,
189                       const content::NotificationSource& source,
190                       const content::NotificationDetails& details) OVERRIDE;
191
192  // Overridden from TabStripModelObserver:
193  virtual void TabDetachedAt(content::WebContents* contents,
194                             int index) OVERRIDE;
195
196  // Overridden from ActiveWindowWatcherXObserver.
197  virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE;
198
199  // Overridden from InfoBarContainer::Delegate:
200  virtual SkColor GetInfoBarSeparatorColor() const OVERRIDE;
201  virtual void InfoBarContainerStateChanged(bool is_animating) OVERRIDE;
202  virtual bool DrawInfoBarArrows(int* x) const OVERRIDE;
203
204  // Overridden from ExtensionKeybindingRegistry::Delegate:
205  virtual extensions::ActiveTabPermissionGranter*
206      GetActiveTabPermissionGranter() OVERRIDE;
207
208  // Accessor for the tab strip.
209  TabStripGtk* tabstrip() const { return tabstrip_.get(); }
210
211  void OnDebouncedBoundsChanged();
212
213  // Request the underlying window to unmaximize.
214  void UnMaximize();
215
216  // Returns false if we're not ready to close yet.  E.g., a tab may have an
217  // onbeforeunload handler that prevents us from closing.
218  bool CanClose() const;
219
220  // Returns whether to draw the content drop shadow on the sides and bottom
221  // of the browser window. When false, we still draw a shadow on the top of
222  // the toolbar (under the tab strip), but do not round the top corners.
223  bool ShouldDrawContentDropShadow() const;
224
225  bool ShouldShowWindowIcon() const;
226
227  // Add the find bar widget to the window hierarchy.
228  void AddFindBar(FindBarGtk* findbar);
229
230  // Reset the mouse cursor to the default cursor if it was set to something
231  // else for the custom frame.
232  void ResetCustomFrameCursor();
233
234  // Returns the BrowserWindowGtk registered with |window|.
235  static BrowserWindowGtk* GetBrowserWindowForNativeWindow(
236      gfx::NativeWindow window);
237
238  // Retrieves the GtkWindow associated with |xid|, which is the X Window
239  // ID of the top-level X window of this object.
240  static GtkWindow* GetBrowserWindowForXID(XID xid);
241
242  Browser* browser() const { return browser_.get(); }
243
244  GtkWindow* window() const { return window_; }
245
246  BrowserTitlebar* titlebar() const { return titlebar_.get(); }
247
248  GtkWidget* titlebar_widget() const;
249
250  BrowserToolbarGtk* GetToolbar() { return toolbar_.get(); }
251
252  gfx::Rect bounds() const { return bounds_; }
253
254  // Returns the tab we're currently displaying in the tab contents container.
255  content::WebContents* GetDisplayedTab();
256
257  static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
258
259  // Tells GTK that the toolbar area is invalidated and needs redrawing. We
260  // have this method as a hack because GTK doesn't queue the toolbar area for
261  // redraw when it should.
262  void QueueToolbarRedraw();
263
264  // Get the position where the infobar arrow should be anchored in
265  // |relative_to| coordinates. This is the middle of the omnibox location icon.
266  int GetXPositionOfLocationIcon(GtkWidget* relative_to);
267
268  // Show or hide the bookmark bar.
269  void MaybeShowBookmarkBar(bool animate);
270
271 protected:
272  virtual void DestroyBrowser() OVERRIDE;
273
274  // Checks to see if the mouse pointer at |x|, |y| is over the border of the
275  // custom frame (a spot that should trigger a window resize). Returns true if
276  // it should and sets |edge|.
277  bool GetWindowEdge(int x, int y, GdkWindowEdge* edge);
278
279  // Returns the window shape for the window with |width| and |height|.
280  // The caller is responsible for destroying the region if non-null region is
281  // returned.
282  GdkRegion* GetWindowShape(int width, int height) const;
283
284  // Save the window position in the prefs.
285  void SaveWindowPosition();
286
287  // Sets the default size for the window and the way the user is allowed to
288  // resize it.
289  void SetGeometryHints();
290
291  // Returns |true| if we should use the custom frame.
292  bool UseCustomFrame() const;
293
294  // Invalidate window to force repaint.
295  void InvalidateWindow();
296
297  // Top level window. NULL after the window starts closing.
298  GtkWindow* window_;
299  // Determines whether window was shown.
300  bool window_has_shown_;
301  // GtkAlignment that holds the interior components of the chromium window.
302  // This is used to draw the custom frame border and content shadow. Owned by
303  // window_.
304  GtkWidget* window_container_;
305  // VBox that holds everything (tabs, toolbar, bookmarks bar, tab contents).
306  // Owned by window_container_.
307  GtkWidget* window_vbox_;
308  // VBox that holds everything below the toolbar. Owned by
309  // render_area_floating_container_.
310  GtkWidget* render_area_vbox_;
311  // Floating container that holds the render area. It is needed to position
312  // the findbar. Owned by render_area_event_box_.
313  GtkWidget* render_area_floating_container_;
314  // EventBox that holds render_area_floating_container_. Owned by window_vbox_.
315  GtkWidget* render_area_event_box_;
316  // Border between toolbar and render area. Owned by render_area_vbox_.
317  GtkWidget* toolbar_border_;
318
319  scoped_ptr<Browser> browser_;
320
321 private:
322  // Connect to signals on |window_|.
323  void ConnectHandlersToSignals();
324
325  // Create the various UI components.
326  void InitWidgets();
327
328  // Set up background color of the window (depends on if we're incognito or
329  // not).
330  void SetBackgroundColor();
331
332  // Applies the window shape to if we're in custom drawing mode.
333  void UpdateWindowShape(int width, int height);
334
335  // Connect accelerators that aren't connected to menu items (like ctrl-o,
336  // ctrl-l, etc.).
337  void ConnectAccelerators();
338
339  // Whether we should draw the tab background instead of the theme_frame
340  // background because this window is a popup.
341  bool UsingCustomPopupFrame() const;
342
343  // Draws the normal custom frame using theme_frame.
344  void DrawCustomFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event);
345
346  // Draws the tab image as the frame so we can write legible text.
347  void DrawPopupFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event);
348
349  // Draws the border, including resizable corners, for the custom frame.
350  void DrawCustomFrameBorder(GtkWidget* widget);
351
352  // Change whether we're showing the custom blue frame.
353  // Must be called once at startup.
354  // Triggers relayout of the content.
355  void UpdateCustomFrame();
356
357  // Set the bounds of the current window. If |exterior| is true, set the size
358  // of the window itself, otherwise set the bounds of the web contents.
359  // If |move| is true, set the position of the window, otherwise leave the
360  // position to the WM.
361  void SetBoundsImpl(const gfx::Rect& bounds, bool exterior, bool move);
362
363  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnConfigure,
364                       GdkEventConfigure*);
365  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnWindowState,
366                       GdkEventWindowState*);
367  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnMainWindowDeleteEvent,
368                       GdkEvent*);
369  CHROMEGTK_CALLBACK_0(BrowserWindowGtk, void, OnMainWindowDestroy);
370  // Callback for when the custom frame alignment needs to be redrawn.
371  // The content area includes the toolbar and web page but not the tab strip.
372  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnCustomFrameExpose,
373                       GdkEventExpose*);
374
375  // A helper method that draws the shadow above the toolbar and in the frame
376  // border during an expose.
377  void DrawContentShadow(cairo_t* cr);
378
379  // The background frame image needs to be offset by the size of the top of
380  // the window to the top of the tabs when the full skyline isn't displayed
381  // for some reason.
382  int GetVerticalOffset();
383
384  // Returns which frame image we should use based on the window's current
385  // activation state / incognito state.
386  int GetThemeFrameResource();
387
388  // Invalidate all the widgets that need to redraw when the infobar draw state
389  // has changed.
390  void InvalidateInfoBarBits();
391
392  // When the location icon moves, we have to redraw the arrow.
393  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnLocationIconSizeAllocate,
394                       GtkAllocation*);
395
396  // Used to draw the infobar arrow and drop shadow. This is connected to
397  // multiple widgets' expose events because it overlaps several widgets.
398  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnExposeDrawInfobarBits,
399                       GdkEventExpose*);
400
401  // Used to draw the infobar bits for the bookmark bar. When the bookmark
402  // bar is in floating mode, it has to draw a drop shadow only; otherwise
403  // it is responsible for its portion of the arrow as well as some shadowing.
404  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnBookmarkBarExpose,
405                       GdkEventExpose*);
406
407  // Callback for "size-allocate" signal on bookmark bar; this is relevant
408  // because when the bookmark bar changes dimensions, the infobar arrow has to
409  // change its shape, and we need to queue appropriate redraws.
410  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnBookmarkBarSizeAllocate,
411                       GtkAllocation*);
412
413  // Callback for accelerator activation. |user_data| stores the command id
414  // of the matched accelerator.
415  static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group,
416                                   GObject* acceleratable,
417                                   guint keyval,
418                                   GdkModifierType modifier,
419                                   void* user_data);
420
421  // Key press event callback.
422  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnKeyPress, GdkEventKey*);
423
424  // Mouse move and mouse button press callbacks.
425  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnMouseMoveEvent,
426                       GdkEventMotion*);
427  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnButtonPressEvent,
428                       GdkEventButton*);
429
430  // Tracks focus state of browser.
431  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnFocusIn,
432                       GdkEventFocus*);
433  CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnFocusOut,
434                       GdkEventFocus*);
435
436  // Callback for the loading animation(s) associated with this window.
437  void LoadingAnimationCallback();
438
439  // Shows UI elements for supported window features.
440  void ShowSupportedWindowFeatures();
441
442  // Hides UI elements for unsupported window features.
443  void HideUnsupportedWindowFeatures();
444
445  // Helper functions that query |browser_| concerning support for UI features
446  // in this window. (For example, a popup window might not support a tabstrip).
447  bool IsTabStripSupported() const;
448  bool IsToolbarSupported() const;
449  bool IsBookmarkBarSupported() const;
450
451  // Put the bookmark bar where it belongs.
452  void PlaceBookmarkBar(bool is_floating);
453
454  // Decides if we should draw the frame as if the window is active.
455  bool DrawFrameAsActive() const;
456
457  // Updates devtools window for given contents. This method will show docked
458  // devtools window for inspected |contents| that has docked devtools
459  // and hide it for NULL or not inspected |contents|. It will also make
460  // sure devtools window size and position are restored for given tab.
461  void UpdateDevToolsForContents(content::WebContents* contents);
462
463  // Shows docked devtools.
464  void ShowDevToolsContainer();
465
466  // Hides docked devtools.
467  void HideDevToolsContainer();
468
469  // Reads split position from the current tab's devtools window and applies
470  // it to the devtools split.
471  void UpdateDevToolsSplitPosition();
472
473  // Called when the preference changes.
474  void OnUseCustomChromeFrameChanged();
475
476  // Determine whether we use should default to native decorations or the custom
477  // frame based on the currently-running window manager.
478  static bool GetCustomFramePrefDefault();
479
480  // The position and size of the current window.
481  gfx::Rect bounds_;
482
483  // The configure bounds of the current window, used to figure out whether to
484  // ignore later configure events. See OnConfigure() for more information.
485  gfx::Rect configure_bounds_;
486
487  // The position and size of the non-maximized, non-fullscreen window.
488  gfx::Rect restored_bounds_;
489
490  GdkWindowState state_;
491
492  // Controls a hidden GtkMenuBar that we keep updated so GNOME can take a look
493  // inside "our menu bar" and present it in the top panel, akin to Mac OS.
494  scoped_ptr<GlobalMenuBar> global_menu_bar_;
495
496  // The container for the titlebar + tab strip.
497  scoped_ptr<BrowserTitlebar> titlebar_;
498
499  // The object that manages all of the widgets in the toolbar.
500  scoped_ptr<BrowserToolbarGtk> toolbar_;
501
502  // The object that manages the bookmark bar. This will be NULL if the
503  // bookmark bar is not supported.
504  scoped_ptr<BookmarkBarGtk> bookmark_bar_;
505
506  // The download shelf view (view at the bottom of the page).
507  scoped_ptr<DownloadShelfGtk> download_shelf_;
508
509  // The status bubble manager.  Always non-NULL.
510  scoped_ptr<StatusBubbleGtk> status_bubble_;
511
512  // A container that manages the GtkWidget*s that are the webpage display
513  // (along with associated infobars, shelves, and other things that are part
514  // of the content area).
515  scoped_ptr<TabContentsContainerGtk> contents_container_;
516
517  // A container that manages the GtkWidget*s of developer tools for the
518  // selected tab contents.
519  scoped_ptr<TabContentsContainerGtk> devtools_container_;
520
521  // The Extension Keybinding Registry responsible for registering listeners for
522  // accelerators that are sent to the window, that are destined to be turned
523  // into events and sent to the extension.
524  scoped_ptr<ExtensionKeybindingRegistryGtk> extension_keybinding_registry_;
525
526  DevToolsDockSide devtools_dock_side_;
527
528  // Docked devtools window instance. NULL when current tab is not inspected
529  // or is inspected with undocked version of DevToolsWindow.
530  DevToolsWindow* devtools_window_;
531
532  // Split pane containing the contents_container_ and the devtools_container_.
533  // Owned by contents_vsplit_.
534  GtkWidget* contents_hsplit_;
535
536  // Split pane containing the contents_hsplit_ and the devtools_container_.
537  // Owned by render_area_vbox_.
538  GtkWidget* contents_vsplit_;
539
540  // The tab strip.  Always non-NULL.
541  scoped_ptr<TabStripGtk> tabstrip_;
542
543  // The container for info bars. Always non-NULL.
544  scoped_ptr<InfoBarContainerGtk> infobar_container_;
545
546  // The timer used to update frames for the Loading Animation.
547  base::RepeatingTimer<BrowserWindowGtk> loading_animation_timer_;
548
549  // The timer used to save the window position for session restore.
550  base::OneShotTimer<BrowserWindowGtk> window_configure_debounce_timer_;
551
552  // Whether the custom chrome frame pref is set.  Normally you want to use
553  // UseCustomFrame() above to determine whether to use the custom frame or
554  // not.
555  BooleanPrefMember use_custom_frame_pref_;
556
557  // The current window cursor.  We set it to a resize cursor when over the
558  // custom frame border.  We set it to NULL if we want the default cursor.
559  GdkCursor* frame_cursor_;
560
561  // True if the window manager thinks the window is active.  Not all window
562  // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case
563  // this will always be true.
564  bool is_active_;
565
566  // Optionally maximize or minimize the window after we call
567  // BrowserWindow::Show for the first time.  This is to work around a compiz
568  // bug.
569  ui::WindowShowState show_state_after_show_;
570
571  // If true, don't call gdk_window_raise() when we get a click in the title
572  // bar or window border.  This is to work around a compiz bug.
573  bool suppress_window_raise_;
574
575  // The accelerator group used to handle accelerators, owned by this object.
576  GtkAccelGroup* accel_group_;
577
578  // Set to true while this BrowserWindowGtk is fullscreened.  This is needed
579  // because GTK cannot ensure requests to fullscreen the window will be honored
580  // by all window managers; and therefore bit-testing |state_| is not a
581  // reliable "is fullscreened" test.  http://crbug.com/286545
582  bool is_fullscreen_;
583
584  scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_;
585
586  content::NotificationRegistrar registrar_;
587
588  DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk);
589};
590
591#endif  // CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_
592