Plugins/Displays/WebKit/GrowlWebKitPluginHandler.m
author boredzo
Sun Jul 06 16:43:51 2008 +0000 (2008-07-06)
changeset 4137 a8b169b45c40
parent 3040 e5d20a5500c3
child 4139 442ca737bbcb
permissions -rw-r--r--
Fixed two leaks found by the clang static analyzer.
     1 //
     2 //  GrowlWebKitPluginHandler.m
     3 //  Growl
     4 //
     5 //  Created by JKP on 03/11/2005.
     6 //  Copyright 2005-2006 The Growl Project. All rights reserved.
     7 //
     8 
     9 #import "GrowlWebKitPluginHandler.h"
    10 #import "GrowlWebKitDisplayPlugin.h"
    11 #import "GrowlPluginController.h"
    12 
    13 @implementation GrowlWebKitPluginHandler
    14 
    15 - (id) initSingleton {
    16 	if ((self = [super initSingleton]))
    17 		[[GrowlPluginController sharedController] addPluginHandler:self forPluginTypes:[NSSet setWithObject:GROWL_STYLE_EXTENSION]];
    18 
    19 	return self;
    20 }
    21 
    22 - (BOOL) loadPluginAtPath:(NSString *)path {
    23 	NSBundle *pluginBundle = [[NSBundle alloc] initWithPath:path];
    24 	if (!pluginBundle) {
    25 		NSLog(@"%@ Failed to load: %@",NSStringFromClass([self class]),path);
    26 		return NO;
    27 	}
    28 	[pluginBundle release];
    29 
    30 	GrowlWebKitDisplayPlugin *instance = [[GrowlWebKitDisplayPlugin alloc] initWithStyleBundle:pluginBundle];
    31 	if (!instance) {
    32 		NSLog(@"%@ Failed to load: %@ - the bundle did not contain a valid WebKit plugin",
    33 			  NSStringFromClass([self class]),
    34 			  path);
    35 		return NO;
    36 	}
    37 
    38 	[[GrowlPluginController sharedController] addPluginInstance:instance fromBundle:pluginBundle];
    39 	[instance release];
    40 	return YES;
    41 }
    42 
    43 
    44 @end