PageRenderTime 41ms CodeModel.GetById 23ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 0ms

/core/autoinstaller/UpdateEngineExtensions/EngineDelegate.m

http://macfuse.googlecode.com/
Objective C | 66 lines | 44 code | 15 blank | 7 comment | 4 complexity | 1c648ddcba808adc905f40bb79ae3839 MD5 | raw file
 1//
 2//  EngineDelegate.m
 3//  autoinstaller
 4//
 5//  Created by Greg Miller on 7/10/08.
 6//  Copyright 2008 Google Inc. All rights reserved.
 7//
 8
 9#import "EngineDelegate.h"
10#import "KSCommandRunner.h"
11#import "KSUpdateEngine.h"
12#import "UpdatePrinter.h"
13
14
15@implementation EngineDelegate
16
17- (id)init {
18  return [self initWithPrinter:nil doInstall:NO];
19}
20
21- (id)initWithPrinter:(UpdatePrinter *)printer doInstall:(BOOL)doInstall {
22  if ((self = [super init])) {
23    printer_ = [printer retain];
24    doInstall_ = doInstall;
25    wasSuccess_ = YES;
26  }
27  return self;
28}
29
30- (void)dealloc {
31  [printer_ release];
32  [super dealloc];
33}
34
35- (BOOL)wasSuccess {
36  return wasSuccess_;
37}
38
39- (NSArray *)engine:(KSUpdateEngine *)engine
40shouldPrefetchProducts:(NSArray *)products {
41  
42  [printer_ printUpdates:products];
43  
44  if (!doInstall_) {
45    [engine stopAndReset];
46    return nil;
47  }
48  
49  return products;
50}
51
52- (void)engine:(KSUpdateEngine *)engine
53      finished:(KSUpdateInfo *)updateInfo
54    wasSuccess:(BOOL)wasSuccess
55   wantsReboot:(BOOL)wantsReboot {
56  if (!wasSuccess)
57    wasSuccess_ = NO;
58}
59
60- (void)engineFinished:(KSUpdateEngine *)engine wasSuccess:(BOOL)wasSuccess {
61  if (!wasSuccess)
62    wasSuccess_ = NO;
63}
64
65@end
66