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

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, 1 month 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 ad182666a5e1df52547a55e01e0f015bb6565fb7..9f28ee544578e0fe586b39eca308bbae9fb19e4b 100644
--- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -113,6 +113,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;
+
void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime,
const input_method::InputMethodUtil& util,
ash::IMEInfo* info) {
@@ -178,6 +181,8 @@ SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS()
base::Unretained(this)));
user_manager::UserManager::Get()->AddSessionStateObserver(this);
+
+ g_instance = this;
James Cook 2016/11/17 00:43:43 DCHECK(!g_instance) above just to make sure no one
Greg K 2016/11/30 19:30:29 Done.
}
void SystemTrayDelegateChromeOS::Initialize() {
@@ -320,6 +325,8 @@ bool SystemTrayDelegateChromeOS::IsUserChild() const {
void SystemTrayDelegateChromeOS::GetSystemUpdateInfo(
ash::UpdateInfo* info) const {
GetUpdateInfo(UpgradeDetector::GetInstance(), info);
+ if (!info->factory_reset_required && flash_update_available_)
James Cook 2016/11/17 00:43:43 Any particular reason not to set update_required i
Greg K 2016/11/30 19:30:30 Done.
+ info->update_required = true;
}
bool SystemTrayDelegateChromeOS::ShouldShowSettings() const {
@@ -1015,4 +1022,20 @@ ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
return new SystemTrayDelegateChromeOS();
}
+// static
+SystemTrayDelegateChromeOS* SystemTrayDelegateChromeOS::Get() {
+ return g_instance;
+}
+
+void SystemTrayDelegateChromeOS::SetFlashUpdateAvailable() {
+ flash_update_available_ = true;
+
+ ash::UpdateInfo info;
James Cook 2016/11/17 00:43:43 Why not call GetSystemUpdateInfo() and use that re
Greg K 2016/11/30 19:30:29 Done.
+ info.severity = ash::UpdateInfo::UPDATE_ELEVATED;
+ info.update_required = true;
+ info.factory_reset_required = false;
+
+ GetSystemTrayNotifier()->NotifyUpdateRecommended(info);
+}
James Cook 2016/11/17 00:43:43 Can you add a test for this? It's unlikely that fl
Greg K 2016/11/30 19:30:30 What do you mean by "has a flake problem"? I imagi
James Cook 2016/11/30 23:01:40 A unit test would be nice, but if you look at syst
+
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698