summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 06:20:13 +0000
committerzork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-01 06:20:13 +0000
commit3ec5d92cbba6b7b13ead81ebfd9e3c202fae001d (patch)
treebaa37f7b272c0a9ade2fcce60f896e63db27b5ba /chrome/browser
parent174104c99b0390d49ae112261a84dbb9455fcae6 (diff)
downloadchromium_src-3ec5d92cbba6b7b13ead81ebfd9e3c202fae001d.zip
chromium_src-3ec5d92cbba6b7b13ead81ebfd9e3c202fae001d.tar.gz
chromium_src-3ec5d92cbba6b7b13ead81ebfd9e3c202fae001d.tar.bz2
Send a notification when upgrades have been downloaded, and hook
the indicator up to the OS updater on Chrome OS. BUG=chromium-os:6526 TEST=Connect to a dev server with a newer version, and check that the display appears. Review URL: http://codereview.chromium.org/3607001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61152 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/cros/update_library.cc12
-rw-r--r--chrome/browser/views/toolbar_view.cc19
-rw-r--r--chrome/browser/views/toolbar_view.h3
3 files changed, 30 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/cros/update_library.cc b/chrome/browser/chromeos/cros/update_library.cc
index 26a11ef..79b1bba 100644
--- a/chrome/browser/chromeos/cros/update_library.cc
+++ b/chrome/browser/chromeos/cros/update_library.cc
@@ -8,6 +8,8 @@
#include "base/string_util.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/common/notification_type.h"
namespace chromeos {
@@ -74,6 +76,15 @@ class UpdateLibraryImpl : public UpdateLibrary {
status_ = status;
FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(this));
+
+ // If the update is ready to install, send a notification so that Chrome
+ // can update the UI.
+ if (status_.status == UPDATE_STATUS_UPDATED_NEED_REBOOT) {
+ NotificationService::current()->Notify(
+ NotificationType::UPGRADE_RECOMMENDED,
+ Source<UpdateLibrary>(this),
+ NotificationService::NoDetails());
+ }
}
ObserverList<Observer> observers_;
@@ -119,4 +130,3 @@ UpdateLibrary* UpdateLibrary::GetImpl(bool stub) {
// Allows InvokeLater without adding refcounting. This class is a Singleton and
// won't be deleted until it's last InvokeLater is run.
DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::UpdateLibraryImpl);
-
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index d1ad65b..277a7ef 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -9,6 +9,10 @@
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_window.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/update_library.h"
+#endif
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/themes/browser_theme_provider.h"
@@ -90,7 +94,7 @@ ToolbarView::ToolbarView(Browser* browser)
IDR_LOCATIONBG_POPUPMODE_EDGE);
}
- if (!Singleton<UpgradeDetector>::get()->notify_upgrade()) {
+ if (!IsUpgradeRecommended()) {
registrar_.Add(this, NotificationType::UPGRADE_RECOMMENDED,
NotificationService::AllSources());
}
@@ -162,7 +166,7 @@ void ToolbarView::Init(Profile* profile) {
app_menu_->SetID(VIEW_ID_APP_MENU);
// Catch the case where the window is created after we detect a new version.
- if (Singleton<UpgradeDetector>::get()->notify_upgrade())
+ if (IsUpgradeRecommended())
ShowUpgradeReminder();
LoadImages();
@@ -513,6 +517,15 @@ void ToolbarView::RemoveToolbarFocus() {
////////////////////////////////////////////////////////////////////////////////
// ToolbarView, private:
+bool ToolbarView::IsUpgradeRecommended() {
+#if defined(OS_CHROMEOS)
+ return (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->status().status ==
+ chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT);
+#else
+ return (Singleton<UpgradeDetector>::get()->notify_upgrade());
+#endif
+}
+
int ToolbarView::PopupTopSpacing() const {
return GetWindow()->GetNonClientView()->UseNativeFrame() ?
0 : kPopupTopSpacingNonGlass;
@@ -590,7 +603,7 @@ SkBitmap ToolbarView::GetAppMenuIcon(views::CustomButton::ButtonState state) {
}
SkBitmap icon = *tp->GetBitmapNamed(id);
- if (!Singleton<UpgradeDetector>::get()->notify_upgrade())
+ if (!IsUpgradeRecommended())
return icon;
// Draw the chrome app menu icon onto the canvas.
diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h
index d95111b..4031b4a 100644
--- a/chrome/browser/views/toolbar_view.h
+++ b/chrome/browser/views/toolbar_view.h
@@ -129,6 +129,9 @@ class ToolbarView : public AccessibleToolbarView,
virtual void RemoveToolbarFocus();
private:
+ // Returns true if we should show the upgrade recommended dot.
+ bool IsUpgradeRecommended();
+
// Returns the number of pixels above the location bar in non-normal display.
int PopupTopSpacing() const;