/core/externals/update-engine/Core/KSOutOfBandDataAction.m

http://macfuse.googlecode.com/ · Objective C · 58 lines · 32 code · 13 blank · 13 comment · 2 complexity · 02748c5245e8588e4a56959729ce2239 MD5 · raw file

  1. // Copyright 2010 Google Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import "KSOutOfBandDataAction.h"
  15. #import "KSActionConstants.h"
  16. #import "KSActionPipe.h"
  17. #import "KSActionProcessor.h"
  18. #import "KSUpdateEngine.h"
  19. @implementation KSOutOfBandDataAction
  20. + (id)actionWithEngine:(KSUpdateEngine *)engine {
  21. return [[[self alloc] initWithEngine:engine] autorelease];
  22. }
  23. - (id)initWithEngine:(KSUpdateEngine *)engine {
  24. if ((self = [super init])) {
  25. engine_ = [engine retain];
  26. }
  27. return self;
  28. }
  29. - (void)dealloc {
  30. [engine_ release];
  31. [super dealloc];
  32. }
  33. - (void)performAction {
  34. id pipeContents = [[self inPipe] contents];
  35. NSArray *updateInfos = [pipeContents objectForKey:KSActionUpdateInfosKey];
  36. NSDictionary *oobData =
  37. [pipeContents objectForKey:KSActionOutOfBandDataKey];
  38. id delegate = [engine_ delegate];
  39. if ([delegate respondsToSelector:@selector(engine:hasOutOfBandData:)]) {
  40. [delegate engine:engine_ hasOutOfBandData:oobData];
  41. }
  42. [[self outPipe] setContents:updateInfos];
  43. [[self processor] finishedProcessing:self successfully:YES];
  44. }
  45. @end