summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/browser_window_gtk.h
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-08 19:43:38 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-08 19:43:38 +0000
commit744b50610c1c7bb9c6f9f580c740cf8f5ca23e82 (patch)
treedc0014efec53b1135c729ceb89b593c68b692e1a /chrome/browser/gtk/browser_window_gtk.h
parentf33bc9e999c94c006b3304cc67d901cdbc37abec (diff)
downloadchromium_src-744b50610c1c7bb9c6f9f580c740cf8f5ca23e82.zip
chromium_src-744b50610c1c7bb9c6f9f580c740cf8f5ca23e82.tar.gz
chromium_src-744b50610c1c7bb9c6f9f580c740cf8f5ca23e82.tar.bz2
[GTK] update infobars to new, harder-to-spoof versions.
This doesn't support the multiple infobar case. It does however support the following: - There is a drop shadow over the render view content, over the toolbar area, and an arrow to the location icon. - animations while enabling/disabling the bookmark bar, on normal page or NTP - different infobar colors - switching between tabs with or without infobars - animated appearance/disappearance (animation is alpha-fade) Popup windows don't appear to support infobars (at least I can't get an infobar to open in a popup window), but this new code doesn't cause crashes there either. BUG=48996 TEST=manual (see above) Review URL: http://codereview.chromium.org/3621010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/browser_window_gtk.h')
-rw-r--r--chrome/browser/gtk/browser_window_gtk.h55
1 files changed, 51 insertions, 4 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h
index 2f0746f..ce6fd20 100644
--- a/chrome/browser/gtk/browser_window_gtk.h
+++ b/chrome/browser/gtk/browser_window_gtk.h
@@ -12,6 +12,7 @@
#include "app/active_window_watcher_x.h"
#include "app/gtk_signal.h"
+#include "app/slide_animation.h"
#include "app/x11_util.h"
#include "base/scoped_ptr.h"
#include "base/timer.h"
@@ -43,7 +44,8 @@ class TabStripGtk;
class BrowserWindowGtk : public BrowserWindow,
public NotificationObserver,
public TabStripModelObserver,
- public ActiveWindowWatcherX::Observer {
+ public ActiveWindowWatcherX::Observer,
+ public AnimationDelegate {
public:
explicit BrowserWindowGtk(Browser* browser);
virtual ~BrowserWindowGtk();
@@ -140,9 +142,14 @@ class BrowserWindowGtk : public BrowserWindow,
bool user_gesture);
virtual void TabStripEmpty();
- // Overriden from ActiveWindowWatcher::Observer.
+ // Overridden from ActiveWindowWatcher::Observer.
virtual void ActiveWindowChanged(GdkWindow* active_window);
+ // Overridden from AnimationDelegate.
+ virtual void AnimationEnded(const Animation* animation);
+ virtual void AnimationProgressed(const Animation* animation);
+ virtual void AnimationCanceled(const Animation* animation);
+
// Accessor for the tab strip.
TabStripGtk* tabstrip() const { return tabstrip_.get(); }
@@ -171,6 +178,17 @@ class BrowserWindowGtk : public BrowserWindow,
// else for the custom frame.
void ResetCustomFrameCursor();
+ // Toggles whether an infobar is showing. If |colors| is NULL, then no infobar
+ // is showing. When non-NULL, |colors| describes the gradient stop colors for
+ // the showing infobar.
+ // |animate| controls whether we animate to the new state set by |colors|.
+ void SetInfoBarShowing(const std::pair<SkColor, SkColor>* colors,
+ bool animate);
+
+ // Called by the RenderViewHostDelegate::View (TabContentsViewGtk in our case)
+ // to decide whether to draw a drop shadow on the render view.
+ bool ShouldDrawInfobarDropShadowOnRenderView();
+
// Returns the BrowserWindowGtk registered with |window|.
static BrowserWindowGtk* GetBrowserWindowForNativeWindow(
gfx::NativeWindow window);
@@ -219,8 +237,7 @@ class BrowserWindowGtk : public BrowserWindow,
GtkWidget* render_area_floating_container_;
// EventBox that holds render_area_floating_container_.
GtkWidget* render_area_event_box_;
- // Border between toolbar and render area. This is hidden when the find bar
- // is added because thereafter the findbar will draw the border for us.
+ // Border between toolbar and render area.
GtkWidget* toolbar_border_;
scoped_ptr<Browser> browser_;
@@ -289,6 +306,27 @@ class BrowserWindowGtk : public BrowserWindow,
// activation state / incognito state.
int GetThemeFrameResource();
+ // Invalidate all the widgets that need to redraw when the infobar draw state
+ // has changed.
+ void InvalidateInfoBarBits();
+
+ // Used to draw the infobar arrow and drop shadow. This is connected to
+ // multiple widgets' expose events because it overlaps several widgets.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnExposeDrawInfobarBits,
+ GdkEventExpose*);
+
+ // Used to draw the infobar bits for the bookmark bar. When the bookmark
+ // bar is in floating mode, it has to draw a drop shadow only; otherwise
+ // it is responsible for its portion of the arrow as well as some shadowing.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnBookmarkBarExpose,
+ GdkEventExpose*);
+
+ // Callback for "size-allocate" signal on bookmark bar; this is relevant
+ // because when the bookmark bar changes dimensions, the infobar arrow has to
+ // change its shape, and we need to queue appropriate redraws.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnBookmarkBarSizeAllocate,
+ GtkAllocation*);
+
// Callback for accelerator activation. |user_data| stores the command id
// of the matched accelerator.
static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group,
@@ -377,6 +415,9 @@ class BrowserWindowGtk : public BrowserWindow,
// bookmark bar is not supported.
scoped_ptr<BookmarkBarGtk> bookmark_bar_;
+ // Caches the hover state of the bookmark bar.
+ bool bookmark_bar_is_floating_;
+
// The status bubble manager. Always non-NULL.
scoped_ptr<StatusBubbleGtk> status_bubble_;
@@ -439,6 +480,12 @@ class BrowserWindowGtk : public BrowserWindow,
scoped_ptr<FullscreenExitBubbleGtk> fullscreen_exit_bubble_;
+ // The top and bottom colors for the infobar gradient, if there is an
+ // infobar showing.
+ std::pair<SkColor, SkColor> infobar_colors_;
+
+ SlideAnimation infobar_animation_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserWindowGtk);
};