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..144532836a2d15211ca5a2b672268badf2ad5168 100644 |
--- a/chrome/browser/ui/ash/system_tray_client.cc |
+++ b/chrome/browser/ui/ash/system_tray_client.cc |
@@ -10,7 +10,11 @@ |
#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 "base/single_thread_task_runner.h" |
+#include "base/threading/thread_task_runner_handle.h" |
+#include "base/time/time.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/browser_process_platform_part.h" |
#include "chrome/browser/chrome_notification_types.h" |
@@ -61,6 +65,7 @@ |
using chromeos::BluetoothPairingDialog; |
using chromeos::DBusThreadManager; |
using chromeos::LoginState; |
+using chromeos::UpdateEngineClient; |
using device::BluetoothDevice; |
using views::Widget; |
@@ -108,6 +113,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 +185,26 @@ ash::LoginStatus SystemTrayClient::GetUserLoginStatus() { |
return ash::LoginStatus::NOT_LOGGED_IN; |
} |
+void SystemTrayClient::ScheduleRequestUpdateCheck() { |
+ base::WeakPtrFactory<SystemTrayClient> weak_ptr_factory_(this); |
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
+ FROM_HERE, |
+ base::Bind(&SystemTrayClient::RequestUpdateCheck, base::Unretained(this)), |
+ // Waits 1 second until after the about Chrome OS |
+ // page is loaded. |
stevenjb
2017/05/16 19:49:06
What are we delaying this? Please explain. (Also c
weidongg
2017/05/16 19:58:36
Clicking this icon will bring user to About Chrome
stevenjb
2017/05/16 20:42:34
Using a time delay like this is fragile at best.
weidongg
2017/05/17 00:27:23
Yes, I was worried about the fragility too. Making
|
+ base::TimeDelta::FromSeconds(1)); |
+} |
+ |
+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 +296,10 @@ void SystemTrayClient::ShowDateSettings() { |
chrome::kDateTimeSubPage); |
} |
+void SystemTrayClient::ShowAboutChromeOS() { |
+ ShowSettingsSubPageForActiveUser(chrome::kHelpSubPage); |
+} |
+ |
void SystemTrayClient::ShowSetTimeDialog() { |
chromeos::SetTimeDialog::ShowDialogInContainer(GetDialogParentContainerId()); |
} |
@@ -460,6 +491,10 @@ void SystemTrayClient::HandleUpdateAvailable() { |
update_type); |
} |
+void SystemTrayClient::HandleUpdateOverCellularAvailable() { |
+ system_tray_->ShowUpdateOverCellularAvailableIcon(); |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// chromeos::system::SystemClockObserver: |
@@ -471,8 +506,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(); |
} |
//////////////////////////////////////////////////////////////////////////////// |