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 #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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 sDefaultKeystoneGlue = [[KeystoneGlue alloc] init]; | 103 sDefaultKeystoneGlue = [[KeystoneGlue alloc] init]; |
104 [sDefaultKeystoneGlue loadParameters]; | 104 [sDefaultKeystoneGlue loadParameters]; |
105 if (![sDefaultKeystoneGlue loadKeystoneRegistration]) { | 105 if (![sDefaultKeystoneGlue loadKeystoneRegistration]) { |
106 [sDefaultKeystoneGlue release]; | 106 [sDefaultKeystoneGlue release]; |
107 sDefaultKeystoneGlue = nil; | 107 sDefaultKeystoneGlue = nil; |
108 } | 108 } |
109 } | 109 } |
110 return sDefaultKeystoneGlue; | 110 return sDefaultKeystoneGlue; |
111 } | 111 } |
112 | 112 |
113 + (void)releaseDefaultKeystoneGlue { | |
114 [sDefaultKeystoneGlue release]; | |
115 sDefaultKeystoneGlue = nil; | |
116 } | |
117 | |
118 - (id)init { | 113 - (id)init { |
119 if ((self = [super init])) { | 114 if ((self = [super init])) { |
120 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 115 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
121 | 116 |
122 [center addObserver:self | 117 [center addObserver:self |
123 selector:@selector(checkForUpdateComplete:) | 118 selector:@selector(checkForUpdateComplete:) |
124 name:KSRegistrationCheckForUpdateNotification | 119 name:KSRegistrationCheckForUpdateNotification |
125 object:nil]; | 120 object:nil]; |
126 | 121 |
127 [center addObserver:self | 122 [center addObserver:self |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 userInfo:dictionary]; | 383 userInfo:dictionary]; |
389 recentNotification_.reset([notification retain]); | 384 recentNotification_.reset([notification retain]); |
390 | 385 |
391 [[NSNotificationCenter defaultCenter] postNotification:notification]; | 386 [[NSNotificationCenter defaultCenter] postNotification:notification]; |
392 } | 387 } |
393 | 388 |
394 - (NSNotification*)recentNotification { | 389 - (NSNotification*)recentNotification { |
395 return [[recentNotification_ retain] autorelease]; | 390 return [[recentNotification_ retain] autorelease]; |
396 } | 391 } |
397 | 392 |
398 - (void)clearRecentNotification { | |
399 recentNotification_.reset(nil); | |
400 } | |
401 | |
402 - (AutoupdateStatus)recentStatus { | 393 - (AutoupdateStatus)recentStatus { |
403 NSDictionary* dictionary = [recentNotification_ userInfo]; | 394 NSDictionary* dictionary = [recentNotification_ userInfo]; |
404 return static_cast<AutoupdateStatus>( | 395 return static_cast<AutoupdateStatus>( |
405 [[dictionary objectForKey:kAutoupdateStatusStatus] intValue]); | 396 [[dictionary objectForKey:kAutoupdateStatusStatus] intValue]); |
406 } | 397 } |
407 | 398 |
408 - (BOOL)asyncOperationPending { | 399 - (BOOL)asyncOperationPending { |
409 AutoupdateStatus status = [self recentStatus]; | 400 AutoupdateStatus status = [self recentStatus]; |
410 return status == kAutoupdateChecking || status == kAutoupdateInstalling; | 401 return status == kAutoupdateChecking || status == kAutoupdateInstalling; |
411 } | 402 } |
412 | 403 |
413 @end // @implementation KeystoneGlue | 404 @end // @implementation KeystoneGlue |
OLD | NEW |