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

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

Issue 2493973003: Display "Restart to update" dialog to Chrome OS users. (Closed)
Patch Set: Display "Restart to update" dialog to Chrome OS users. Created 4 years 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_delegate_chromeos.cc
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
index d07ce2fa923a24906645d66ff2193cbaebc095d7..6914f10d52f59c8ad6110ab67440cdb69e2c5bcc 100644
--- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -109,6 +109,9 @@ const int kSessionLengthLimitMinMs = 30 * 1000; // 30 seconds.
// The maximum session length limit that can be set.
const int kSessionLengthLimitMaxMs = 24 * 60 * 60 * 1000; // 24 hours.
+// A pointer so that callers can access the single class instance.
+SystemTrayDelegateChromeOS* g_instance = nullptr;
Nico 2016/12/02 01:20:07 If you hadn't seen it, there's also base/memory/si
Greg K 2016/12/03 00:05:42 Acknowledged.
+
void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime,
const input_method::InputMethodUtil& util,
ash::IMEInfo* info) {
@@ -173,6 +176,14 @@ SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS()
base::Unretained(this)));
user_manager::UserManager::Get()->AddSessionStateObserver(this);
+
+ DCHECK(!g_instance);
+ g_instance = this;
+}
+
+// static
+SystemTrayDelegateChromeOS* SystemTrayDelegateChromeOS::Get() {
+ return g_instance;
}
void SystemTrayDelegateChromeOS::Initialize() {
@@ -222,6 +233,9 @@ void SystemTrayDelegateChromeOS::InitializeOnAdapterReady(
}
SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() {
+ DCHECK_EQ(this, g_instance);
+ g_instance = nullptr;
Nico 2016/12/02 01:20:07 oh, i guess in this case Singleton isn't an option
Greg K 2016/12/03 00:05:42 Acknowledged.
+
// Unregister PrefChangeRegistrars.
local_state_registrar_.reset();
user_pref_registrar_.reset();
@@ -315,6 +329,10 @@ bool SystemTrayDelegateChromeOS::IsUserChild() const {
void SystemTrayDelegateChromeOS::GetSystemUpdateInfo(
ash::UpdateInfo* info) const {
GetUpdateInfo(UpgradeDetector::GetInstance(), info);
+ // If a flash component update is available, force the tray to show the user
+ // the Restart to Update dialog.
+ if (flash_update_available_)
+ info->update_required = true;
}
bool SystemTrayDelegateChromeOS::ShouldShowSettings() const {
@@ -611,6 +629,18 @@ void SystemTrayDelegateChromeOS::UserChangedChildStatus(
ash::WmShell::Get()->UpdateAfterLoginStatusChange(GetUserLoginStatus());
}
+void SystemTrayDelegateChromeOS::SetFlashUpdateAvailable() {
+ flash_update_available_ = true;
+
+ ash::UpdateInfo info;
+ GetSystemUpdateInfo(&info);
+ GetSystemTrayNotifier()->NotifyUpdateRecommended(info);
+}
+
+bool SystemTrayDelegateChromeOS::GetFlashUpdateAvailable() {
+ return flash_update_available_;
+}
+
ash::SystemTrayNotifier* SystemTrayDelegateChromeOS::GetSystemTrayNotifier() {
return ash::WmShell::Get()->system_tray_notifier();
}

Powered by Google App Engine
This is Rietveld 408576698