| 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 "ash/common/system/tray/system_tray_controller.h" | 5 #include "ash/common/system/tray/system_tray_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/system/tray/system_tray.h" |
| 7 #include "ash/common/system/tray/system_tray_notifier.h" | 8 #include "ash/common/system/tray/system_tray_notifier.h" |
| 9 #include "ash/common/system/update/tray_update.h" |
| 10 #include "ash/common/wm_root_window_controller.h" |
| 8 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 12 #include "ash/common/wm_window.h" |
| 9 | 13 |
| 10 namespace ash { | 14 namespace ash { |
| 11 | 15 |
| 12 SystemTrayController::SystemTrayController() | 16 SystemTrayController::SystemTrayController() |
| 13 : hour_clock_type_(base::GetHourClockType()) {} | 17 : hour_clock_type_(base::GetHourClockType()) {} |
| 14 | 18 |
| 15 SystemTrayController::~SystemTrayController() {} | 19 SystemTrayController::~SystemTrayController() {} |
| 16 | 20 |
| 17 void SystemTrayController::ShowSettings() { | 21 void SystemTrayController::ShowSettings() { |
| 18 if (system_tray_client_) | 22 if (system_tray_client_) |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 125 |
| 122 void SystemTrayController::SetClient(mojom::SystemTrayClientPtr client) { | 126 void SystemTrayController::SetClient(mojom::SystemTrayClientPtr client) { |
| 123 system_tray_client_ = std::move(client); | 127 system_tray_client_ = std::move(client); |
| 124 } | 128 } |
| 125 | 129 |
| 126 void SystemTrayController::SetUse24HourClock(bool use_24_hour) { | 130 void SystemTrayController::SetUse24HourClock(bool use_24_hour) { |
| 127 hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock; | 131 hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock; |
| 128 WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged(); | 132 WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged(); |
| 129 } | 133 } |
| 130 | 134 |
| 135 void SystemTrayController::ShowUpdateIcon(mojom::UpdateSeverity severity, |
| 136 bool factory_reset_required) { |
| 137 // Show the icon on all displays. |
| 138 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { |
| 139 ash::SystemTray* tray = root->GetRootWindowController()->GetSystemTray(); |
| 140 // External monitors might not have a tray yet. |
| 141 if (!tray) |
| 142 continue; |
| 143 tray->tray_update()->ShowUpdateIcon(severity, factory_reset_required); |
| 144 } |
| 145 } |
| 146 |
| 131 } // namespace ash | 147 } // namespace ash |
| OLD | NEW |