| 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.h" |
| 8 #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" | 9 #include "ash/common/system/update/tray_update.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
| 12 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
| 13 #include "ash/shell.h" |
| 13 | 14 |
| 14 namespace ash { | 15 namespace ash { |
| 15 | 16 |
| 16 SystemTrayController::SystemTrayController() | 17 SystemTrayController::SystemTrayController() |
| 17 : hour_clock_type_(base::GetHourClockType()) {} | 18 : hour_clock_type_(base::GetHourClockType()) {} |
| 18 | 19 |
| 19 SystemTrayController::~SystemTrayController() {} | 20 SystemTrayController::~SystemTrayController() {} |
| 20 | 21 |
| 21 void SystemTrayController::ShowSettings() { | 22 void SystemTrayController::ShowSettings() { |
| 22 if (system_tray_client_) | 23 if (system_tray_client_) |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 tray->GetWidget()->SetOpacity(visible ? 1.f : 0.f); | 173 tray->GetWidget()->SetOpacity(visible ? 1.f : 0.f); |
| 173 if (visible) { | 174 if (visible) { |
| 174 tray->GetWidget()->Show(); | 175 tray->GetWidget()->Show(); |
| 175 } else { | 176 } else { |
| 176 tray->GetWidget()->Hide(); | 177 tray->GetWidget()->Hide(); |
| 177 } | 178 } |
| 178 } | 179 } |
| 179 | 180 |
| 180 void SystemTrayController::SetUse24HourClock(bool use_24_hour) { | 181 void SystemTrayController::SetUse24HourClock(bool use_24_hour) { |
| 181 hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock; | 182 hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock; |
| 182 WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged(); | 183 Shell::Get()->system_tray_notifier()->NotifyDateFormatChanged(); |
| 183 } | 184 } |
| 184 | 185 |
| 185 void SystemTrayController::ShowUpdateIcon(mojom::UpdateSeverity severity, | 186 void SystemTrayController::ShowUpdateIcon(mojom::UpdateSeverity severity, |
| 186 bool factory_reset_required) { | 187 bool factory_reset_required) { |
| 187 // Show the icon on all displays. | 188 // Show the icon on all displays. |
| 188 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { | 189 for (WmWindow* root : WmShell::Get()->GetAllRootWindows()) { |
| 189 ash::SystemTray* tray = root->GetRootWindowController()->GetSystemTray(); | 190 ash::SystemTray* tray = root->GetRootWindowController()->GetSystemTray(); |
| 190 // External monitors might not have a tray yet. | 191 // External monitors might not have a tray yet. |
| 191 if (!tray) | 192 if (!tray) |
| 192 continue; | 193 continue; |
| 193 tray->tray_update()->ShowUpdateIcon(severity, factory_reset_required); | 194 tray->tray_update()->ShowUpdateIcon(severity, factory_reset_required); |
| 194 } | 195 } |
| 195 } | 196 } |
| 196 | 197 |
| 197 } // namespace ash | 198 } // namespace ash |
| OLD | NEW |