| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef ASH_COMMON_SYSTEM_UPDATE_TRAY_UPDATE_H_ | 5 #ifndef ASH_COMMON_SYSTEM_UPDATE_TRAY_UPDATE_H_ |
| 6 #define ASH_COMMON_SYSTEM_UPDATE_TRAY_UPDATE_H_ | 6 #define ASH_COMMON_SYSTEM_UPDATE_TRAY_UPDATE_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/common/system/tray/tray_image_item.h" | 9 #include "ash/common/system/tray/tray_image_item.h" |
| 10 #include "ash/common/system/update/update_observer.h" | |
| 11 #include "base/macros.h" | 10 #include "base/macros.h" |
| 12 | 11 |
| 13 namespace views { | 12 namespace views { |
| 14 class View; | 13 class View; |
| 15 } | 14 } |
| 16 | 15 |
| 17 namespace ash { | 16 namespace ash { |
| 18 | 17 |
| 19 // The system update tray item. Exported for test. | 18 namespace mojom { |
| 20 class ASH_EXPORT TrayUpdate : public TrayImageItem, public UpdateObserver { | 19 enum class UpdateSeverity; |
| 20 } |
| 21 |
| 22 // The system update tray item. The tray icon stays visible once an update |
| 23 // notification is received. The icon only disappears after a reboot to apply |
| 24 // the update. Exported for test. |
| 25 class ASH_EXPORT TrayUpdate : public TrayImageItem { |
| 21 public: | 26 public: |
| 22 explicit TrayUpdate(SystemTray* system_tray); | 27 explicit TrayUpdate(SystemTray* system_tray); |
| 23 ~TrayUpdate() override; | 28 ~TrayUpdate() override; |
| 24 | 29 |
| 30 // Shows an icon in the system tray indicating that a software update is |
| 31 // available. Once shown the icon persists until reboot. |severity| and |
| 32 // |factory_reset_required| are used to set the icon, color, and tooltip. |
| 33 void ShowUpdateIcon(mojom::UpdateSeverity severity, |
| 34 bool factory_reset_required); |
| 35 |
| 25 private: | 36 private: |
| 37 class UpdateView; |
| 38 |
| 26 // Overridden from TrayImageItem. | 39 // Overridden from TrayImageItem. |
| 27 bool GetInitialVisibility() override; | 40 bool GetInitialVisibility() override; |
| 28 views::View* CreateDefaultView(LoginStatus status) override; | 41 views::View* CreateDefaultView(LoginStatus status) override; |
| 29 | 42 |
| 30 // Overridden from UpdateObserver. | 43 // If an external monitor is connected then the system tray may be created |
| 31 void OnUpdateRecommended(const UpdateInfo& info) override; | 44 // after the update data is sent from chrome, so share the update info between |
| 45 // all instances. |
| 46 static bool update_required_; |
| 47 static mojom::UpdateSeverity severity_; |
| 48 static bool factory_reset_required_; |
| 32 | 49 |
| 33 DISALLOW_COPY_AND_ASSIGN(TrayUpdate); | 50 DISALLOW_COPY_AND_ASSIGN(TrayUpdate); |
| 34 }; | 51 }; |
| 35 | 52 |
| 36 } // namespace ash | 53 } // namespace ash |
| 37 | 54 |
| 38 #endif // ASH_COMMON_SYSTEM_UPDATE_TRAY_UPDATE_H_ | 55 #endif // ASH_COMMON_SYSTEM_UPDATE_TRAY_UPDATE_H_ |
| OLD | NEW |