diff options
-rw-r--r-- | chrome/browser/chromeos/cros/update_library.cc | 11 | ||||
-rw-r--r-- | chrome/browser/ui/toolbar/wrench_menu_model.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/views/toolbar_view.cc | 12 | ||||
-rw-r--r-- | chrome/browser/upgrade_detector.cc | 13 |
4 files changed, 14 insertions, 32 deletions
diff --git a/chrome/browser/chromeos/cros/update_library.cc b/chrome/browser/chromeos/cros/update_library.cc index ab11616..c59bc49 100644 --- a/chrome/browser/chromeos/cros/update_library.cc +++ b/chrome/browser/chromeos/cros/update_library.cc @@ -8,8 +8,6 @@ #include "base/string_util.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "content/browser/browser_thread.h" -#include "content/common/notification_service.h" -#include "content/common/notification_type.h" namespace chromeos { @@ -91,15 +89,6 @@ 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_; diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc index b8caa1a..63b6e6a 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc @@ -47,11 +47,6 @@ #include "chrome/browser/ui/browser_window.h" #endif -#if defined(OS_CHROMEOS) -#include "chrome/browser/chromeos/cros/cros_library.h" -#include "chrome/browser/chromeos/cros/update_library.h" -#endif - #if defined(OS_WIN) #include "chrome/browser/enumerate_modules_model_win.h" #endif @@ -333,12 +328,7 @@ bool WrenchMenuModel::IsCommandIdEnabled(int command_id) const { bool WrenchMenuModel::IsCommandIdVisible(int command_id) const { if (command_id == IDC_UPGRADE_DIALOG) { -#if defined(OS_CHROMEOS) - return (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->status().status - == chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT); -#else return UpgradeDetector::GetInstance()->notify_upgrade(); -#endif } else if (command_id == IDC_VIEW_INCOMPATIBILITIES) { #if defined(OS_WIN) EnumerateModulesModel* loaded_modules = diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 31e6247..93799ac 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -16,6 +16,7 @@ #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/browser_actions_container.h" #include "chrome/browser/ui/views/event_utils.h" +#include "chrome/browser/ui/views/wrench_menu.h" #include "chrome/browser/upgrade_detector.h" #include "chrome/common/pref_names.h" #include "content/browser/user_metrics.h" @@ -37,12 +38,6 @@ #include "views/window/non_client_view.h" #include "views/window/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/ui/views/wrench_menu.h" - #if defined(OS_WIN) #include "chrome/browser/enumerate_modules_model_win.h" #endif @@ -619,12 +614,7 @@ void ToolbarView::RemovePaneFocus() { // ToolbarView, private: bool ToolbarView::IsUpgradeRecommended() { -#if defined(OS_CHROMEOS) - return (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->status().status == - chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT); -#else return (UpgradeDetector::GetInstance()->notify_upgrade()); -#endif } bool ToolbarView::ShouldShowIncompatibilityWarning() { diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc index c15c8d5..a0d8f0c 100644 --- a/chrome/browser/upgrade_detector.cc +++ b/chrome/browser/upgrade_detector.cc @@ -35,6 +35,11 @@ #include "base/version.h" #endif +#if defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/cros/cros_library.h" +#include "chrome/browser/chromeos/cros/update_library.h" +#endif + namespace { // How long (in milliseconds) to wait (each cycle) before checking whether @@ -205,6 +210,13 @@ UpgradeDetector* UpgradeDetector::GetInstance() { } void UpgradeDetector::CheckForUpgrade() { +#if defined(OS_CHROMEOS) + // For ChromeOS, check update library status to detect upgrade. + if (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->status().status == + chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT) { + UpgradeDetected(); + } +#else method_factory_.RevokeAll(); Task* callback_task = method_factory_.NewRunnableMethod(&UpgradeDetector::UpgradeDetected); @@ -215,6 +227,7 @@ void UpgradeDetector::CheckForUpgrade() { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, new DetectUpgradeTask(callback_task, &is_unstable_channel_)); +#endif } void UpgradeDetector::UpgradeDetected() { |