OLD | NEW |
| (Empty) |
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 translate::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(AvatarBubbleMode mode) 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 virtual void ExecuteExtensionCommand( | |
190 const extensions::Extension* extension, | |
191 const extensions::Command& command) OVERRIDE; | |
192 virtual void ShowPageActionPopup( | |
193 const extensions::Extension* extension) OVERRIDE; | |
194 virtual void ShowBrowserActionPopup( | |
195 const extensions::Extension* extension) OVERRIDE; | |
196 | |
197 // Overridden from NotificationObserver: | |
198 virtual void Observe(int type, | |
199 const content::NotificationSource& source, | |
200 const content::NotificationDetails& details) OVERRIDE; | |
201 | |
202 // Overridden from TabStripModelObserver: | |
203 virtual void TabDetachedAt(content::WebContents* contents, | |
204 int index) OVERRIDE; | |
205 | |
206 // Overridden from ActiveWindowWatcherXObserver. | |
207 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; | |
208 | |
209 // Overridden from InfoBarContainer::Delegate: | |
210 virtual SkColor GetInfoBarSeparatorColor() const OVERRIDE; | |
211 virtual void InfoBarContainerStateChanged(bool is_animating) OVERRIDE; | |
212 virtual bool DrawInfoBarArrows(int* x) const OVERRIDE; | |
213 | |
214 // Overridden from ExtensionKeybindingRegistry::Delegate: | |
215 virtual extensions::ActiveTabPermissionGranter* | |
216 GetActiveTabPermissionGranter() OVERRIDE; | |
217 | |
218 // Accessor for the tab strip. | |
219 TabStripGtk* tabstrip() const { return tabstrip_.get(); } | |
220 | |
221 void OnDebouncedBoundsChanged(); | |
222 | |
223 // Request the underlying window to unmaximize. | |
224 void UnMaximize(); | |
225 | |
226 // Returns false if we're not ready to close yet. E.g., a tab may have an | |
227 // onbeforeunload handler that prevents us from closing. | |
228 bool CanClose() const; | |
229 | |
230 // Returns whether to draw the content drop shadow on the sides and bottom | |
231 // of the browser window. When false, we still draw a shadow on the top of | |
232 // the toolbar (under the tab strip), but do not round the top corners. | |
233 bool ShouldDrawContentDropShadow() const; | |
234 | |
235 bool ShouldShowWindowIcon() const; | |
236 | |
237 // Add the find bar widget to the window hierarchy. | |
238 void AddFindBar(FindBarGtk* findbar); | |
239 | |
240 // Reset the mouse cursor to the default cursor if it was set to something | |
241 // else for the custom frame. | |
242 void ResetCustomFrameCursor(); | |
243 | |
244 // Returns the BrowserWindowGtk registered with |window|. | |
245 static BrowserWindowGtk* GetBrowserWindowForNativeWindow( | |
246 gfx::NativeWindow window); | |
247 | |
248 // Retrieves the GtkWindow associated with |xid|, which is the X Window | |
249 // ID of the top-level X window of this object. | |
250 static GtkWindow* GetBrowserWindowForXID(XID xid); | |
251 | |
252 Browser* browser() const { return browser_.get(); } | |
253 | |
254 GtkWindow* window() const { return window_; } | |
255 | |
256 BrowserTitlebar* titlebar() const { return titlebar_.get(); } | |
257 | |
258 GtkWidget* titlebar_widget() const; | |
259 | |
260 BrowserToolbarGtk* GetToolbar() { return toolbar_.get(); } | |
261 | |
262 gfx::Rect bounds() const { return bounds_; } | |
263 | |
264 // Returns the tab we're currently displaying in the tab contents container. | |
265 content::WebContents* GetDisplayedTab(); | |
266 | |
267 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | |
268 | |
269 // Tells GTK that the toolbar area is invalidated and needs redrawing. We | |
270 // have this method as a hack because GTK doesn't queue the toolbar area for | |
271 // redraw when it should. | |
272 void QueueToolbarRedraw(); | |
273 | |
274 // Get the position where the infobar arrow should be anchored in | |
275 // |relative_to| coordinates. This is the middle of the omnibox location icon. | |
276 int GetXPositionOfLocationIcon(GtkWidget* relative_to); | |
277 | |
278 // Show or hide the bookmark bar. | |
279 void MaybeShowBookmarkBar(bool animate); | |
280 | |
281 protected: | |
282 virtual void DestroyBrowser() OVERRIDE; | |
283 | |
284 // Checks to see if the mouse pointer at |x|, |y| is over the border of the | |
285 // custom frame (a spot that should trigger a window resize). Returns true if | |
286 // it should and sets |edge|. | |
287 bool GetWindowEdge(int x, int y, GdkWindowEdge* edge); | |
288 | |
289 // Returns the window shape for the window with |width| and |height|. | |
290 // The caller is responsible for destroying the region if non-null region is | |
291 // returned. | |
292 GdkRegion* GetWindowShape(int width, int height) const; | |
293 | |
294 // Save the window position in the prefs. | |
295 void SaveWindowPosition(); | |
296 | |
297 // Sets the default size for the window and the way the user is allowed to | |
298 // resize it. | |
299 void SetGeometryHints(); | |
300 | |
301 // Returns |true| if we should use the custom frame. | |
302 bool UseCustomFrame() const; | |
303 | |
304 // Invalidate window to force repaint. | |
305 void InvalidateWindow(); | |
306 | |
307 // Top level window. NULL after the window starts closing. | |
308 GtkWindow* window_; | |
309 // Determines whether window was shown. | |
310 bool window_has_shown_; | |
311 // GtkAlignment that holds the interior components of the chromium window. | |
312 // This is used to draw the custom frame border and content shadow. Owned by | |
313 // window_. | |
314 GtkWidget* window_container_; | |
315 // VBox that holds everything (tabs, toolbar, bookmarks bar, tab contents). | |
316 // Owned by window_container_. | |
317 GtkWidget* window_vbox_; | |
318 // VBox that holds everything below the toolbar. Owned by | |
319 // render_area_floating_container_. | |
320 GtkWidget* render_area_vbox_; | |
321 // Floating container that holds the render area. It is needed to position | |
322 // the findbar. Owned by render_area_event_box_. | |
323 GtkWidget* render_area_floating_container_; | |
324 // EventBox that holds render_area_floating_container_. Owned by window_vbox_. | |
325 GtkWidget* render_area_event_box_; | |
326 // Border between toolbar and render area. Owned by render_area_vbox_. | |
327 GtkWidget* toolbar_border_; | |
328 | |
329 scoped_ptr<Browser> browser_; | |
330 | |
331 private: | |
332 // Connect to signals on |window_|. | |
333 void ConnectHandlersToSignals(); | |
334 | |
335 // Create the various UI components. | |
336 void InitWidgets(); | |
337 | |
338 // Set up background color of the window (depends on if we're incognito or | |
339 // not). | |
340 void SetBackgroundColor(); | |
341 | |
342 // Applies the window shape to if we're in custom drawing mode. | |
343 void UpdateWindowShape(int width, int height); | |
344 | |
345 // Connect accelerators that aren't connected to menu items (like ctrl-o, | |
346 // ctrl-l, etc.). | |
347 void ConnectAccelerators(); | |
348 | |
349 // Whether we should draw the tab background instead of the theme_frame | |
350 // background because this window is a popup. | |
351 bool UsingCustomPopupFrame() const; | |
352 | |
353 // Draws the normal custom frame using theme_frame. | |
354 void DrawCustomFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event); | |
355 | |
356 // Draws the tab image as the frame so we can write legible text. | |
357 void DrawPopupFrame(cairo_t* cr, GtkWidget* widget, GdkEventExpose* event); | |
358 | |
359 // Draws the border, including resizable corners, for the custom frame. | |
360 void DrawCustomFrameBorder(GtkWidget* widget); | |
361 | |
362 // Change whether we're showing the custom blue frame. | |
363 // Must be called once at startup. | |
364 // Triggers relayout of the content. | |
365 void UpdateCustomFrame(); | |
366 | |
367 // Set the bounds of the current window. If |exterior| is true, set the size | |
368 // of the window itself, otherwise set the bounds of the web contents. | |
369 // If |move| is true, set the position of the window, otherwise leave the | |
370 // position to the WM. | |
371 void SetBoundsImpl(const gfx::Rect& bounds, bool exterior, bool move); | |
372 | |
373 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnConfigure, | |
374 GdkEventConfigure*); | |
375 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnWindowState, | |
376 GdkEventWindowState*); | |
377 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnMainWindowDeleteEvent, | |
378 GdkEvent*); | |
379 CHROMEGTK_CALLBACK_0(BrowserWindowGtk, void, OnMainWindowDestroy); | |
380 // Callback for when the custom frame alignment needs to be redrawn. | |
381 // The content area includes the toolbar and web page but not the tab strip. | |
382 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnCustomFrameExpose, | |
383 GdkEventExpose*); | |
384 | |
385 // A helper method that draws the shadow above the toolbar and in the frame | |
386 // border during an expose. | |
387 void DrawContentShadow(cairo_t* cr); | |
388 | |
389 // The background frame image needs to be offset by the size of the top of | |
390 // the window to the top of the tabs when the full skyline isn't displayed | |
391 // for some reason. | |
392 int GetVerticalOffset(); | |
393 | |
394 // Returns which frame image we should use based on the window's current | |
395 // activation state / incognito state. | |
396 int GetThemeFrameResource(); | |
397 | |
398 // Invalidate all the widgets that need to redraw when the infobar draw state | |
399 // has changed. | |
400 void InvalidateInfoBarBits(); | |
401 | |
402 // When the location icon moves, we have to redraw the arrow. | |
403 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnLocationIconSizeAllocate, | |
404 GtkAllocation*); | |
405 | |
406 // Used to draw the infobar arrow and drop shadow. This is connected to | |
407 // multiple widgets' expose events because it overlaps several widgets. | |
408 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnExposeDrawInfobarBits, | |
409 GdkEventExpose*); | |
410 | |
411 // Used to draw the infobar bits for the bookmark bar. When the bookmark | |
412 // bar is in floating mode, it has to draw a drop shadow only; otherwise | |
413 // it is responsible for its portion of the arrow as well as some shadowing. | |
414 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnBookmarkBarExpose, | |
415 GdkEventExpose*); | |
416 | |
417 // Callback for "size-allocate" signal on bookmark bar; this is relevant | |
418 // because when the bookmark bar changes dimensions, the infobar arrow has to | |
419 // change its shape, and we need to queue appropriate redraws. | |
420 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnBookmarkBarSizeAllocate, | |
421 GtkAllocation*); | |
422 | |
423 // Callback for accelerator activation. |user_data| stores the command id | |
424 // of the matched accelerator. | |
425 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group, | |
426 GObject* acceleratable, | |
427 guint keyval, | |
428 GdkModifierType modifier, | |
429 void* user_data); | |
430 | |
431 // Key press event callback. | |
432 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnKeyPress, GdkEventKey*); | |
433 | |
434 // Mouse move and mouse button press callbacks. | |
435 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnMouseMoveEvent, | |
436 GdkEventMotion*); | |
437 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnButtonPressEvent, | |
438 GdkEventButton*); | |
439 | |
440 // Tracks focus state of browser. | |
441 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnFocusIn, | |
442 GdkEventFocus*); | |
443 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnFocusOut, | |
444 GdkEventFocus*); | |
445 | |
446 // Callback for the loading animation(s) associated with this window. | |
447 void LoadingAnimationCallback(); | |
448 | |
449 // Shows UI elements for supported window features. | |
450 void ShowSupportedWindowFeatures(); | |
451 | |
452 // Hides UI elements for unsupported window features. | |
453 void HideUnsupportedWindowFeatures(); | |
454 | |
455 // Helper functions that query |browser_| concerning support for UI features | |
456 // in this window. (For example, a popup window might not support a tabstrip). | |
457 bool IsTabStripSupported() const; | |
458 bool IsToolbarSupported() const; | |
459 bool IsBookmarkBarSupported() const; | |
460 | |
461 // Put the bookmark bar where it belongs. | |
462 void PlaceBookmarkBar(bool is_floating); | |
463 | |
464 // Decides if we should draw the frame as if the window is active. | |
465 bool DrawFrameAsActive() const; | |
466 | |
467 // Updates devtools window for given contents. This method will show docked | |
468 // devtools window for inspected |contents| that has docked devtools | |
469 // and hide it for NULL or not inspected |contents|. It will also make | |
470 // sure devtools window size and position are restored for given tab. | |
471 void UpdateDevToolsForContents(content::WebContents* contents); | |
472 | |
473 // Shows docked devtools. | |
474 void ShowDevToolsContainer(); | |
475 | |
476 // Hides docked devtools. | |
477 void HideDevToolsContainer(); | |
478 | |
479 // Called when the preference changes. | |
480 void OnUseCustomChromeFrameChanged(); | |
481 | |
482 // Handler for |devtools_floating_container_|'s "set-floating-position" | |
483 // signal. | |
484 static void OnDevToolsContainerSetFloatingPosition( | |
485 GtkFloatingContainer* container, GtkAllocation* allocation, | |
486 BrowserWindowGtk* browser_window); | |
487 | |
488 // The position and size of the current window. | |
489 gfx::Rect bounds_; | |
490 | |
491 // The configure bounds of the current window, used to figure out whether to | |
492 // ignore later configure events. See OnConfigure() for more information. | |
493 gfx::Rect configure_bounds_; | |
494 | |
495 // The position and size of the non-maximized, non-fullscreen window. | |
496 gfx::Rect restored_bounds_; | |
497 | |
498 GdkWindowState state_; | |
499 | |
500 // Controls a hidden GtkMenuBar that we keep updated so GNOME can take a look | |
501 // inside "our menu bar" and present it in the top panel, akin to Mac OS. | |
502 scoped_ptr<GlobalMenuBar> global_menu_bar_; | |
503 | |
504 // The container for the titlebar + tab strip. | |
505 scoped_ptr<BrowserTitlebar> titlebar_; | |
506 | |
507 // The object that manages all of the widgets in the toolbar. | |
508 scoped_ptr<BrowserToolbarGtk> toolbar_; | |
509 | |
510 // The object that manages the bookmark bar. This will be NULL if the | |
511 // bookmark bar is not supported. | |
512 scoped_ptr<BookmarkBarGtk> bookmark_bar_; | |
513 | |
514 // The download shelf view (view at the bottom of the page). | |
515 scoped_ptr<DownloadShelfGtk> download_shelf_; | |
516 | |
517 // The status bubble manager. Always non-NULL. | |
518 scoped_ptr<StatusBubbleGtk> status_bubble_; | |
519 | |
520 // A container that manages the GtkWidget*s that are the webpage display | |
521 // (along with associated infobars, shelves, and other things that are part | |
522 // of the content area). | |
523 scoped_ptr<TabContentsContainerGtk> contents_container_; | |
524 | |
525 // A container that manages the GtkWidget*s of developer tools for the | |
526 // selected tab contents. | |
527 scoped_ptr<TabContentsContainerGtk> devtools_container_; | |
528 | |
529 // The Extension Keybinding Registry responsible for registering listeners for | |
530 // accelerators that are sent to the window, that are destined to be turned | |
531 // into events and sent to the extension. | |
532 scoped_ptr<ExtensionKeybindingRegistryGtk> extension_keybinding_registry_; | |
533 | |
534 // Docked devtools window instance. NULL when current tab is not inspected | |
535 // or is inspected with undocked version of DevToolsWindow. | |
536 DevToolsWindow* devtools_window_; | |
537 | |
538 // Resizing strategy of contents_container_ inside | |
539 // devtools_floating_container_. Non-empty only if docked devtools is visible. | |
540 DevToolsContentsResizingStrategy contents_resizing_strategy_; | |
541 | |
542 // Floating container for devtools_container_ and contents_container_. | |
543 // Owned by render_area_vbox_. | |
544 GtkWidget* devtools_floating_container_; | |
545 | |
546 // The tab strip. Always non-NULL. | |
547 scoped_ptr<TabStripGtk> tabstrip_; | |
548 | |
549 // The container for info bars. Always non-NULL. | |
550 scoped_ptr<InfoBarContainerGtk> infobar_container_; | |
551 | |
552 // The timer used to update frames for the Loading Animation. | |
553 base::RepeatingTimer<BrowserWindowGtk> loading_animation_timer_; | |
554 | |
555 // The timer used to save the window position for session restore. | |
556 base::OneShotTimer<BrowserWindowGtk> window_configure_debounce_timer_; | |
557 | |
558 // Whether the custom chrome frame pref is set. Normally you want to use | |
559 // UseCustomFrame() above to determine whether to use the custom frame or | |
560 // not. | |
561 BooleanPrefMember use_custom_frame_pref_; | |
562 | |
563 // The current window cursor. We set it to a resize cursor when over the | |
564 // custom frame border. We set it to NULL if we want the default cursor. | |
565 GdkCursor* frame_cursor_; | |
566 | |
567 // True if the window manager thinks the window is active. Not all window | |
568 // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case | |
569 // this will always be true. | |
570 bool is_active_; | |
571 | |
572 // Optionally maximize or minimize the window after we call | |
573 // BrowserWindow::Show for the first time. This is to work around a compiz | |
574 // bug. | |
575 ui::WindowShowState show_state_after_show_; | |
576 | |
577 // If true, don't call gdk_window_raise() when we get a click in the title | |
578 // bar or window border. This is to work around a compiz bug. | |
579 bool suppress_window_raise_; | |
580 | |
581 // The accelerator group used to handle accelerators, owned by this object. | |
582 GtkAccelGroup* accel_group_; | |
583 | |
584 // Set to true while this BrowserWindowGtk is fullscreened. This is needed | |
585 // because GTK cannot ensure requests to fullscreen the window will be honored | |
586 // by all window managers; and therefore bit-testing |state_| is not a | |
587 // reliable "is fullscreened" test. http://crbug.com/286545 | |
588 bool is_fullscreen_; | |
589 | |
590 scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_; | |
591 | |
592 content::NotificationRegistrar registrar_; | |
593 | |
594 DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk); | |
595 }; | |
596 | |
597 #endif // CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_ | |
OLD | NEW |