Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Simplified code to track living CTF views. Changed technique to find …

…views in front tab to use same views the observations use to actually load. Removed seemingly unused InvisibleItemMenu.xib. Updated settings panel to use + and - instead of words.
  • Loading branch information...
commit 16b844c96b6423629d6de707ee3fe69257dbd7ce 1 parent c12886a
Otyr Ugla authored
4 ClickToFlash.xcodeproj/project.pbxproj
@@ -43,7 +43,6 @@
43 43 6953E43C0F3EDEB50014ECF7 /* MenubarMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6953E43A0F3EDEB50014ECF7 /* MenubarMenu.xib */; };
44 44 69A26D0C0F302C10006648BC /* NSBezierPath-RoundedRectangle.m in Sources */ = {isa = PBXBuildFile; fileRef = 69A26D0B0F302C10006648BC /* NSBezierPath-RoundedRectangle.m */; };
45 45 79A21C4D0F30B735009424B8 /* CTFWhitelistWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 79A21C490F30B735009424B8 /* CTFWhitelistWindowController.m */; };
46   - A4501BC80F4439FB00D04D61 /* OSAKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4501BC70F4439FB00D04D61 /* OSAKit.framework */; };
47 46 B5028E930F413553004886D7 /* HarnessAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B5028E910F413553004886D7 /* HarnessAppDelegate.m */; };
48 47 B5CFF17A0F40EEF1005DB9CC /* WhitelistPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 072189BC0F30D9C3008C8944 /* WhitelistPanel.xib */; };
49 48 B5CFF1870F40F000005DB9CC /* HarnessMain.xib in Resources */ = {isa = PBXBuildFile; fileRef = B5CFF1860F40F000005DB9CC /* HarnessMain.xib */; };
@@ -86,7 +85,6 @@
86 85 69A26D0B0F302C10006648BC /* NSBezierPath-RoundedRectangle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSBezierPath-RoundedRectangle.m"; path = "Plugin/NSBezierPath-RoundedRectangle.m"; sourceTree = "<group>"; };
87 86 79A21C490F30B735009424B8 /* CTFWhitelistWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CTFWhitelistWindowController.m; path = Plugin/CTFWhitelistWindowController.m; sourceTree = "<group>"; };
88 87 79A21C4A0F30B735009424B8 /* CTFWhitelistWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CTFWhitelistWindowController.h; path = Plugin/CTFWhitelistWindowController.h; sourceTree = "<group>"; };
89   - A4501BC70F4439FB00D04D61 /* OSAKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OSAKit.framework; path = /System/Library/Frameworks/OSAKit.framework; sourceTree = "<absolute>"; };
90 88 B5028E910F413553004886D7 /* HarnessAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HarnessAppDelegate.m; path = "TestFiles/Debugging Harness/HarnessAppDelegate.m"; sourceTree = "<group>"; };
91 89 B5028E920F413553004886D7 /* HarnessAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HarnessAppDelegate.h; path = "TestFiles/Debugging Harness/HarnessAppDelegate.h"; sourceTree = "<group>"; };
92 90 B5CFF1740F40EEDB005DB9CC /* Whitelist Panel Harness.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Whitelist Panel Harness.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -105,7 +103,6 @@
105 103 files = (
106 104 55EB70580E04A8B80016593D /* Cocoa.framework in Frameworks */,
107 105 55EB70590E04A8B80016593D /* WebKit.framework in Frameworks */,
108   - A4501BC80F4439FB00D04D61 /* OSAKit.framework in Frameworks */,
109 106 );
110 107 runOnlyForDeploymentPostprocessing = 0;
111 108 };
@@ -164,7 +161,6 @@
164 161 children = (
165 162 55EB70560E04A8B80016593D /* Cocoa.framework */,
166 163 55EB70570E04A8B80016593D /* WebKit.framework */,
167   - A4501BC70F4439FB00D04D61 /* OSAKit.framework */,
168 164 );
169 165 name = Frameworks;
170 166 sourceTree = "<group>";
12 Plugin/CTFMenubarMenuController.h
@@ -26,25 +26,22 @@ THE SOFTWARE.
26 26
27 27 #import <Cocoa/Cocoa.h>
28 28
29   -
30 29 @class CTFWhitelistWindowController;
31 30
  31 +
32 32 extern NSString* kCTFLoadAllFlashViews;
33 33 extern NSString* kCTFLoadFlashViewsForWindow;
34 34 extern NSString* kCTFLoadInvisibleFlashViewsForWindow;
35   -extern NSString* sCTFNewViewNotification;
36   -extern NSString* sCTFDestroyedViewNotification;
  35 +
37 36 extern NSUInteger maxInvisibleDimension;
38 37
39 38
40 39 @interface CTFMenubarMenuController : NSObject {
41 40 IBOutlet NSMenu* menu;
42 41 CTFWhitelistWindowController *_whitelistWindowController;
43   - NSMutableDictionary *_flashViews;
  42 + NSHashTable *_views;
44 43 }
45 44
46   -@property (retain) NSMutableDictionary *flashViews;
47   -
48 45 + (CTFMenubarMenuController*) sharedController;
49 46
50 47 - (void) loadFlashForWindow: (NSWindow*) window;
@@ -54,4 +51,7 @@ extern NSUInteger maxInvisibleDimension;
54 51 - (IBAction) loadKeyWindowInvisibleFlash: (id) sender;
55 52 - (IBAction) showSettingsWindow: (id) sender;
56 53
  54 +- (void) registerView: (NSView*) view;
  55 +- (void) unregisterView: (NSView*) view;
  56 +
57 57 @end
204 Plugin/CTFMenubarMenuController.m
@@ -26,18 +26,15 @@ of this software and associated documentation files (the "Software"), to deal
26 26
27 27 #import "CTFMenubarMenuController.h"
28 28 #import "CTFWhitelistWindowController.h"
29   -#import <OSAKit/OSAKit.h>
30   -#import <WebKit/WebKit.h>
31 29
  30 +#import "Plugin.h"
