Plugins/Displays/WebKit/GrowlWebKitPluginHandler.m
author boredzo
Sun Jul 06 17:07:42 2008 +0000 (2008-07-06)
changeset 4139 442ca737bbcb
parent 4137 a8b169b45c40
child 4259 0e9b6b0b1e25
permissions -rw-r--r--
Oops. Now, the clang static analyzer now flags this as a use-after-release. I need to release the plug-in bundle later; i.e, at the end of the method.
     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 
    29 	GrowlWebKitDisplayPlugin *instance = [[GrowlWebKitDisplayPlugin alloc] initWithStyleBundle:pluginBundle];
    30 	if (!instance) {
    31 		NSLog(@"%@ Failed to load: %@ - the bundle did not contain a valid WebKit plugin",
    32 			  NSStringFromClass([self class]),
    33 			  path);
    34 		return NO;
    35 	}
    36 
    37 	[[GrowlPluginController sharedController] addPluginInstance:instance fromBundle:pluginBundle];
    38 	[instance release];
    39 	[pluginBundle release];
    40 	return YES;
    41 }
    42 
    43 
    44 @end