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

Unified Diff: chrome/browser/ui/ash/system_tray_client.cc

Issue 2882933002: Add update available icon in system tray (Closed)
Patch Set: Created 3 years, 7 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
Index: chrome/browser/ui/ash/system_tray_client.cc
diff --git a/chrome/browser/ui/ash/system_tray_client.cc b/chrome/browser/ui/ash/system_tray_client.cc
index be329e66571038c8989acefceb70d21492aa2b3c..98c8aebb7ed77181f56ba6f3dcdfed1c4e8f72b3 100644
--- a/chrome/browser/ui/ash/system_tray_client.cc
+++ b/chrome/browser/ui/ash/system_tray_client.cc
@@ -10,6 +10,7 @@
#include "ash/shell.h"
#include "base/feature_list.h"
#include "base/logging.h"
+#include "base/memory/weak_ptr.h"
#include "base/metrics/user_metrics.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
@@ -61,6 +62,7 @@
using chromeos::BluetoothPairingDialog;
using chromeos::DBusThreadManager;
using chromeos::LoginState;
+using chromeos::UpdateEngineClient;
using device::BluetoothDevice;
using views::Widget;
@@ -108,6 +110,8 @@ SystemTrayClient::SystemTrayClient() : binding_(this) {
registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
content::NotificationService::AllSources());
+ registrar_.Add(this, chrome::NOTIFICATION_UPDATE_OVER_CELLULAR_AVAILABLE,
+ content::NotificationService::AllSources());
// If an upgrade is available at startup then tell ash about it.
if (UpgradeDetector::GetInstance()->notify_upgrade())
@@ -178,6 +182,16 @@ ash::LoginStatus SystemTrayClient::GetUserLoginStatus() {
return ash::LoginStatus::NOT_LOGGED_IN;
}
+void SystemTrayClient::RequestUpdateCheck() {
+ base::WeakPtrFactory<SystemTrayClient> weak_ptr_factory_(this);
+ DBusThreadManager::Get()->GetUpdateEngineClient()->RequestUpdateCheck(
+ base::Bind(&SystemTrayClient::OnRequestUpdateCheck,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void SystemTrayClient::OnRequestUpdateCheck(
+ UpdateEngineClient::UpdateCheckResult /* result */) {}
+
// static
int SystemTrayClient::GetDialogParentContainerId() {
const ash::LoginStatus login_status = GetUserLoginStatus();
@@ -269,6 +283,10 @@ void SystemTrayClient::ShowDateSettings() {
chrome::kDateTimeSubPage);
}
+void SystemTrayClient::ShowAboutChromeOS() {
+ ShowSettingsSubPageForActiveUser(chrome::kHelpSubPage);
+}
+
void SystemTrayClient::ShowSetTimeDialog() {
chromeos::SetTimeDialog::ShowDialogInContainer(GetDialogParentContainerId());
}
@@ -460,6 +478,10 @@ void SystemTrayClient::HandleUpdateAvailable() {
update_type);
}
+void SystemTrayClient::HandleUpdateOverCellularAvailable() {
+ system_tray_->ShowUpdateOverCellularAvailableIcon();
+}
+
////////////////////////////////////////////////////////////////////////////////
// chromeos::system::SystemClockObserver:
@@ -471,8 +493,10 @@ void SystemTrayClient::OnSystemClockChanged(
void SystemTrayClient::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type);
- HandleUpdateAvailable();
+ if (chrome::NOTIFICATION_UPGRADE_RECOMMENDED == type)
+ HandleUpdateAvailable();
+ else if (chrome::NOTIFICATION_UPDATE_OVER_CELLULAR_AVAILABLE == type)
+ HandleUpdateOverCellularAvailable();
}
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698