Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: ash/system/update/tray_update.h

Issue 2933923002: Remove update icon after user confirms download (Closed)
Patch Set: Apply fix to patch set 2 Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/system/tray/system_tray_notifier.cc ('k') | ash/system/update/tray_update.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/system/update/update_observer.h"
10 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
13 14
14 namespace views { 15 namespace views {
15 class Label; 16 class Label;
16 class View; 17 class View;
17 } 18 }
18 19
19 namespace ash { 20 namespace ash {
20 21
21 namespace mojom { 22 namespace mojom {
22 enum class UpdateSeverity; 23 enum class UpdateSeverity;
23 enum class UpdateType; 24 enum class UpdateType;
24 } 25 }
25 26
26 // The system update tray item. The tray icon stays visible once an update 27 // The system update tray item. The tray icon stays visible once an update
27 // notification is received. The icon only disappears after a reboot to apply 28 // notification is received. The icon only disappears after a reboot to apply
28 // the update. Exported for test. 29 // the update. Exported for test.
29 class ASH_EXPORT TrayUpdate : public TrayImageItem { 30 class ASH_EXPORT TrayUpdate : public TrayImageItem, public UpdateObserver {
30 public: 31 public:
31 explicit TrayUpdate(SystemTray* system_tray); 32 explicit TrayUpdate(SystemTray* system_tray);
32 ~TrayUpdate() override; 33 ~TrayUpdate() override;
33 34
34 // Shows an icon in the system tray indicating that a software update is 35 // Shows an icon in the system tray indicating that a software update is
35 // available. Once shown the icon persists until reboot. |severity| and 36 // available. Once shown the icon persists until reboot. |severity| and
36 // |factory_reset_required| are used to set the icon, color, and tooltip. 37 // |factory_reset_required| are used to set the icon, color, and tooltip.
37 void ShowUpdateIcon(mojom::UpdateSeverity severity, 38 void ShowUpdateIcon(mojom::UpdateSeverity severity,
38 bool factory_reset_required, 39 bool factory_reset_required,
39 mojom::UpdateType update_type); 40 mojom::UpdateType update_type);
40 41
41 // Shows an icon in the system tray indicating that a software update is 42 // Shows an icon in the system tray indicating that a software update is
42 // available but user's agreement is required as current connection is 43 // available but user's agreement is required as current connection is
43 // cellular. Once shown the icon persists until reboot. 44 // cellular. Once shown the icon persists until reboot.
44 void ShowUpdateOverCellularAvailableIcon(); 45 void ShowUpdateOverCellularAvailableIcon();
45 46
46 private: 47 private:
47 FRIEND_TEST_ALL_PREFIXES(TrayUpdateTest, VisibilityAfterUpdate); 48 FRIEND_TEST_ALL_PREFIXES(TrayUpdateTest, VisibilityAfterUpdate);
48 FRIEND_TEST_ALL_PREFIXES(TrayUpdateTest, VisibilityAfterFlashUpdate); 49 FRIEND_TEST_ALL_PREFIXES(TrayUpdateTest, VisibilityAfterFlashUpdate);
49 50
50 class UpdateView; 51 class UpdateView;
51 52
52 // Overridden from TrayImageItem. 53 // Overridden from TrayImageItem.
53 bool GetInitialVisibility() override; 54 bool GetInitialVisibility() override;
54 views::View* CreateDefaultView(LoginStatus status) override; 55 views::View* CreateDefaultView(LoginStatus status) override;
55 void OnDefaultViewDestroyed() override; 56 void OnDefaultViewDestroyed() override;
56 57
58 // Overridden from UpdateObserver.
59 void OnUpdateOverCellularTargetSet(bool success) override;
60
57 // Expose label information for testing. 61 // Expose label information for testing.
58 views::Label* GetLabelForTesting(); 62 views::Label* GetLabelForTesting();
59 UpdateView* update_view_; 63 UpdateView* update_view_;
60 64
61 // If an external monitor is connected then the system tray may be created 65 // If an external monitor is connected then the system tray may be created
62 // after the update data is sent from chrome, so share the update info between 66 // after the update data is sent from chrome, so share the update info between
63 // all instances. 67 // all instances.
64 static bool update_required_; 68 static bool update_required_;
65 static mojom::UpdateSeverity severity_; 69 static mojom::UpdateSeverity severity_;
66 static bool factory_reset_required_; 70 static bool factory_reset_required_;
67 static mojom::UpdateType update_type_; 71 static mojom::UpdateType update_type_;
68 static bool update_over_cellular_available_; 72 static bool update_over_cellular_available_;
69 73
70 DISALLOW_COPY_AND_ASSIGN(TrayUpdate); 74 DISALLOW_COPY_AND_ASSIGN(TrayUpdate);
71 }; 75 };
72 76
73 } // namespace ash 77 } // namespace ash
74 78
75 #endif // ASH_SYSTEM_UPDATE_TRAY_UPDATE_H_ 79 #endif // ASH_SYSTEM_UPDATE_TRAY_UPDATE_H_
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_notifier.cc ('k') | ash/system/update/tray_update.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698