32 31
33 32 NSString* kCTFLoadAllFlashViews = @"CTFLoadAllFlashViews";
34 33 NSString* kCTFLoadFlashViewsForWindow = @"CTFLoadFlashViewsForWindow";
35 34 NSString* kCTFLoadInvisibleFlashViewsForWindow = @"CTFLoadInvisibleFlashViewsForWindow";
36   -NSString *sCTFNewViewNotification = @"CTFNewFlashView";
37   -NSString *sCTFDestroyedViewNotification = @"CTFDestroyedFlashView";
  35 +
38 36 NSUInteger maxInvisibleDimension = 50;
39 37
40   -static CTFMenubarMenuController* sSingleton = nil;
41 38
42 39 static NSString* kApplicationsToInstallMenuInto[] = {
43 40 @"com.apple.Safari",
@@ -116,6 +113,9 @@ - (int) applicationMenuPrefsInsertionLocation
116 113 #pragma mark Lifetime management
117 114
118 115
  116 +static CTFMenubarMenuController* sSingleton = nil;
  117 +
  118 +
119 119 - (id) init
120 120 {
121 121 if( sSingleton ) {
@@ -130,19 +130,10 @@ - (id) init
130 130 if( self ) {
131 131 if( ! [ NSBundle loadNibNamed: @"MenubarMenu" owner: self ] )
132 132 NSLog( @"ClickToFlash: Could not load menubar menu nib" );
  133 +
  134 + _views = NSCreateHashTable( NSNonRetainedObjectHashCallBacks, 0 );
133 135 }
134 136
135   - NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
136   - [center addObserver: self
137   - selector: @selector( _trackNewView: )
138   - name: sCTFNewViewNotification
139   - object: nil ];
140   -
141   - [center addObserver: self
142   - selector: @selector( _stopTrackingView: )
143   - name: sCTFDestroyedViewNotification
144   - object: nil ];
145   -
146 137 return self;
147 138 }
148 139
@@ -150,7 +141,8 @@ - (id) init
150 141 - (void) dealloc
151 142 {
152 143 [ _whitelistWindowController release ];
153   -
  144 + NSFreeHashTable( _views );
  145 +
154 146 [ super dealloc ];
155 147 }
156 148
@@ -196,167 +188,69 @@ + (CTFMenubarMenuController*) sharedController
196 188 #pragma mark -
197 189 #pragma mark View Management
198 190
199   -- (void) _trackNewView: (NSNotification*) notification
200   -{
201   - NSMutableDictionary *flashViewsDict = nil;
202   - if ([self flashViews])
203   - flashViewsDict = [[self flashViews] copy];
204   -
205   - if (! flashViewsDict) flashViewsDict = [NSMutableDictionary dictionary];
206   -
207   - NSString *newViewBaseURL = [[[notification userInfo] objectForKey:@"baseURL"] absoluteString];
208   - NSString *newViewSrc = [[notification userInfo] objectForKey:@"src"];
209   - NSNumber *newViewHeight = [[notification userInfo] objectForKey:@"height"];
210   - NSNumber *newViewWidth = [[notification userInfo] objectForKey:@"width"];
211   - id newTarget = [notification object];
212   -
213   - NSDictionary *newTargetDict = [NSDictionary dictionaryWithObjectsAndKeys:newTarget,@"target",newViewSrc,@"src",newViewHeight,@"height",newViewWidth,@"width",nil];
214   -
215   - NSMutableArray *baseURLArray = [flashViewsDict objectForKey:newViewBaseURL];
216   -
217   - if (! baseURLArray) {
218   - baseURLArray = [NSMutableArray arrayWithObject:newTargetDict];
219   - [flashViewsDict setObject:baseURLArray forKey:newViewBaseURL];
220   - } else {
221   - [baseURLArray addObject:newTargetDict];
222   - }
223   -
224   - [self setFlashViews:flashViewsDict];
225   -
226   - // not sure why, but the following lines causes crashes and unexpected behavior
227   - //[flashViewsDict release];
228   -}
229 191
230   -- (void) _stopTrackingView: (NSNotification*) notification
  192 +- (void) registerView: (NSView*) view
231 193 {
232   - NSMutableDictionary *flashViewsDict = nil;
233   - if ([self flashViews])
234   - flashViewsDict = [[self flashViews] copy];
235   -
236   - if (! flashViewsDict) flashViewsDict = [NSMutableDictionary dictionary];
237   -
238   - NSString *baseURL = [[notification userInfo] objectForKey:@"baseURL"];
239   - NSMutableArray *baseURLArray = [flashViewsDict objectForKey:baseURL];
240   - id flashView = [notification object];
241   -
242   - if (! baseURLArray) {
243   - // we're apparently not tracking this view
244   - return;
245   - }
246   -
247   - NSDictionary *currentDictionary;
248   - BOOL foundView = NO;
249   - for (currentDictionary in baseURLArray) {
250   - if ([currentDictionary objectForKey:@"target"] == flashView) {
251   - foundView = YES;
252   - break;
253   - }
254   - }
255   -
256   - if (foundView) {
257   - // only do this stuff if we actually find the view we want to stop tracking
258   -
259   - [baseURLArray removeObject:currentDictionary];
260   - if ([baseURLArray count] == 0) [flashViewsDict removeObjectForKey:baseURL];
261   - [self setFlashViews:flashViewsDict];
262   - }
  194 + NSHashInsertIfAbsent( _views, view );
263 195 }
264 196
265   -- (NSString *)_baseURLOfKeyWindow;
266   -{
267   - // [[NSBundle mainBundle] bundleIdentifier|executablePath|bundlePath] all return stuff for Safari
268   - // even if called from WebKit
269   -
270   - // the following line crashes WebKit, so we can't use the Scripting Bridge until that is fixed
271   - // SafariApplication *safari = [SBApplication applicationWithProcessIdentifier:getpid()];
272   -
273   - NSString *webKitFrameworkBundlePath = [[NSBundle bundleForClass:[WebView class]] bundlePath];
274   -
275   - BOOL isWebKit = NO;
276   - if (! [webKitFrameworkBundlePath hasPrefix:@"/System/Library/Frameworks"]) {
277   - // we're not using the system version of WebKit, so it's the WebKit app
278   - isWebKit = YES;
279   - };
280   -
281   - // the following line doesn't seem to work reliably
282   - // BOOL isWebKit = [[[NSProcessInfo processInfo] arguments] containsObject:@"-WebKitDeveloperExtras"];
283   - NSString *appString = @"";
284   - if (isWebKit) {
285   - appString = @"WebKit";
286   - } else {
287   - appString = @"Safari";
288   - }
289   -
290   - NSString *appleScriptSourceString = [NSString stringWithFormat:@"tell application \"%@\"\nURL of current tab of front window\nend tell",appString];
291   -
292   -
293   - // I didn't want to bring OSACrashyScript into this, but I had to; sorry guys, Scripting Bridge
294   - // just totally crashes WebKit and that's unacceptable
295   -
296   - NSDictionary *errorDict = nil;
297   - OSAScript *browserNameScript = [[OSAScript alloc] initWithSource:appleScriptSourceString];
298   - NSAppleEventDescriptor *aeDesc = [browserNameScript executeAndReturnError:&errorDict];
299   - [browserNameScript release];
300   -
301   - NSString *baseURL = nil;
302   -
303   - if (! errorDict) baseURL = [aeDesc stringValue];
304   -
305   - return baseURL;
306   -}
307 197
308   -- (BOOL) _atLeastOneFlashViewExists;
  198 +- (void) unregisterView: (NSView*) view
309 199 {
310   - NSLog(@"%@",[self flashViews]);
311   - return ([[[self flashViews] allKeys] count] >= 1);
  200 + NSHashRemove( _views, view );
312 201 }
313 202
314 203
315   -- (BOOL) _flashViewExistsForKeyWindow;
  204 +- (BOOL) _atLeastOneFlashViewExists
316 205 {
317   - NSString *baseURL = [self _baseURLOfKeyWindow];
318   -
319   - // if there's an array for the base URL, there is at least one view
320   - // with that base URL
321   - return ([[self flashViews] objectForKey:baseURL] != nil);
  206 + return NSCountHashTable( _views ) > 0;
322 207 }
323 208
324   -- (BOOL) _invisibleFlashViewExistsForKeyWindow;
  209 +
  210 +- (BOOL) _flashViewExistsForKeyWindowWithInvisibleOnly: (BOOL) mustBeInvisible
325 211 {
326   - BOOL returnValue = NO;
327   - NSString *baseURL = [self _baseURLOfKeyWindow];
  212 + BOOL rslt = NO;
328 213
329   - NSMutableArray *baseURLArray = [[self flashViews] objectForKey:baseURL];
  214 + NSWindow* keyWindow = [ NSApp keyWindow ];
330 215
331   - if (baseURLArray) {
332   - NSDictionary *currentDictionary = nil;
333   -
334   - for (currentDictionary in baseURLArray) {
335   - NSUInteger height = [[currentDictionary objectForKey:@"height"] intValue];
336   - NSUInteger width = [[currentDictionary objectForKey:@"width"] intValue];
337   -
338   - if ((height <= maxInvisibleDimension) && (width <= maxInvisibleDimension)) {
339   - returnValue = YES;
  216 + NSHashEnumerator enumerator = NSEnumerateHashTable( _views );
  217 + CTFClickToFlashPlugin* item;
  218 + while( item = NSNextHashEnumeratorItem( &enumerator ) ) {
  219 + if( [ item window ] == keyWindow ) {
  220 + if( !mustBeInvisible || [ item isConsideredInvisible ] ) {
  221 + rslt = YES;
340 222 break;
341 223 }
342 224 }
343 225 }
  226 + NSEndHashTableEnumeration( &enumerator );
344 227
345   - return returnValue;
  228 + return rslt;
346 229 }
347 230
348   -- (BOOL)validateMenuItem:(NSMenuItem *)item {
349   - BOOL returnValue = YES;
350   -
351   - if ([item action] == @selector(loadAllFlash:)) {
352   - returnValue = [self _atLeastOneFlashViewExists];
353   - } else if ([item action] == @selector(loadKeyWindowFlash:)) {
354   - returnValue = [self _flashViewExistsForKeyWindow];
355   - } else if ([item action] == @selector(loadKeyWindowInvisibleFlash:)) {
356   - returnValue = [self _invisibleFlashViewExistsForKeyWindow];
  231 +- (BOOL) _flashViewExistsForKeyWindow
  232 +{
  233 + return [ self _flashViewExistsForKeyWindowWithInvisibleOnly: NO ];
  234 +}
  235 +
  236 +- (BOOL) _invisibleFlashViewExistsForKeyWindow;
  237 +{
  238 + return [ self _flashViewExistsForKeyWindowWithInvisibleOnly: YES ];
  239 +}
  240 +
  241 +- (BOOL) validateMenuItem: (NSMenuItem*) item
  242 +{
  243 + if ( [ item action ] == @selector( loadAllFlash: ) ) {
  244 + return [ self _atLeastOneFlashViewExists ];
  245 + }
  246 + else if( [ item action ] == @selector( loadKeyWindowFlash: ) ) {
  247 + return [ self _flashViewExistsForKeyWindow ];
  248 + }
  249 + else if( [ item action ] == @selector(loadKeyWindowInvisibleFlash: ) ) {
  250 + return [ self _invisibleFlashViewExistsForKeyWindow ];
357 251 }
358 252
359   - return returnValue;
  253 + return YES;
360 254 }
361 255
362 256 #pragma mark -
@@ -408,6 +302,4 @@ - (IBAction) showSettingsWindow: (id) sender
408 302 [ _whitelistWindowController showWindow: sender ];
409 303 }
410 304
411   -@synthesize flashViews = _flashViews;
412   -
413 305 @end
10 Plugin/CTFWhitelistWindowController.h
@@ -2,14 +2,8 @@
2 2
3 3
4 4 @interface CTFWhitelistWindowController : NSWindowController {
5   - IBOutlet NSArrayController *_controller;
6   -// NSMutableArray *_sites;
  5 + IBOutlet NSArrayController *_controller;
7 6 }
8   -//
9   -//- (IBAction) addWhitelistSite: (id) sender;
10   -//- (IBAction) removeWhitelistSite: (id) sender;
11   -//
12   -//- (void) saveWhitelist: (id) sender;
13   -//- (void) whitelistChanged: (NSNotification *) note;
  7 +
14 8 @end
15 9
215 Plugin/English.lproj/InvisibleItemMenu.xib
... ... @@ -1,215 +0,0 @@
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
3   - <data>
4   - <int key="IBDocument.SystemTarget">1050</int>
5   - <string key="IBDocument.SystemVersion">9G55</string>
6   - <string key="IBDocument.InterfaceBuilderVersion">667</string>
7   - <string key="IBDocument.AppKitVersion">949.43</string>
8   - <string key="IBDocument.HIToolboxVersion">353.00</string>
9   - <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
10   - <bool key="EncodedWithXMLCoder">YES</bool>
11   - </object>
12   - <object class="NSArray" key="IBDocument.PluginDependencies">
13   - <bool key="EncodedWithXMLCoder">YES</bool>
14   - <string>com.apple.InterfaceBuilderKit</string>
15   - <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
16   - </object>
17   - <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
18   - <bool key="EncodedWithXMLCoder">YES</bool>
19   - <object class="NSCustomObject" id="1001">
20   - <string key="NSClassName">CTFInvisibleItemMenuController</string>
21   - </object>
22   - <object class="NSCustomObject" id="1003">
23   - <string key="NSClassName">FirstResponder</string>
24   - </object>
25   - <object class="NSCustomObject" id="1004">
26   - <string key="NSClassName">NSApplication</string>
27   - </object>
28   - <object class="NSMenuItem" id="866385907">
29   - <string key="NSTitle">ClickToFlash</string>
30   - <string key="NSKeyEquiv"/>
31   - <int key="NSMnemonicLoc">2147483647</int>
32   - <object class="NSCustomResource" key="NSOnImage" id="125481939">
33   - <string key="NSClassName">NSImage</string>
34   - <string key="NSResourceName">NSMenuCheckmark</string>
35   - </object>
36   - <object class="NSCustomResource" key="NSMixedImage" id="211096061">
37   - <string key="NSClassName">NSImage</string>
38   - <string key="NSResourceName">NSMenuMixedState</string>
39   - </object>
40   - <string key="NSAction">submenuAction:</string>
41   - <object class="NSMenu" key="NSSubmenu" id="147427458">
42   - <string key="NSTitle">ClickToFlash</string>
43   - <object class="NSMutableArray" key="NSMenuItems">
44   - <bool key="EncodedWithXMLCoder">YES</bool>
45   - </object>
46   - </object>
47   - </object>
48   - <object class="NSMenuItem" id="729930334">
49   - <string key="NSTitle">Load Invisible Flash Content</string>
50   - <string key="NSKeyEquiv"/>
51   - <int key="NSMnemonicLoc">2147483647</int>
52   - <reference key="NSOnImage" ref="125481939"/>
53   - <reference key="NSMixedImage" ref="211096061"/>
54   - </object>
55   - </object>
56   - <object class="IBObjectContainer" key="IBDocument.Objects">
57   - <object class="NSMutableArray" key="connectionRecords">
58   - <bool key="EncodedWithXMLCoder">YES</bool>
59   - <object class="IBConnectionRecord">
60   - <object class="IBOutletConnection" key="connection">
61   - <string key="label">theMenu</string>
62   - <reference key="source" ref="1001"/>
63   - <reference key="destination" ref="866385907"/>
64   - </object>
65   - <int key="connectionID">12</int>
66   - </object>
67   - <object class="IBConnectionRecord">
68   - <object class="IBActionConnection" key="connection">
69   - <string key="label">loadInvisibleFlashContent:</string>
70   - <reference key="source" ref="1001"/>
71   - <reference key="destination" ref="729930334"/>
72   - </object>
73   - <int key="connectionID">22</int>
74   - </object>
75   - <object class="IBConnectionRecord">
76   - <object class="IBOutletConnection" key="connection">
77   - <string key="label">loadInvisibleContentMenuItem</string>
78   - <reference key="source" ref="1001"/>
79   - <reference key="destination" ref="729930334"/>
80   - </object>
81   - <int key="connectionID">31</int>
82   - </object>
83   - </object>
84   - <object class="IBMutableOrderedSet" key="objectRecords">
85   - <object class="NSArray" key="orderedObjects">
86   - <bool key="EncodedWithXMLCoder">YES</bool>
87   - <object class="IBObjectRecord">
88   - <int key="objectID">0</int>
89   - <object class="NSArray" key="object" id="1002">
90   - <bool key="EncodedWithXMLCoder">YES</bool>
91   - </object>
92   - <reference key="children" ref="1000"/>
93   - <nil key="parent"/>
94   - </object>
95   - <object class="IBObjectRecord">
96   - <int key="objectID">-2</int>
97   - <reference key="object" ref="1001"/>
98   - <reference key="parent" ref="1002"/>
99   - <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
100   - </object>
101   - <object class="IBObjectRecord">
102   - <int key="objectID">-1</int>
103   - <reference key="object" ref="1003"/>
104   - <reference key="parent" ref="1002"/>
105   - <string key="objectName">First Responder</string>
106   - </object>
107   - <object class="IBObjectRecord">
108   - <int key="objectID">-3</int>
109   - <reference key="object" ref="1004"/>
110   - <reference key="parent" ref="1002"/>
111   - <string key="objectName">Application</string>
112   - </object>
113   - <object class="IBObjectRecord">
114   - <int key="objectID">2</int>
115   - <reference key="object" ref="729930334"/>
116   - <reference key="parent" ref="1002"/>
117   - </object>
118   - <object class="IBObjectRecord">
119   - <int key="objectID">8</int>
120   - <reference key="object" ref="866385907"/>
121   - <object class="NSMutableArray" key="children">
122   - <bool key="EncodedWithXMLCoder">YES</bool>
123   - <reference ref="147427458"/>
124   - </object>
125   - <reference key="parent" ref="1002"/>
126   - </object>
127   - <object class="IBObjectRecord">
128   - <int key="objectID">9</int>
129   - <reference key="object" ref="147427458"/>
130   - <reference key="parent" ref="866385907"/>
131   - </object>
132   - </object>
133   - </object>
134   - <object class="NSMutableDictionary" key="flattenedProperties">
135   - <bool key="EncodedWithXMLCoder">YES</bool>
136   - <object class="NSMutableArray" key="dict.sortedKeys">
137   - <bool key="EncodedWithXMLCoder">YES</bool>
138   - <string>-1.IBPluginDependency</string>
139   - <string>-2.IBPluginDependency</string>
140   - <string>-3.IBPluginDependency</string>
141   - <string>2.IBPluginDependency</string>
142   - <string>8.IBPluginDependency</string>
143   - <string>9.IBEditorWindowLastContentRect</string>
144   - <string>9.IBPluginDependency</string>
145   - </object>
146   - <object class="NSMutableArray" key="dict.values">
147   - <bool key="EncodedWithXMLCoder">YES</bool>
148   - <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
149   - <string>com.apple.InterfaceBuilderKit</string>
150   - <string>com.apple.InterfaceBuilderKit</string>
151   - <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
152   - <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
153   - <string>{{330, 521}, {64, 6}}</string>
154   - <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
155   - </object>
156   - </object>
157   - <object class="NSMutableDictionary" key="unlocalizedProperties">
158   - <bool key="EncodedWithXMLCoder">YES</bool>
159   - <object class="NSArray" key="dict.sortedKeys">
160   - <bool key="EncodedWithXMLCoder">YES</bool>
161   - </object>
162   - <object class="NSMutableArray" key="dict.values">
163   - <bool key="EncodedWithXMLCoder">YES</bool>
164   - </object>
165   - </object>
166   - <nil key="activeLocalization"/>
167   - <object class="NSMutableDictionary" key="localizations">
168   - <bool key="EncodedWithXMLCoder">YES</bool>
169   - <object class="NSArray" key="dict.sortedKeys">
170   - <bool key="EncodedWithXMLCoder">YES</bool>
171   - </object>
172   - <object class="NSMutableArray" key="dict.values">
173   - <bool key="EncodedWithXMLCoder">YES</bool>
174   - </object>
175   - </object>
176   - <nil key="sourceID"/>
177   - <int key="maxID">31</int>
178   - </object>
179   - <object class="IBClassDescriber" key="IBDocument.Classes">
180   - <object class="NSMutableArray" key="referencedPartialClassDescriptions">
181   - <bool key="EncodedWithXMLCoder">YES</bool>
182   - <object class="IBPartialClassDescription">
183   - <string key="className">CTFInvisibleItemMenuController</string>
184   - <string key="superclassName">NSObject</string>
185   - <object class="NSMutableDictionary" key="actions">
186   - <string key="NS.key.0">loadInvisibleFlashContent:</string>
187   - <string key="NS.object.0">id</string>
188   - </object>
189   - <object class="NSMutableDictionary" key="outlets">
190   - <bool key="EncodedWithXMLCoder">YES</bool>
191   - <object class="NSMutableArray" key="dict.sortedKeys">
192   - <bool key="EncodedWithXMLCoder">YES</bool>
193   - <string>loadInvisibleContentMenuItem</string>
194   - <string>plugin</string>
195   - <string>theMenu</string>
196   - </object>
197   - <object class="NSMutableArray" key="dict.values">
198   - <bool key="EncodedWithXMLCoder">YES</bool>
199   - <string>NSMenuItem</string>
200   - <string>id</string>
201   - <string>NSMenuItem</string>
202   - </object>
203   - </object>
204   - <object class="IBClassDescriptionSource" key="sourceIdentifier">
205   - <string key="majorKey">IBProjectSource</string>
206   - <string key="minorKey">CTFInvisibleItemMenuController.h</string>
207   - </object>
208   - </object>
209   - </object>
210   - </object>
211   - <int key="IBDocument.localizationMode">0</int>
212   - <string key="IBDocument.LastKnownRelativeProjectPath">../ClickToFlash.xcodeproj</string>
213   - <int key="IBDocument.defaultPropertyAccessControl">3</int>
214   - </data>
215   -</archive>
114 Plugin/English.lproj/WhitelistPanel.xib
@@ -38,7 +38,7 @@
38 38 <object class="NSWindowTemplate" id="1005">
39 39 <int key="NSWindowStyleMask">15</int>
40 40 <int key="NSWindowBacking">2</int>
41   - <string key="NSWindowRect">{{80, 361}, {527, 342}}</string>
  41 + <string key="NSWindowRect">{{80, 343}, {527, 360}}</string>
42 42 <int key="NSWTFlags">-534248448</int>
43 43 <string type="base64-UTF8" key="NSWindowTitle">Q2xpY2sgdG8gRmxhc2gg4oCUIFNldHRpbmdzA</string>
44 44 <string key="NSWindowClass">NSPanel</string>
@@ -89,7 +89,7 @@
89 89 <int key="NSCellFlags">75628032</int>
90 90 <int key="NSCellFlags2">134217728</int>
91 91 <string key="NSContents">Whitelisted Sites</string>
92   - <object class="NSFont" key="NSSupport" id="26">
  92 + <object class="NSFont" key="NSSupport">
93 93 <string key="NSName">LucidaGrande</string>
94 94 <double key="NSSize">1.100000e+01</double>
95 95 <int key="NSfFlags">3100</int>
@@ -204,7 +204,7 @@
204 204 </object>
205 205 <reference ref="929019191"/>
206 206 </object>
207   - <string key="NSFrame">{{20, 47}, {487, 169}}</string>
  207 + <string key="NSFrame">{{20, 41}, {487, 169}}</string>
208 208 <reference key="NSSuperview" ref="1006"/>
209 209 <reference key="NSNextKeyView" ref="769633510"/>
210 210 <int key="NSsFlags">530</int>
@@ -218,14 +218,18 @@
218 218 <object class="NSButton" id="43744226">
219 219 <reference key="NSNextResponder" ref="1006"/>
220 220 <int key="NSvFlags">292</int>
221   - <string key="NSFrame">{{82, 19}, {63, 26}}</string>
  221 + <string key="NSFrame">{{48, 13}, {29, 26}}</string>
222 222 <reference key="NSSuperview" ref="1006"/>
223 223 <bool key="NSEnabled">YES</bool>
224 224 <object class="NSButtonCell" key="NSCell" id="13544439">
225 225 <int key="NSCellFlags">67239424</int>
226 226 <int key="NSCellFlags2">134348800</int>
227   - <string key="NSContents">Remove</string>
228   - <reference key="NSSupport" ref="26"/>
  227 + <string type="base64-UTF8" key="NSContents">4oiSA</string>
  228 + <object class="NSFont" key="NSSupport" id="872573082">
  229 + <string key="NSName">Courier</string>
  230 + <double key="NSSize">1.400000e+01</double>
  231 + <int key="NSfFlags">16</int>
  232 + </object>
229 233 <reference key="NSControlView" ref="43744226"/>
230 234 <int key="NSButtonFlags">-2038284033</int>
231 235 <int key="NSButtonFlags2">162</int>
@@ -238,14 +242,14 @@
238 242 <object class="NSButton" id="241393621">
239 243 <reference key="NSNextResponder" ref="1006"/>
240 244 <int key="NSvFlags">292</int>
241   - <string key="NSFrame">{{20, 19}, {63, 26}}</string>
  245 + <string key="NSFrame">{{20, 13}, {29, 26}}</string>
242 246 <reference key="NSSuperview" ref="1006"/>
243 247 <bool key="NSEnabled">YES</bool>
244 248 <object class="NSButtonCell" key="NSCell" id="811527510">
245 249 <int key="NSCellFlags">67239424</int>
246 250 <int key="NSCellFlags2">134348800</int>
247   - <string key="NSContents">Add</string>
248   - <reference key="NSSupport" ref="26"/>
  251 + <string key="NSContents">+</string>
  252 + <reference key="NSSupport" ref="872573082"/>
249 253 <reference key="NSControlView" ref="241393621"/>
250 254 <int key="NSButtonFlags">-2038284033</int>
251 255 <int key="NSButtonFlags2">162</int>
@@ -258,7 +262,7 @@
258 262 <object class="NSTextField" id="513114676">
259 263 <reference key="NSNextResponder" ref="1006"/>
260 264 <int key="NSvFlags">289</int>
261   - <string key="NSFrame">{{227, 22}, {283, 17}}</string>
  265 + <string key="NSFrame">{{227, 14}, {283, 17}}</string>
262 266 <reference key="NSSuperview" ref="1006"/>
263 267 <bool key="NSEnabled">YES</bool>
264 268 <object class="NSTextFieldCell" key="NSCell" id="363160467">
@@ -284,7 +288,7 @@
284 288 <object class="NSButton" id="619486495">
285 289 <reference key="NSNextResponder" ref="235344690"/>
286 290 <int key="NSvFlags">268</int>
287   - <string key="NSFrame">{{93, 77}, {236, 18}}</string>
  291 + <string key="NSFrame">{{93, 104}, {236, 18}}</string>
288 292 <reference key="NSSuperview" ref="235344690"/>
289 293 <bool key="NSEnabled">YES</bool>
290 294 <object class="NSButtonCell" key="NSCell" id="356052318">
@@ -299,11 +303,11 @@
299 303 <reference key="NSControlView" ref="619486495"/>
300 304 <int key="NSButtonFlags">1211912703</int>
301 305 <int key="NSButtonFlags2">130</int>
302   - <object class="NSCustomResource" key="NSNormalImage">
  306 + <object class="NSCustomResource" key="NSNormalImage" id="1064838318">
303 307 <string key="NSClassName">NSImage</string>
304 308 <string key="NSResourceName">NSSwitch</string>
305 309 </object>
306   - <object class="NSButtonImageSource" key="NSAlternateImage">
  310 + <object class="NSButtonImageSource" key="NSAlternateImage" id="664243181">
307 311 <string key="NSImageName">NSSwitch</string>
308 312 </object>
309 313 <string key="NSAlternateContents"/>
@@ -312,10 +316,32 @@
312 316 <int key="NSPeriodicInterval">25</int>
313 317 </object>
314 318 </object>
  319 + <object class="NSButton" id="90714319">
  320 + <reference key="NSNextResponder" ref="235344690"/>
  321 + <int key="NSvFlags">268</int>
  322 + <string key="NSFrame">{{93, 84}, {271, 18}}</string>
  323 + <reference key="NSSuperview" ref="235344690"/>
  324 + <bool key="NSEnabled">YES</bool>
  325 + <object class="NSButtonCell" key="NSCell" id="688316371">
  326 + <int key="NSCellFlags">-2080244224</int>
  327 + <int key="NSCellFlags2">0</int>
  328 + <string key="NSContents">Automatically load invisible Flash views</string>
  329 + <reference key="NSSupport" ref="906693409"/>
  330 + <reference key="NSControlView" ref="90714319"/>
  331 + <int key="NSButtonFlags">1211912703</int>
  332 + <int key="NSButtonFlags2">130</int>
  333 + <reference key="NSNormalImage" ref="1064838318"/>
  334 + <reference key="NSAlternateImage" ref="664243181"/>
  335 + <string key="NSAlternateContents"/>
  336 + <string key="NSKeyEquivalent"/>
  337 + <int key="NSPeriodicDelay">200</int>
  338 + <int key="NSPeriodicInterval">25</int>
  339 + </object>
  340 + </object>
315 341 <object class="NSTextField" id="972818591">
316 342 <reference key="NSNextResponder" ref="235344690"/>
317 343 <int key="NSvFlags">268</int>
318   - <string key="NSFrame">{{26, 78}, {58, 17}}</string>
  344 + <string key="NSFrame">{{26, 105}, {58, 17}}</string>
319 345 <reference key="NSSuperview" ref="235344690"/>
320 346 <bool key="NSEnabled">YES</bool>
321 347 <object class="NSTextFieldCell" key="NSCell" id="1061234246">
@@ -331,7 +357,7 @@
331 357 <object class="NSMatrix" id="211748724">
332 358 <reference key="NSNextResponder" ref="235344690"/>
333 359 <int key="NSvFlags">268</int>
334   - <string key="NSFrame">{{93, 2}, {285, 58}}</string>
  360 + <string key="NSFrame">{{93, 9}, {285, 58}}</string>
335 361 <reference key="NSSuperview" ref="235344690"/>
336 362 <bool key="NSEnabled">YES</bool>
337 363 <int key="NSNumRows">3</int>
@@ -602,7 +628,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
602 628 <object class="NSTextField" id="1020124743">
603 629 <reference key="NSNextResponder" ref="235344690"/>
604 630 <int key="NSvFlags">268</int>
605   - <string key="NSFrame">{{17, 43}, {67, 17}}</string>
  631 + <string key="NSFrame">{{17, 50}, {67, 17}}</string>
606 632 <reference key="NSSuperview" ref="235344690"/>
607 633 <bool key="NSEnabled">YES</bool>
608 634 <object class="NSTextFieldCell" key="NSCell" id="393278813">
@@ -616,12 +642,12 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
616 642 </object>
617 643 </object>
618 644 </object>
619   - <string key="NSFrame">{{65, 231}, {397, 115}}</string>
  645 + <string key="NSFrame">{{65, 222}, {397, 142}}</string>
620 646 <reference key="NSSuperview" ref="1006"/>
621 647 <string key="NSClassName">NSView</string>
622 648 </object>
623 649 </object>
624   - <string key="NSFrameSize">{527, 342}</string>
  650 + <string key="NSFrameSize">{527, 360}</string>
625 651 <reference key="NSSuperview"/>
626 652 </object>
627 653 <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
@@ -772,6 +798,22 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
772 798 </object>
773 799 <int key="connectionID">130</int>
774 800 </object>
  801 + <object class="IBConnectionRecord">
  802 + <object class="IBBindingConnection" key="connection">
  803 + <string key="label">value: values.ClickToFlash_autoLoadInvisibleViews</string>
  804 + <reference key="source" ref="90714319"/>
  805 + <reference key="destination" ref="913882380"/>
  806 + <object class="NSNibBindingConnector" key="connector">
  807 + <reference key="NSSource" ref="90714319"/>
  808 + <reference key="NSDestination" ref="913882380"/>
  809 + <string key="NSLabel">value: values.ClickToFlash_autoLoadInvisibleViews</string>
  810 + <string key="NSBinding">value</string>
  811 + <string key="NSKeyPath">values.ClickToFlash_autoLoadInvisibleViews</string>
  812 + <int key="NSNibBindingConnectorVersion">2</int>
  813 + </object>
  814 + </object>
  815 + <int key="connectionID">136</int>
  816 + </object>
775 817 </object>
776 818 <object class="IBMutableOrderedSet" key="objectRecords">
777 819 <object class="NSArray" key="orderedObjects">
@@ -818,9 +860,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
818 860 <bool key="EncodedWithXMLCoder">YES</bool>
819 861 <reference ref="510641939"/>
820 862 <reference ref="235344690"/>
821   - <reference ref="43744226"/>
822 863 <reference ref="241393621"/>
823 864 <reference ref="513114676"/>
  865 + <reference ref="43744226"/>
824 866 </object>
825 867 <reference key="parent" ref="1005"/>
826 868 </object>
@@ -922,6 +964,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
922 964 <reference ref="972818591"/>
923 965 <reference ref="211748724"/>
924 966 <reference ref="1020124743"/>
  967 + <reference ref="90714319"/>
925 968 </object>
926 969 <reference key="parent" ref="1006"/>
927 970 </object>
@@ -1013,6 +1056,20 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
1013 1056 <reference key="object" ref="811527510"/>
1014 1057 <reference key="parent" ref="241393621"/>
1015 1058 </object>
  1059 + <object class="IBObjectRecord">
  1060 + <int key="objectID">131</int>
  1061 + <reference key="object" ref="90714319"/>
  1062 + <object class="NSMutableArray" key="children">
  1063 + <bool key="EncodedWithXMLCoder">YES</bool>
  1064 + <reference ref="688316371"/>
  1065 + </object>
  1066 + <reference key="parent" ref="235344690"/>
  1067 + </object>
  1068 + <object class="IBObjectRecord">
  1069 + <int key="objectID">132</int>
  1070 + <reference key="object" ref="688316371"/>
  1071 + <reference key="parent" ref="90714319"/>
  1072 + </object>
1016 1073 </object>
1017 1074 </object>
1018 1075 <object class="NSMutableDictionary" key="flattenedProperties">
@@ -1044,6 +1101,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
1044 1101 <string>114.IBPluginDependency</string>
1045 1102 <string>12.IBPluginDependency</string>
1046 1103 <string>13.IBPluginDependency</string>
  1104 + <string>131.IBAttributePlaceholdersKey</string>
  1105 + <string>131.IBPluginDependency</string>
  1106 + <string>132.IBPluginDependency</string>
1047 1107 <string>14.IBPluginDependency</string>
1048 1108 <string>17.IBPluginDependency</string>
1049 1109 <string>2.IBPluginDependency</string>
@@ -1064,9 +1124,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
1064 1124 <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1065 1125 <string>com.apple.InterfaceBuilderKit</string>
1066 1126 <string>com.apple.InterfaceBuilderKit</string>
1067   - <string>{{38, 380}, {527, 342}}</string>
  1127 + <string>{{46, 1154}, {527, 360}}</string>
1068 1128 <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1069   - <string>{{38, 380}, {527, 342}}</string>
  1129 + <string>{{46, 1154}, {527, 360}}</string>
1070 1130 <integer value="1"/>
1071 1131 <string>{196, 240}</string>
1072 1132 <string>{{202, 428}, {480, 270}}</string>
@@ -1100,6 +1160,16 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
1100 1160 <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1101 1161 <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1102 1162 <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
  1163 + <object class="NSMutableDictionary">
  1164 + <string key="NS.key.0">ToolTip</string>
  1165 + <object class="IBToolTipAttribute" key="NS.object.0">
  1166 + <string key="name">ToolTip</string>
  1167 + <reference key="object" ref="90714319"/>
  1168 + <string key="toolTip">Loads H.264 movie version of YouTube videos by default when possible.</string>
  1169 + </object>
  1170 + </object>
  1171 + <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
  1172 + <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1103 1173 <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1104 1174 <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1105 1175 <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1143,7 +1213,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
1143 1213 </object>
1144 1214 </object>
1145 1215 <nil key="sourceID"/>
1146   - <int key="maxID">130</int>
  1216 + <int key="maxID">136</int>
1147 1217 </object>
1148 1218 <object class="IBClassDescriber" key="IBDocument.Classes">
1149 1219 <object class="NSMutableArray" key="referencedPartialClassDescriptions">
2  Plugin/Plugin.h
@@ -61,4 +61,6 @@ THE SOFTWARE.
61 61 - (IBAction)loadH264:(id)sender;
62 62 - (IBAction)loadAllOnPage:(id)sender;
63 63
  64 +- (BOOL) isConsideredInvisible;
  65 +
64 66 @end
49 Plugin/Plugin.m
@@ -276,28 +276,20 @@ - (id) initWithArguments:(NSDictionary *)arguments
276 276
277 277 // send a notification so that all flash objects can be tracked
278 278
279   - DOMElement *clonedElement = (DOMElement *)[self.container cloneNode:YES];
280   - int height = [[clonedElement getAttribute:@"height"] intValue];
281   - int width = [[clonedElement getAttribute:@"width"] intValue];
282   -
283   - if ([ [ NSUserDefaults standardUserDefaults ] boolForKey: sAutoLoadInvisibleFlashViewsKey ] &&
284   - ((height <= maxInvisibleDimension) && (width <= maxInvisibleDimension) ) ) {
  279 + if ( [ [ NSUserDefaults standardUserDefaults ] boolForKey: sAutoLoadInvisibleFlashViewsKey ]
  280 + && [ self isConsideredInvisible ] ) {
285 281 // auto-loading is on and this view meets the size constraints
286 282 [self _convertTypesForContainer];
287 283 } else {
288 284 // we only want to track it if we don't auto-load it
289   - [[NSNotificationCenter defaultCenter] postNotificationName:sCTFNewViewNotification
290   - object:self
291   - userInfo:[NSDictionary dictionaryWithObjectsAndKeys:base,@"baseURL",src,@"src",
292   - [NSNumber numberWithInt:height],@"height",[NSNumber numberWithInt:width],@"width",nil]
293   - ];
  285 + [[CTFMenubarMenuController sharedController] registerView: self];
294 286 }
295 287
296 288 // Observe various things:
297 289
298 290 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
299 291
300   - // Observe for additions to the whitelist (can't use KVO due to the dot in the pref key):
  292 + // Observe for additions to the whitelist:
301 293 [center addObserver: self
302 294 selector: @selector( _whitelistAdditionMade: )
303 295 name: sCTFWhitelistAdditionMade
@@ -327,11 +319,7 @@ - (void) dealloc
327 319 [self _abortAlert]; // to be on the safe side
328 320
329 321 // notify that this ClickToFlash plugin is going away
330   - [[NSNotificationCenter defaultCenter] postNotificationName:sCTFDestroyedViewNotification
331   - object:self
332   - userInfo:[NSDictionary dictionaryWithObject:[self baseURL]
333   - forKey:@"baseURL"]
334   - ];
  322 + [[CTFMenubarMenuController sharedController] unregisterView: self];
335 323
336 324 self.container = nil;
337 325 self.host = nil;
@@ -487,6 +475,16 @@ - (void) _whitelistAdditionMade: (NSNotification*) notification
487 475 [self _convertTypesForContainer];
488 476 }
489 477
  478 +- (BOOL) isConsideredInvisible
  479 +{
  480 + DOMElement* clonedElement = (DOMElement*) [ self.container cloneNode: NO ];
  481 +
  482 + int height = [[clonedElement getAttribute:@"height"] intValue];
  483 + int width = [[clonedElement getAttribute:@"width"] intValue];
  484 +
  485 + return (height <= maxInvisibleDimension) && (width <= maxInvisibleDimension);
  486 +}
  487 +
490 488 #pragma mark -
491 489 #pragma mark Contextual menu
492 490
@@ -585,14 +583,8 @@ - (void) _loadContentForWindow: (NSNotification*) notification
585 583
586 584 - (void) _loadInvisibleContentForWindow: (NSNotification*) notification
587 585 {
588   - if( [ notification object ] == [ self window ] ) {
589   - DOMElement* clonedElement = (DOMElement*) [ self.container cloneNode: NO ];
590   - int height = [[clonedElement getAttribute:@"height"] intValue];
591   - int width = [[clonedElement getAttribute:@"width"] intValue];
592   -
593   - if ( (height <= maxInvisibleDimension) || (width <= maxInvisibleDimension) ) {
594   - [ self _convertTypesForContainer ];
595   - }
  586 + if( [ notification object ] == [ self window ] && [ self isConsideredInvisible ] ) {
  587 + [ self _convertTypesForContainer ];
596 588 }
597 589 }
598 590
@@ -842,12 +834,7 @@ - (void) _convertTypesForElement:(DOMElement *)element
842 834 - (void) _convertTypesForContainer
843 835 {
844 836 // notify that this ClickToFlash plugin is going away
845   - [[NSNotificationCenter defaultCenter] postNotificationName:sCTFDestroyedViewNotification
846   - object:self
847   - userInfo:[NSDictionary dictionaryWithObject:[self baseURL]
848   - forKey:@"baseURL"]
849   - ];
850   -
  837 + [[CTFMenubarMenuController sharedController] unregisterView: self];
851 838
852 839 if ([self _useH264Version])
853 840 [self _convertToMP4Container];

0 comments on commit 16b844c

Please sign in to comment.
Something went wrong with that request. Please try again.