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