@@ -52,6 +52,9 @@ of this software and associated documentation files (the "Software"), to deal
52
52
static NSString *sApplicationWhitelist = @" applicationWhitelist" ;
53
53
static NSString *sDrawGearImageOnlyOnMouseOverHiddenPref = @" drawGearImageOnlyOnMouseOver" ;
54
54
55
+ // Info.plist key for app developers
56
+ static NSString *sCTFOptOutKey = @" ClickToFlashOptOut" ;
57
+
55
58
BOOL usingMATrackingArea = NO ;
56
59
57
60
@interface CTFClickToFlashPlugin (Internal)
@@ -106,6 +109,17 @@ - (id) initWithArguments:(NSDictionary *)arguments
106
109
{
107
110
self = [super init ];
108
111
if (self) {
112
+ defaultWhitelist = [NSArray arrayWithObjects: @" com.apple.frontrow" ,
113
+ @" com.apple.dashboard" ,
114
+ @" com.apple.dashboard.client" ,
115
+ @" com.apple.ScreenSaver.Engine" ,
116
+ @" com.hulu.HuluDesktop" ,
117
+ @" com.riverfold.WiiTransfer" ,
118
+ @" com.bitcartel.pandorajam" ,
119
+ @" com.adobe.flexbuilder" ,
120
+ @" com.Zattoo.prefs" ,
121
+ nil ];
122
+
109
123
[[NSUserDefaults standardUserDefaults ] addSuiteNamed: @" com.github.rentzsch.clicktoflash" ];
110
124
SparkleManager *sharedSparkleManager = [SparkleManager sharedManager ];
111
125
NSWorkspace *sharedWorkspace = [NSWorkspace sharedWorkspace ];
@@ -128,7 +142,7 @@ - (id) initWithArguments:(NSDictionary *)arguments
128
142
129
143
[self _migrateWhitelist ];
130
144
[self _migratePrefsToExternalFile ];
131
- [self _addApplicationWhitelistToPrefsFile ];
145
+ [self _addApplicationWhitelistArrayToPrefsFile ];
132
146
133
147
134
148
// Get URL
@@ -211,8 +225,11 @@ - (id) initWithArguments:(NSDictionary *)arguments
211
225
CTFUserDefaultsController *standardUserDefaults = [CTFUserDefaultsController standardUserDefaults ];
212
226
BOOL pluginEnabled = [standardUserDefaults boolForKey: sPluginEnabled ];
213
227
NSString *hostAppBundleID = [[NSBundle mainBundle ] bundleIdentifier ];
214
- BOOL hostAppIsInWhitelist = [[standardUserDefaults arrayForKey: sApplicationWhitelist ] containsObject: hostAppBundleID];
215
- if ( (! pluginEnabled) || (hostAppIsInWhitelist) ) {
228
+ BOOL hostAppIsInDefaultWhitelist = [defaultWhitelist containsObject: hostAppBundleID];
229
+ BOOL hostAppIsInUserWhitelist = [[standardUserDefaults arrayForKey: sApplicationWhitelist ] containsObject: hostAppBundleID];
230
+ BOOL hostAppWhitelistedInInfoPlist = NO ;
231
+ if ([[[NSBundle mainBundle ] infoDictionary ] objectForKey: sCTFOptOutKey ]) hostAppWhitelistedInInfoPlist = YES ;
232
+ if ( (! pluginEnabled) || (hostAppIsInDefaultWhitelist || hostAppIsInUserWhitelist || hostAppWhitelistedInInfoPlist) ) {
216
233
_isLoadingFromWhitelist = YES ;
217
234
[self _convertTypesForContainer ];
218
235
return self;
@@ -426,20 +443,15 @@ - (void) _migratePrefsToExternalFile
426
443
}
427
444
}
428
445
429
- - (void ) _addApplicationWhitelistToPrefsFile
446
+ - (void ) _addApplicationWhitelistArrayToPrefsFile
430
447
{
431
448
CTFUserDefaultsController *standardUserDefaults = [CTFUserDefaultsController standardUserDefaults ];
432
449
NSArray *applicationWhitelist = [standardUserDefaults arrayForKey: sApplicationWhitelist ];
433
450
if (! applicationWhitelist) {
434
- // add the default list of apps to the whitelist
435
- NSArray *defaultWhitelist = [NSArray arrayWithObjects: @" com.hulu.HuluDesktop" ,
436
- @" com.echoone.iSwiff" ,
437
- @" com.riverfold.WiiTransfer" ,
438
- @" com.bitcartel.pandorajam" ,
439
- @" com.adobe.flexbuilder" ,
440
- @" com.Zattoo.prefs" ,
441
- nil ];
442
- [standardUserDefaults setObject: defaultWhitelist forKey: sApplicationWhitelist ];
451
+ // add an empty array to the plist file so people know exactly where to
452
+ // whitelist apps
453
+
454
+ [standardUserDefaults setObject: [NSArray array ] forKey: sApplicationWhitelist ];
443
455
}
444
456
}
445
457
0 commit comments