Chromium Code Reviews| 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 1a4022d1c91ef6122e3bd7383559a9a89e35d126..73f5c2e7d161bed10418c448bf1ffc70ab718330 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; |
| + |
| void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime, |
| const input_method::InputMethodUtil& util, |
| ash::IMEInfo* info) { |
| @@ -172,6 +175,14 @@ SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() |
| base::Unretained(this))); |
| user_manager::UserManager::Get()->AddSessionStateObserver(this); |
| + |
| + DCHECK(!g_instance); |
| + g_instance = this; |
| +} |
| + |
| +// static |
| +SystemTrayDelegateChromeOS* SystemTrayDelegateChromeOS::instance() { |
| + return g_instance; |
| } |
| void SystemTrayDelegateChromeOS::Initialize() { |
| @@ -221,6 +232,9 @@ void SystemTrayDelegateChromeOS::InitializeOnAdapterReady( |
| } |
| SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() { |
| + DCHECK_EQ(this, g_instance); |
| + g_instance = nullptr; |
| + |
| // Unregister PrefChangeRegistrars. |
| local_state_registrar_.reset(); |
| user_pref_registrar_.reset(); |
| @@ -314,6 +328,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; |
|
James Cook
2016/12/09 00:11:40
Hey, I just thought of something. If the only upda
|
| } |
| bool SystemTrayDelegateChromeOS::ShouldShowSettings() const { |
| @@ -606,6 +624,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(); |
| } |