OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_APP_KEYSTONE_GLUE_H_ | 5 #ifndef CHROME_APP_KEYSTONE_GLUE_H_ |
6 #define CHROME_APP_KEYSTONE_GLUE_H_ | 6 #define CHROME_APP_KEYSTONE_GLUE_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 #import <base/scoped_nsobject.h> | 9 #import <base/scoped_nsobject.h> |
10 | 10 |
11 // Possible outcomes of -checkForUpdate and -installUpdate. A version may | 11 // Possible outcomes of -checkForUpdate and -installUpdate. A version may |
12 // accompany some of these, but beware: a version is never required. For | 12 // accompany some of these, but beware: a version is never required. For |
13 // statuses that can be accompanied by a version, the comment indicates what | 13 // statuses that can be accompanied by a version, the comment indicates what |
14 // version is referenced. | 14 // version is referenced. A notification posted containing an asynchronous |
| 15 // status will always be followed by a notification with a terminal status. |
15 enum AutoupdateStatus { | 16 enum AutoupdateStatus { |
16 kAutoupdateCurrent = 0, // version of the running application | 17 kAutoupdateNone = 0, // no version (initial state only) |
| 18 kAutoupdateChecking, // no version (asynchronous operation in progress) |
| 19 kAutoupdateCurrent, // version of the running application |
17 kAutoupdateAvailable, // version of the update that is available | 20 kAutoupdateAvailable, // version of the update that is available |
| 21 kAutoupdateInstalling, // no version (asynchronous operation in progress) |
18 kAutoupdateInstalled, // version of the update that was installed | 22 kAutoupdateInstalled, // version of the update that was installed |
19 kAutoupdateCheckFailed, // no version | 23 kAutoupdateCheckFailed, // no version |
20 kAutoupdateInstallFailed // no version | 24 kAutoupdateInstallFailed // no version |
21 }; | 25 }; |
22 | 26 |
23 // kAutoupdateStatusNotification is the name of the notification posted when | 27 // kAutoupdateStatusNotification is the name of the notification posted when |
24 // -checkForUpdate and -installUpdate complete. This notification will be | 28 // -checkForUpdate and -installUpdate complete. This notification will be |
25 // sent with with its sender object set to the KeystoneGlue instance sending | 29 // sent with with its sender object set to the KeystoneGlue instance sending |
26 // the notification. Its userInfo dictionary will contain an AutoupdateStatus | 30 // the notification. Its userInfo dictionary will contain an AutoupdateStatus |
27 // value as an intValue at key kAutoupdateStatusStatus. If a version is | 31 // value as an intValue at key kAutoupdateStatusStatus. If a version is |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // Return the default Keystone Glue object. | 72 // Return the default Keystone Glue object. |
69 + (id)defaultKeystoneGlue; | 73 + (id)defaultKeystoneGlue; |
70 | 74 |
71 // Load KeystoneRegistration.framework if present, call into it to register | 75 // Load KeystoneRegistration.framework if present, call into it to register |
72 // with Keystone, and set up periodic activity pings. | 76 // with Keystone, and set up periodic activity pings. |
73 - (void)registerWithKeystone; | 77 - (void)registerWithKeystone; |
74 | 78 |
75 // -checkForUpdate launches a check for updates, and -installUpdate begins | 79 // -checkForUpdate launches a check for updates, and -installUpdate begins |
76 // installing an available update. For each, status will be communicated via | 80 // installing an available update. For each, status will be communicated via |
77 // a kAutoupdateStatusNotification notification, and will also be available | 81 // a kAutoupdateStatusNotification notification, and will also be available |
78 // through -recentUpdateStatus. | 82 // through -recentNotification. |
79 - (void)checkForUpdate; | 83 - (void)checkForUpdate; |
80 - (void)installUpdate; | 84 - (void)installUpdate; |
81 | 85 |
82 // Accessor for recentNotification_. Returns an autoreleased NSNotification. | 86 // Accessor for recentNotification_. Returns an autoreleased NSNotification. |
83 - (NSNotification*)recentNotification; | 87 - (NSNotification*)recentNotification; |
84 | 88 |
85 // Clears the saved recentNotification_. | 89 // Clears the saved recentNotification_. |
86 - (void)clearRecentNotification; | 90 - (void)clearRecentNotification; |
87 | 91 |
| 92 // Accessor for the kAutoupdateStatusStatus field of recentNotification_'s |
| 93 // userInfo dictionary. |
| 94 - (AutoupdateStatus)recentStatus; |
| 95 |
| 96 // Returns YES if an asynchronous operation is pending: if an update check or |
| 97 // installation attempt is currently in progress. |
| 98 - (BOOL)asyncOperationPending; |
| 99 |
88 @end // @interface KeystoneGlue | 100 @end // @interface KeystoneGlue |
89 | 101 |
90 @interface KeystoneGlue(ExposedForTesting) | 102 @interface KeystoneGlue(ExposedForTesting) |
91 | 103 |
92 // Release the shared instance. Use this in tests to reset the shared | 104 // Release the shared instance. Use this in tests to reset the shared |
93 // instance in case strange things are done to it for testing purposes. Never | 105 // instance in case strange things are done to it for testing purposes. Never |
94 // call this from non-test code. | 106 // call this from non-test code. |
95 + (void)releaseDefaultKeystoneGlue; | 107 + (void)releaseDefaultKeystoneGlue; |
96 | 108 |
97 // Load any params we need for configuring Keystone. | 109 // Load any params we need for configuring Keystone. |
98 - (void)loadParameters; | 110 - (void)loadParameters; |
99 | 111 |
100 // Load the Keystone registration object. | 112 // Load the Keystone registration object. |
101 // Return NO on failure. | 113 // Return NO on failure. |
102 - (BOOL)loadKeystoneRegistration; | 114 - (BOOL)loadKeystoneRegistration; |
103 | 115 |
104 - (void)stopTimer; | 116 - (void)stopTimer; |
105 | 117 |
106 // Called when a checkForUpdate: notification completes. | 118 // Called when a checkForUpdate: notification completes. |
107 - (void)checkForUpdateComplete:(NSNotification*)notification; | 119 - (void)checkForUpdateComplete:(NSNotification*)notification; |
108 | 120 |
109 // Called when an installUpdate: notification completes. | 121 // Called when an installUpdate: notification completes. |
110 - (void)installUpdateComplete:(NSNotification*)notification; | 122 - (void)installUpdateComplete:(NSNotification*)notification; |
111 | 123 |
112 @end // @interface KeystoneGlue(ExposedForTesting) | 124 @end // @interface KeystoneGlue(ExposedForTesting) |
113 | 125 |
114 #endif // CHROME_APP_KEYSTONE_GLUE_H_ | 126 #endif // CHROME_APP_KEYSTONE_GLUE_H_ |
OLD | NEW |