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

Side by Side Diff: chrome/app/keystone_glue.h

Issue 449004: Merge r33241 to the 249 branch.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/249/src/
Patch Set: Created 11 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/app/keystone_glue.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_APP_KEYSTONE_GLUE_H_
6 #define CHROME_APP_KEYSTONE_GLUE_H_
7
8 #import <Foundation/Foundation.h>
9 #import <base/scoped_nsobject.h>
10
11 // Possible outcomes of -checkForUpdate and -installUpdate. A version may
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
14 // version is referenced. A notification posted containing an asynchronous
15 // status will always be followed by a notification with a terminal status.
16 enum AutoupdateStatus {
17 kAutoupdateNone = 0, // no version (initial state only)
18 kAutoupdateChecking, // no version (asynchronous operation in progress)
19 kAutoupdateCurrent, // version of the running application
20 kAutoupdateAvailable, // version of the update that is available
21 kAutoupdateInstalling, // no version (asynchronous operation in progress)
22 kAutoupdateInstalled, // version of the update that was installed
23 kAutoupdateCheckFailed, // no version
24 kAutoupdateInstallFailed // no version
25 };
26
27 // kAutoupdateStatusNotification is the name of the notification posted when
28 // -checkForUpdate and -installUpdate complete. This notification will be
29 // sent with with its sender object set to the KeystoneGlue instance sending
30 // the notification. Its userInfo dictionary will contain an AutoupdateStatus
31 // value as an intValue at key kAutoupdateStatusStatus. If a version is
32 // available (see AutoupdateStatus), it will be present at key
33 // kAutoupdateStatusVersion.
34 extern const NSString* const kAutoupdateStatusNotification;
35 extern const NSString* const kAutoupdateStatusStatus;
36 extern const NSString* const kAutoupdateStatusVersion;
37
38 // KeystoneGlue is an adapter around the KSRegistration class, allowing it to
39 // be used without linking directly against its containing KeystoneRegistration
40 // framework. This is used in an environment where most builds (such as
41 // developer builds) don't want or need Keystone support and might not even
42 // have the framework available. Enabling Keystone support in an application
43 // that uses KeystoneGlue is as simple as dropping
44 // KeystoneRegistration.framework in the application's Frameworks directory
45 // and providing the relevant information in its Info.plist. KeystoneGlue
46 // requires that the KSUpdateURL key be set in the application's Info.plist,
47 // and that it contain a string identifying the update URL to be used by
48 // Keystone.
49
50 @class KSRegistration;
51
52 @interface KeystoneGlue : NSObject {
53 @protected
54
55 // Data for Keystone registration
56 NSString* url_;
57 NSString* productID_;
58 NSString* version_;
59 NSString* channel_; // Logically: Dev, Beta, or Stable.
60
61 // And the Keystone registration itself, with the active timer
62 KSRegistration* registration_; // strong
63 NSTimer* timer_; // strong
64
65 // The most recent kAutoupdateStatusNotification notification posted.
66 scoped_nsobject<NSNotification> recentNotification_;
67
68 // YES if an update was ever successfully installed by -installUpdate.
69 BOOL updateSuccessfullyInstalled_;
70 }
71
72 // Return the default Keystone Glue object.
73 + (id)defaultKeystoneGlue;
74
75 // Load KeystoneRegistration.framework if present, call into it to register
76 // with Keystone, and set up periodic activity pings.
77 - (void)registerWithKeystone;
78
79 // -checkForUpdate launches a check for updates, and -installUpdate begins
80 // installing an available update. For each, status will be communicated via
81 // a kAutoupdateStatusNotification notification, and will also be available
82 // through -recentNotification.
83 - (void)checkForUpdate;
84 - (void)installUpdate;
85
86 // Accessor for recentNotification_. Returns an autoreleased NSNotification.
87 - (NSNotification*)recentNotification;
88
89 // Accessor for the kAutoupdateStatusStatus field of recentNotification_'s
90 // userInfo dictionary.
91 - (AutoupdateStatus)recentStatus;
92
93 // Returns YES if an asynchronous operation is pending: if an update check or
94 // installation attempt is currently in progress.
95 - (BOOL)asyncOperationPending;
96
97 @end // @interface KeystoneGlue
98
99 @interface KeystoneGlue(ExposedForTesting)
100
101 // Load any params we need for configuring Keystone.
102 - (void)loadParameters;
103
104 // Load the Keystone registration object.
105 // Return NO on failure.
106 - (BOOL)loadKeystoneRegistration;
107
108 - (void)stopTimer;
109
110 // Called when a checkForUpdate: notification completes.
111 - (void)checkForUpdateComplete:(NSNotification*)notification;
112
113 // Called when an installUpdate: notification completes.
114 - (void)installUpdateComplete:(NSNotification*)notification;
115
116 @end // @interface KeystoneGlue(ExposedForTesting)
117
118 #endif // CHROME_APP_KEYSTONE_GLUE_H_
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/app/keystone_glue.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698