| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/ash/system_tray_client.h" | 5 #include "chrome/browser/ui/ash/system_tray_client.h" |
| 6 | 6 |
| 7 #include "ash/login_status.h" | 7 #include "ash/login_status.h" |
| 8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
| 9 #include "ash/public/interfaces/constants.mojom.h" | 9 #include "ash/public/interfaces/constants.mojom.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 const chrome::RebootPolicy reboot_policy = | 373 const chrome::RebootPolicy reboot_policy = |
| 374 flash_update_available_ ? chrome::RebootPolicy::kForceReboot | 374 flash_update_available_ ? chrome::RebootPolicy::kForceReboot |
| 375 : chrome::RebootPolicy::kOptionalReboot; | 375 : chrome::RebootPolicy::kOptionalReboot; |
| 376 | 376 |
| 377 chrome::NotifyAndTerminate(true /* fast_path */, reboot_policy); | 377 chrome::NotifyAndTerminate(true /* fast_path */, reboot_policy); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void SystemTrayClient::HandleUpdateAvailable() { | 380 void SystemTrayClient::HandleUpdateAvailable() { |
| 381 // Show an update icon for Chrome updates and Flash component updates. | 381 // Show an update icon for Chrome updates and Flash component updates. |
| 382 UpgradeDetector* detector = UpgradeDetector::GetInstance(); | 382 UpgradeDetector* detector = UpgradeDetector::GetInstance(); |
| 383 DCHECK(detector->notify_upgrade() || flash_update_available_); | 383 bool update_available = detector->notify_upgrade() || flash_update_available_; |
| 384 DCHECK(update_available); |
| 385 if (!update_available) |
| 386 return; |
| 384 | 387 |
| 385 // Get the Chrome update severity. | 388 // Get the Chrome update severity. |
| 386 ash::mojom::UpdateSeverity severity = GetUpdateSeverity(detector); | 389 ash::mojom::UpdateSeverity severity = GetUpdateSeverity(detector); |
| 387 | 390 |
| 388 // Flash updates are low severity unless the Chrome severity is higher. | 391 // Flash updates are low severity unless the Chrome severity is higher. |
| 389 if (flash_update_available_) | 392 if (flash_update_available_) |
| 390 severity = std::max(severity, ash::mojom::UpdateSeverity::LOW); | 393 severity = std::max(severity, ash::mojom::UpdateSeverity::LOW); |
| 391 | 394 |
| 392 system_tray_->ShowUpdateIcon(severity, detector->is_factory_reset_required()); | 395 // Show a string specific to updating flash player if there is no system |
| 396 // update. |
| 397 ash::mojom::UpdateType update_type = detector->notify_upgrade() |
| 398 ? ash::mojom::UpdateType::SYSTEM |
| 399 : ash::mojom::UpdateType::FLASH; |
| 400 |
| 401 system_tray_->ShowUpdateIcon(severity, detector->is_factory_reset_required(), |
| 402 update_type); |
| 393 } | 403 } |
| 394 | 404 |
| 395 //////////////////////////////////////////////////////////////////////////////// | 405 //////////////////////////////////////////////////////////////////////////////// |
| 396 // chromeos::system::SystemClockObserver: | 406 // chromeos::system::SystemClockObserver: |
| 397 | 407 |
| 398 void SystemTrayClient::OnSystemClockChanged( | 408 void SystemTrayClient::OnSystemClockChanged( |
| 399 chromeos::system::SystemClock* clock) { | 409 chromeos::system::SystemClock* clock) { |
| 400 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); | 410 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); |
| 401 } | 411 } |
| 402 | 412 |
| 403 void SystemTrayClient::Observe(int type, | 413 void SystemTrayClient::Observe(int type, |
| 404 const content::NotificationSource& source, | 414 const content::NotificationSource& source, |
| 405 const content::NotificationDetails& details) { | 415 const content::NotificationDetails& details) { |
| 406 DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type); | 416 DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type); |
| 407 HandleUpdateAvailable(); | 417 HandleUpdateAvailable(); |
| 408 } | 418 } |
| OLD | NEW |