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

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

Issue 329041: KSR should always support the new registration API now (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 | « no previous file | no next file » | 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) 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 #import "chrome/app/keystone_glue.h" 5 #import "chrome/app/keystone_glue.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 #import "base/worker_pool_mac.h" 9 #import "base/worker_pool_mac.h"
10 #include "chrome/common/chrome_constants.h" 10 #include "chrome/common/chrome_constants.h"
(...skipping 17 matching lines...) Expand all
28 28
29 NSString *KSRegistrationRemoveExistingTag = @""; 29 NSString *KSRegistrationRemoveExistingTag = @"";
30 #define KSRegistrationPreserveExistingTag nil 30 #define KSRegistrationPreserveExistingTag nil
31 31
32 } // namespace 32 } // namespace
33 33
34 @interface KSRegistration : NSObject 34 @interface KSRegistration : NSObject
35 35
36 + (id)registrationWithProductID:(NSString*)productID; 36 + (id)registrationWithProductID:(NSString*)productID;
37 37
38 // Older API
39 - (BOOL)registerWithVersion:(NSString*)version
40 existenceCheckerType:(KSExistenceCheckerType)xctype
41 existenceCheckerString:(NSString*)xc
42 serverURLString:(NSString*)serverURLString;
43 // Newer API
44 - (BOOL)registerWithVersion:(NSString*)version 38 - (BOOL)registerWithVersion:(NSString*)version
45 existenceCheckerType:(KSExistenceCheckerType)xctype 39 existenceCheckerType:(KSExistenceCheckerType)xctype
46 existenceCheckerString:(NSString*)xc 40 existenceCheckerString:(NSString*)xc
47 serverURLString:(NSString*)serverURLString 41 serverURLString:(NSString*)serverURLString
48 preserveTTToken:(BOOL)preserveToken 42 preserveTTToken:(BOOL)preserveToken
49 tag:(NSString*)tag; 43 tag:(NSString*)tag;
50 44
51 - (void)setActive; 45 - (void)setActive;
52 - (void)checkForUpdate; 46 - (void)checkForUpdate;
53 - (void)startUpdate; 47 - (void)startUpdate;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return NO; 188 return NO;
195 189
196 registration_ = [ksr retain]; 190 registration_ = [ksr retain];
197 return YES; 191 return YES;
198 } 192 }
199 193
200 - (void)registerWithKeystone { 194 - (void)registerWithKeystone {
201 // The existence checks should use the path to the app bundle, not the 195 // The existence checks should use the path to the app bundle, not the
202 // app framework bundle, so use [NSBundle mainBundle] instead of 196 // app framework bundle, so use [NSBundle mainBundle] instead of
203 // mac_util::MainBundle(). 197 // mac_util::MainBundle().
204 // 198 [registration_ registerWithVersion:version_
205 // Only use new API if we can. This lets us land the new call 199 existenceCheckerType:kKSPathExistenceChecker
206 // before the new Keystone has been released. 200 existenceCheckerString:[[NSBundle mainBundle] bundlePath]
207 // 201 serverURLString:url_
208 // TODO(jrg): once we hit Beta and the new Keystone is released, 202 preserveTTToken:YES
209 // make this call unconditional. 203 tag:channel_];
210 if ([registration_ respondsToSelector:@selector(registerWithVersion:existenceC heckerType:existenceCheckerString:serverURLString:preserveTTToken:tag:)])
211 [registration_ registerWithVersion:version_
212 existenceCheckerType:kKSPathExistenceChecker
213 existenceCheckerString:[[NSBundle mainBundle] bundlePath]
214 serverURLString:url_
215 preserveTTToken:YES
216 tag:channel_];
217 else
218 [registration_ registerWithVersion:version_
219 existenceCheckerType:kKSPathExistenceChecker
220 existenceCheckerString:[[NSBundle mainBundle] bundlePath]
221 serverURLString:url_];
222 204
223 // Mark an active RIGHT NOW; don't wait an hour for the first one. 205 // Mark an active RIGHT NOW; don't wait an hour for the first one.
224 [registration_ setActive]; 206 [registration_ setActive];
225 207
226 // Set up hourly activity pings. 208 // Set up hourly activity pings.
227 timer_ = [NSTimer scheduledTimerWithTimeInterval:60 * 60 // One hour 209 timer_ = [NSTimer scheduledTimerWithTimeInterval:60 * 60 // One hour
228 target:self 210 target:self
229 selector:@selector(markActive:) 211 selector:@selector(markActive:)
230 userInfo:registration_ 212 userInfo:registration_
231 repeats:YES]; 213 repeats:YES];
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 return static_cast<AutoupdateStatus>( 380 return static_cast<AutoupdateStatus>(
399 [[dictionary objectForKey:kAutoupdateStatusStatus] intValue]); 381 [[dictionary objectForKey:kAutoupdateStatusStatus] intValue]);
400 } 382 }
401 383
402 - (BOOL)asyncOperationPending { 384 - (BOOL)asyncOperationPending {
403 AutoupdateStatus status = [self recentStatus]; 385 AutoupdateStatus status = [self recentStatus];
404 return status == kAutoupdateChecking || status == kAutoupdateInstalling; 386 return status == kAutoupdateChecking || status == kAutoupdateInstalling;
405 } 387 }
406 388
407 @end // @implementation KeystoneGlue 389 @end // @implementation KeystoneGlue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698