Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: chrome/browser/ui/gtk/browser_window_gtk.h

Issue 10180011: Support painting panels with chromium themes on GTK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // An implementation of BrowserWindow for GTK. 43 // An implementation of BrowserWindow for GTK.
44 // Cross-platform code will interact with this object when 44 // Cross-platform code will interact with this object when
45 // it needs to manipulate the window. 45 // it needs to manipulate the window.
46 46
47 class BrowserWindowGtk : public BrowserWindow, 47 class BrowserWindowGtk : public BrowserWindow,
48 public content::NotificationObserver, 48 public content::NotificationObserver,
49 public TabStripModelObserver, 49 public TabStripModelObserver,
50 public ui::ActiveWindowWatcherXObserver, 50 public ui::ActiveWindowWatcherXObserver,
51 public InfoBarContainer::Delegate { 51 public InfoBarContainer::Delegate {
52 public: 52 public:
53 enum TitleDecoration {
54 PANGO_MARKUP,
55 PLAIN_TEXT
56 };
57
58 explicit BrowserWindowGtk(Browser* browser); 53 explicit BrowserWindowGtk(Browser* browser);
59 virtual ~BrowserWindowGtk(); 54 virtual ~BrowserWindowGtk();
60 55
61 // Separating initialization from constructor allows invocation of virtual 56 // Separating initialization from constructor allows invocation of virtual
62 // functions during initialization. 57 // functions during initialization.
63 virtual void Init(); 58 virtual void Init();
64 59
65 // Allows for a derived class to decorate title text with pango markup.
66 // Returns the type of text used for title.
67 virtual TitleDecoration GetWindowTitle(std::string* title) const;
68
69 // Overridden from BrowserWindow: 60 // Overridden from BrowserWindow:
70 virtual void Show() OVERRIDE; 61 virtual void Show() OVERRIDE;
71 virtual void ShowInactive() OVERRIDE; 62 virtual void ShowInactive() OVERRIDE;
72 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 63 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
73 virtual void Close() OVERRIDE; 64 virtual void Close() OVERRIDE;
74 virtual void Activate() OVERRIDE; 65 virtual void Activate() OVERRIDE;
75 virtual void Deactivate() OVERRIDE; 66 virtual void Deactivate() OVERRIDE;
76 virtual bool IsActive() const OVERRIDE; 67 virtual bool IsActive() const OVERRIDE;
77 virtual void FlashFrame(bool flash) OVERRIDE; 68 virtual void FlashFrame(bool flash) OVERRIDE;
78 virtual bool IsAlwaysOnTop() const OVERRIDE; 69 virtual bool IsAlwaysOnTop() const OVERRIDE;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // Save the window position in the prefs. 274 // Save the window position in the prefs.
284 virtual void SaveWindowPosition(); 275 virtual void SaveWindowPosition();
285 276
286 // Sets the default size for the window and the way the user is allowed to 277 // Sets the default size for the window and the way the user is allowed to
287 // resize it. 278 // resize it.
288 virtual void SetGeometryHints(); 279 virtual void SetGeometryHints();
289 280
290 // Returns |true| if we should use the custom frame. 281 // Returns |true| if we should use the custom frame.
291 virtual bool UseCustomFrame(); 282 virtual bool UseCustomFrame();
292 283
284 // Whether we should draw the tab background instead of the theme_frame
285 // background because this window is a popup.
286 virtual bool UsingCustomPopupFrame() const;
287
293 // Called when the window size changed. 288 // Called when the window size changed.
294 virtual void OnSizeChanged(int width, int height); 289 virtual void OnSizeChanged(int width, int height);
295 290
296 // Draws the normal custom frame using theme_frame. 291 // Draws the normal custom frame using theme_frame.
297 virtual void DrawCustomFrame(cairo_t* cr, GtkWidget* widget, 292 virtual void DrawCustomFrame(cairo_t* cr, GtkWidget* widget,
298 GdkEventExpose* event); 293 GdkEventExpose* event);
299 294
300 // Draws the tab image as the frame so we can write legible text. 295 // Draws the tab image as the frame so we can write legible text.
301 virtual void DrawPopupFrame(cairo_t* cr, GtkWidget* widget, 296 virtual void DrawPopupFrame(cairo_t* cr, GtkWidget* widget,
302 GdkEventExpose* event); 297 GdkEventExpose* event);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 // border during an expose. 372 // border during an expose.
378 void DrawContentShadow(cairo_t* cr); 373 void DrawContentShadow(cairo_t* cr);
379 374
380 // The background frame image needs to be offset by the size of the top of 375 // The background frame image needs to be offset by the size of the top of
381 // the window to the top of the tabs when the full skyline isn't displayed 376 // the window to the top of the tabs when the full skyline isn't displayed
382 // for some reason. 377 // for some reason.
383 int GetVerticalOffset(); 378 int GetVerticalOffset();
384 379
385 // Returns which frame image we should use based on the window's current 380 // Returns which frame image we should use based on the window's current
386 // activation state / incognito state. 381 // activation state / incognito state.
387 int GetThemeFrameResource(); 382 virtual int GetThemeFrameResource();
jennb 2012/04/27 18:36:13 Accidental change? I don't see this overridden in
jianli 2012/04/27 20:22:34 Done.
388 383
389 // Invalidate all the widgets that need to redraw when the infobar draw state 384 // Invalidate all the widgets that need to redraw when the infobar draw state
390 // has changed. 385 // has changed.
391 void InvalidateInfoBarBits(); 386 void InvalidateInfoBarBits();
392 387
393 // When the location icon moves, we have to redraw the arrow. 388 // When the location icon moves, we have to redraw the arrow.
394 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnLocationIconSizeAllocate, 389 CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnLocationIconSizeAllocate,
395 GtkAllocation*); 390 GtkAllocation*);
396 391
397 // Used to draw the infobar arrow and drop shadow. This is connected to 392 // Used to draw the infobar arrow and drop shadow. This is connected to
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 437
443 // Hides UI elements for unsupported window features. 438 // Hides UI elements for unsupported window features.
444 void HideUnsupportedWindowFeatures(); 439 void HideUnsupportedWindowFeatures();
445 440
446 // Helper functions that query |browser_| concerning support for UI features 441 // Helper functions that query |browser_| concerning support for UI features
447 // in this window. (For example, a popup window might not support a tabstrip). 442 // in this window. (For example, a popup window might not support a tabstrip).
448 bool IsTabStripSupported() const; 443 bool IsTabStripSupported() const;
449 bool IsToolbarSupported() const; 444 bool IsToolbarSupported() const;
450 bool IsBookmarkBarSupported() const; 445 bool IsBookmarkBarSupported() const;
451 446
452 // Whether we should draw the tab background instead of the theme_frame
453 // background because this window is a popup.
454 bool UsingCustomPopupFrame() const;
455
456 // Returns |true| if the window bounds match the monitor size. 447 // Returns |true| if the window bounds match the monitor size.
457 bool BoundsMatchMonitorSize(); 448 bool BoundsMatchMonitorSize();
458 449
459 // Put the bookmark bar where it belongs. 450 // Put the bookmark bar where it belongs.
460 void PlaceBookmarkBar(bool is_floating); 451 void PlaceBookmarkBar(bool is_floating);
461 452
462 // Determine whether we use should default to native decorations or the custom 453 // Determine whether we use should default to native decorations or the custom
463 // frame based on the currently-running window manager. 454 // frame based on the currently-running window manager.
464 static bool GetCustomFramePrefDefault(); 455 static bool GetCustomFramePrefDefault();
465 456
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_; 554 scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_;
564 555
565 FullscreenExitBubbleType fullscreen_exit_bubble_type_; 556 FullscreenExitBubbleType fullscreen_exit_bubble_type_;
566 557
567 content::NotificationRegistrar registrar_; 558 content::NotificationRegistrar registrar_;
568 559
569 DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk); 560 DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk);
570 }; 561 };
571 562
572 #endif // CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_ 563 #endif // CHROME_BROWSER_UI_GTK_BROWSER_WINDOW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698