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 #ifndef CHROME_BROWSER_CHROMEOS_EOL_NOTIFICATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EOL_NOTIFICATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EOL_NOTIFICATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EOL_NOTIFICATION_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "third_party/cros_system_api/dbus/update_engine/dbus-constants.h" |
12 | 13 |
13 namespace message_center { | 14 namespace message_center { |
14 class MessageCenter; | 15 class MessageCenter; |
15 } | 16 } |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 | 19 |
19 // EolNotification is created when user logs in. It is | 20 // EolNotification is created when user logs in. It is |
20 // used to check current EndOfLife Status of the device, | 21 // used to check current EndOfLife Status of the device, |
21 // and show notification accordingly. | 22 // and show notification accordingly. |
22 class EolNotification final { | 23 class EolNotification final { |
23 public: | 24 public: |
24 explicit EolNotification(Profile* profile); | 25 explicit EolNotification(Profile* profile); |
25 ~EolNotification(); | 26 ~EolNotification(); |
26 | 27 |
27 // Check Eol status from update engine. | 28 // Check Eol status from update engine. |
28 void CheckEolStatus(); | 29 void CheckEolStatus(); |
29 | 30 |
30 private: | 31 private: |
31 // Callback invoked when |GetEolStatus()| has finished. | 32 // Callback invoked when |GetEolStatus()| has finished. |
32 void OnEolStatus(int status); | 33 void OnEolStatus(update_engine::EndOfLifeStatus status); |
33 | 34 |
34 // Create or updates the notfication. | 35 // Create or updates the notfication. |
35 void Update(); | 36 void Update(); |
36 | 37 |
37 // Returns messages that applys to this eol status. | 38 // Returns messages that applys to this eol status. |
38 base::string16 GetEolMessage(); | 39 base::string16 GetEolMessage(); |
39 | 40 |
40 // Profile which is associated with the EndOfLife notification. | 41 // Profile which is associated with the EndOfLife notification. |
41 Profile* const profile_; | 42 Profile* const profile_; |
42 | 43 |
43 // Device Eol status. | 44 // Device EndOfLife status. |
44 int status_; | 45 update_engine::EndOfLifeStatus status_; |
45 | 46 |
46 // Factory of callbacks. | 47 // Factory of callbacks. |
47 base::WeakPtrFactory<EolNotification> weak_factory_; | 48 base::WeakPtrFactory<EolNotification> weak_factory_; |
48 | 49 |
49 DISALLOW_COPY_AND_ASSIGN(EolNotification); | 50 DISALLOW_COPY_AND_ASSIGN(EolNotification); |
50 }; | 51 }; |
51 | 52 |
52 } // namespace chromeos | 53 } // namespace chromeos |
53 | 54 |
54 #endif // CHROME_BROWSER_CHROMEOS_EOL_NOTIFICATION_H_ | 55 #endif // CHROME_BROWSER_CHROMEOS_EOL_NOTIFICATION_H_ |
OLD | NEW |