/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. #import "EngineDelegate.h"
  9. #import "KSCommandRunner.h"
  10. #import "KSUpdateEngine.h"
  11. #import "UpdatePrinter.h"
  12. @implementation EngineDelegate
  13. - (id)init {
  14. return [self initWithPrinter:nil doInstall:NO];
  15. }
  16. - (id)initWithPrinter:(UpdatePrinter *)printer doInstall:(BOOL)doInstall {
  17. if ((self = [super init])) {
  18. printer_ = [printer retain];
  19. doInstall_ = doInstall;
  20. wasSuccess_ = YES;
  21. }
  22. return self;
  23. }
  24. - (void)dealloc {
  25. [printer_ release];
  26. [super dealloc];
  27. }
  28. - (BOOL)wasSuccess {
  29. return wasSuccess_;
  30. }
  31. - (NSArray *)engine:(KSUpdateEngine *)engine
  32. shouldPrefetchProducts:(NSArray *)products {
  33. [printer_ printUpdates:products];
  34. if (!doInstall_) {
  35. [engine stopAndReset];
  36. return nil;
  37. }
  38. return products;
  39. }
  40. - (void)engine:(KSUpdateEngine *)engine
  41. finished:(KSUpdateInfo *)updateInfo
  42. wasSuccess:(BOOL)wasSuccess
  43. wantsReboot:(BOOL)wantsReboot {
  44. if (!wasSuccess)
  45. wasSuccess_ = NO;
  46. }
  47. - (void)engineFinished:(KSUpdateEngine *)engine wasSuccess:(BOOL)wasSuccess {
  48. if (!wasSuccess)
  49. wasSuccess_ = NO;
  50. }
  51. @end