summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/toolbar_view.h
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-26 20:11:54 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-26 20:11:54 +0000
commitb1b7394fa3880dab9f9bd0cfc40ea8c614f0b49e (patch)
treed6e9f57d10714b67c4c7fbed0e874d4e337f406e /chrome/browser/views/toolbar_view.h
parenta8e4a8fa39604cd309e1e3d62cf9c552dcfe541d (diff)
downloadchromium_src-b1b7394fa3880dab9f9bd0cfc40ea8c614f0b49e.zip
chromium_src-b1b7394fa3880dab9f9bd0cfc40ea8c614f0b49e.tar.gz
chromium_src-b1b7394fa3880dab9f9bd0cfc40ea8c614f0b49e.tar.bz2
Implement upgrade notifications.
When we detect that the installed version is newer than the version you are running we show a little throbbing orange dot over the wrench menu. If you open the wrench menu and close it again, the throbbing will stop. However, if you look at the contents of the wrench menu you'll notice that the About box menu item has been removed and in its place is a menu item "Update Chrome Now" with a bright orange icon to draw your attention to it. Clicking on the icon shows a dialog box asking whether you want to restart Chrome. If you do, the browser restarts with your session restored (even if you have Session Restore turned off). Known issues: - Currently this is Windows only. We'll have to port this to Linux and do something differnet for Mac (which doesn't have the wrench menu). - Showing an icon in front of Update Chrome causes the checkbox for the bookmark bar menu to go away. Given that we will soon redesign the menus I'm not going to spend much time trying to fix it. BUG=27941 TEST=Wait for Chrome to be upgraded in the background, an orange dot should appear over the wrench menu and if you select Update Chrome your session should be retained. Review URL: http://codereview.chromium.org/2225003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48318 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/toolbar_view.h')
-rw-r--r--chrome/browser/views/toolbar_view.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h
index 9c7b472..99e1d28 100644
--- a/chrome/browser/views/toolbar_view.h
+++ b/chrome/browser/views/toolbar_view.h
@@ -8,6 +8,7 @@
#include <vector>
#include "app/menus/simple_menu_model.h"
+#include "app/slide_animation.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/app_menu_model.h"
#include "chrome/browser/back_forward_menu_model.h"
@@ -38,6 +39,7 @@ class ToolbarView : public AccessibleToolbarView,
public views::FocusChangeListener,
public menus::SimpleMenuModel::Delegate,
public LocationBarView::Delegate,
+ public AnimationDelegate,
public NotificationObserver,
public CommandUpdater::CommandObserver,
public views::ButtonListener {
@@ -107,6 +109,9 @@ class ToolbarView : public AccessibleToolbarView,
virtual TabContents* GetTabContents();
virtual void OnInputInProgress(bool in_progress);
+ // Overridden from AnimationDelegate:
+ virtual void AnimationProgressed(const Animation* animation);
+
// Overridden from CommandUpdater::CommandObserver:
virtual void EnabledStateChangedForCommand(int id, bool enabled);
@@ -173,6 +178,17 @@ class ToolbarView : public AccessibleToolbarView,
// was called.
void RestoreLastFocusedView();
+ // Starts the recurring timer that periodically asks the upgrade notifier
+ // to pulsate.
+ void ShowUpgradeReminder();
+
+ // Show the reminder, tempting the user to upgrade by pulsating.
+ void PulsateUpgradeNotifier();
+
+ // Gets a canvas with the icon for the app menu. It will possibly contain
+ // an overlaid badge if an update is recommended.
+ SkBitmap GetAppMenuIcon();
+
scoped_ptr<BackForwardMenuModel> back_menu_model_;
scoped_ptr<BackForwardMenuModel> forward_menu_model_;
@@ -222,6 +238,13 @@ class ToolbarView : public AccessibleToolbarView,
// Vector of listeners to receive callbacks when the menu opens.
std::vector<views::MenuListener*> menu_listeners_;
+ // The animation that makes the update reminder pulse.
+ scoped_ptr<SlideAnimation> update_reminder_animation_;
+
+ // We periodically restart the animation after it has been showed
+ // once, to create a pulsating effect.
+ base::RepeatingTimer<ToolbarView> upgrade_reminder_pulse_timer_;
+
// Are we in the menu bar emulation mode, where the app and page menu
// are temporarily focusable?
bool menu_bar_emulation_mode_;
@@ -229,7 +252,9 @@ class ToolbarView : public AccessibleToolbarView,
// Used to post tasks to switch to the next/previous menu.
ScopedRunnableMethodFactory<ToolbarView> method_factory_;
- // If non-null the destuctor sets this to true. This is set to a non-null
+ NotificationRegistrar registrar_;
+
+ // If non-null the destructor sets this to true. This is set to a non-null
// while the menu is showing and used to detect if the menu was deleted while
// running.
bool* destroyed_flag_;