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 DCHECK(detector->notify_upgrade() || flash_update_available_); |
ilja
2017/04/19 07:50:33
I feel the logic here (and new code below) while c
Greg K
2017/04/19 21:42:10
Good point, but I had written the code below to ma
| |
384 | 384 |
385 // Get the Chrome update severity. | 385 // Get the Chrome update severity. |
386 ash::mojom::UpdateSeverity severity = GetUpdateSeverity(detector); | 386 ash::mojom::UpdateSeverity severity = GetUpdateSeverity(detector); |
387 | 387 |
388 // Flash updates are low severity unless the Chrome severity is higher. | 388 // Flash updates are low severity unless the Chrome severity is higher. |
389 if (flash_update_available_) | 389 if (flash_update_available_) |
390 severity = std::max(severity, ash::mojom::UpdateSeverity::LOW); | 390 severity = std::max(severity, ash::mojom::UpdateSeverity::LOW); |
391 | 391 |
392 system_tray_->ShowUpdateIcon(severity, detector->is_factory_reset_required()); | 392 // Show a string specific to updating flash player if there is no system |
393 // update. | |
394 ash::mojom::UpdateType update_type = detector->notify_upgrade() | |
395 ? ash::mojom::UpdateType::SYSTEM | |
396 : ash::mojom::UpdateType::FLASH; | |
397 | |
398 system_tray_->ShowUpdateIcon(severity, detector->is_factory_reset_required(), | |
399 update_type); | |
393 } | 400 } |
394 | 401 |
395 //////////////////////////////////////////////////////////////////////////////// | 402 //////////////////////////////////////////////////////////////////////////////// |
396 // chromeos::system::SystemClockObserver: | 403 // chromeos::system::SystemClockObserver: |
397 | 404 |
398 void SystemTrayClient::OnSystemClockChanged( | 405 void SystemTrayClient::OnSystemClockChanged( |
399 chromeos::system::SystemClock* clock) { | 406 chromeos::system::SystemClock* clock) { |
400 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); | 407 system_tray_->SetUse24HourClock(clock->ShouldUse24HourClock()); |
401 } | 408 } |
402 | 409 |
403 void SystemTrayClient::Observe(int type, | 410 void SystemTrayClient::Observe(int type, |
404 const content::NotificationSource& source, | 411 const content::NotificationSource& source, |
405 const content::NotificationDetails& details) { | 412 const content::NotificationDetails& details) { |
406 DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type); | 413 DCHECK_EQ(chrome::NOTIFICATION_UPGRADE_RECOMMENDED, type); |
407 HandleUpdateAvailable(); | 414 HandleUpdateAvailable(); |
408 } | 415 } |
OLD | NEW |