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

Unified Diff: chrome/browser/gtk/browser_toolbar_gtk.h

Issue 2985006: GTK: reduce cpu usage of upgrade notification animation. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: merge to ToT Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/gtk/browser_toolbar_gtk.cc » ('j') | chrome/browser/gtk/browser_window_gtk.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/browser_toolbar_gtk.h
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.h b/chrome/browser/gtk/browser_toolbar_gtk.h
index a0619b2b8a8d84162d3443bbbc265af7bb8a45dc..20860de968389356258a87e6dbacd1421019ee61 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.h
+++ b/chrome/browser/gtk/browser_toolbar_gtk.h
@@ -8,6 +8,7 @@
#include <gtk/gtk.h>
#include <string>
+#include "app/active_window_watcher_x.h"
#include "app/gtk_signal.h"
#include "app/menus/simple_menu_model.h"
#include "app/throb_animation.h"
@@ -44,7 +45,8 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
public MenuGtk::Delegate,
public NotificationObserver,
public MenuBarHelper::Delegate,
- public AnimationDelegate {
+ public AnimationDelegate,
+ public ActiveWindowWatcherX::Observer {
public:
explicit BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window);
virtual ~BrowserToolbarGtk();
@@ -126,6 +128,9 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
virtual void AnimationProgressed(const Animation* animation);
virtual void AnimationCanceled(const Animation* animation);
+ // ActiveWindowWatcher::Observer implementation ------------------------------
+ virtual void ActiveWindowChanged(GdkWindow* active_window);
+
private:
// Builds a toolbar button with all the properties set.
// |spacing| is the width of padding (in pixels) on the left and right of the
@@ -156,6 +161,10 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
// was taken (the roundedness was already correct), true otherwise.
bool UpdateRoundedness();
+ // Calculates whether the upgrade notification dot should be faded at all
+ // (as opposed to solid).
+ bool UpgradeAnimationIsFaded();
+
// Gtk callback for the "expose-event" signal.
// The alignment contains the toolbar.
CHROMEGTK_CALLBACK_1(BrowserToolbarGtk, gboolean, OnAlignmentExpose,
@@ -185,8 +194,9 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
// Updates preference-dependent state.
void NotifyPrefChanged(const std::wstring* pref);
- // Start the upgrade notification animation.
- void ShowUpgradeReminder();
+ // Start the upgrade notification animation if we have detected an upgrade
+ // and the current toolbar is focused.
+ void MaybeShowUpgradeReminder();
static void SetSyncMenuLabel(GtkWidget* widget, gpointer userdata);
@@ -268,6 +278,9 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
ThrobAnimation upgrade_reminder_animation_;
+ // We have already shown and dismissed the upgrade reminder animation.
+ bool upgrade_reminder_canceled_;
+
// When collapsed, the toolbar is just a tiny strip, no controls are visible.
bool collapsed_;
« no previous file with comments | « no previous file | chrome/browser/gtk/browser_toolbar_gtk.cc » ('j') | chrome/browser/gtk/browser_window_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698