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_SYSTEM_UPDATE_TRAY_UPDATE_H_ | 5 #ifndef ASH_SYSTEM_UPDATE_TRAY_UPDATE_H_ |
6 #define ASH_SYSTEM_UPDATE_TRAY_UPDATE_H_ | 6 #define ASH_SYSTEM_UPDATE_TRAY_UPDATE_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/system/tray/tray_image_item.h" | 9 #include "ash/system/tray/tray_image_item.h" |
| 10 #include "base/gtest_prod_util.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" |
11 | 13 |
12 namespace views { | 14 namespace views { |
| 15 class Label; |
13 class View; | 16 class View; |
14 } | 17 } |
15 | 18 |
16 namespace ash { | 19 namespace ash { |
17 | 20 |
18 namespace mojom { | 21 namespace mojom { |
19 enum class UpdateSeverity; | 22 enum class UpdateSeverity; |
| 23 enum class UpdateType; |
20 } | 24 } |
21 | 25 |
22 // The system update tray item. The tray icon stays visible once an update | 26 // 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 | 27 // notification is received. The icon only disappears after a reboot to apply |
24 // the update. Exported for test. | 28 // the update. Exported for test. |
25 class ASH_EXPORT TrayUpdate : public TrayImageItem { | 29 class ASH_EXPORT TrayUpdate : public TrayImageItem { |
26 public: | 30 public: |
27 explicit TrayUpdate(SystemTray* system_tray); | 31 explicit TrayUpdate(SystemTray* system_tray); |
28 ~TrayUpdate() override; | 32 ~TrayUpdate() override; |
29 | 33 |
30 // Shows an icon in the system tray indicating that a software update is | 34 // Shows an icon in the system tray indicating that a software update is |
31 // available. Once shown the icon persists until reboot. |severity| and | 35 // available. Once shown the icon persists until reboot. |severity| and |
32 // |factory_reset_required| are used to set the icon, color, and tooltip. | 36 // |factory_reset_required| are used to set the icon, color, and tooltip. |
33 void ShowUpdateIcon(mojom::UpdateSeverity severity, | 37 void ShowUpdateIcon(mojom::UpdateSeverity severity, |
34 bool factory_reset_required); | 38 bool factory_reset_required, |
| 39 mojom::UpdateType update_type); |
35 | 40 |
36 private: | 41 private: |
| 42 FRIEND_TEST_ALL_PREFIXES(TrayUpdateTest, VisibilityAfterUpdate); |
| 43 FRIEND_TEST_ALL_PREFIXES(TrayUpdateTest, VisibilityAfterFlashUpdate); |
| 44 |
37 class UpdateView; | 45 class UpdateView; |
38 | 46 |
39 // Overridden from TrayImageItem. | 47 // Overridden from TrayImageItem. |
40 bool GetInitialVisibility() override; | 48 bool GetInitialVisibility() override; |
41 views::View* CreateDefaultView(LoginStatus status) override; | 49 views::View* CreateDefaultView(LoginStatus status) override; |
| 50 void DestroyDefaultView() override; |
| 51 |
| 52 // Expose label information for testing. |
| 53 views::Label* GetLabelForTesting(); |
| 54 UpdateView* update_view_; |
42 | 55 |
43 // If an external monitor is connected then the system tray may be created | 56 // If an external monitor is connected then the system tray may be created |
44 // after the update data is sent from chrome, so share the update info between | 57 // after the update data is sent from chrome, so share the update info between |
45 // all instances. | 58 // all instances. |
46 static bool update_required_; | 59 static bool update_required_; |
47 static mojom::UpdateSeverity severity_; | 60 static mojom::UpdateSeverity severity_; |
48 static bool factory_reset_required_; | 61 static bool factory_reset_required_; |
| 62 static mojom::UpdateType update_type_; |
49 | 63 |
50 DISALLOW_COPY_AND_ASSIGN(TrayUpdate); | 64 DISALLOW_COPY_AND_ASSIGN(TrayUpdate); |
51 }; | 65 }; |
52 | 66 |
53 } // namespace ash | 67 } // namespace ash |
54 | 68 |
55 #endif // ASH_SYSTEM_UPDATE_TRAY_UPDATE_H_ | 69 #endif // ASH_SYSTEM_UPDATE_TRAY_UPDATE_H_ |
OLD | NEW |