Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[NEW] Implement WebScripting Protocol for YouTube and Flash Block Det…

…ector. Bump our Flash version from 10.0 r22 to 10.0 r45.
  • Loading branch information...
commit aa05310397e7ffa7b10032254b6347abe226371f 1 parent 918c07c
@rentzsch authored
Showing with 72 additions and 1 deletion.
  1. +3 −1 Plugin/Info-Plugin.plist
  2. +69 −0 Plugin/Plugin.m
View
4 Plugin/Info-Plugin.plist
@@ -30,7 +30,7 @@
<string>http://rentzsch.github.com/clicktoflash/release_notes/appcast.xml</string>
<!--<string>http://rentzsch.github.com/clicktoflash/release_notes/appcast_distantfuture.xml</string>-->
<key>WebPluginDescription</key>
- <string>Shockwave Flash 10.0 r22</string>
+ <string>Shockwave Flash 10.0 r45</string>
<key>WebPluginMIMETypes</key>
<dict>
<key>application/x-shockwave-flash</key>
@@ -45,5 +45,7 @@
</dict>
<key>WebPluginName</key>
<string>Shockwave Flash</string>
+ <key>CTFFlashVariableVersion</key>
+ <string>MAC 10,0,45,2</string>
</dict>
</plist>
View
69 Plugin/Plugin.m
@@ -1127,6 +1127,75 @@ - (void) _removeTrackingAreaForCTF
#pragma mark -
+#pragma mark WebScripting Protocol
+
+- (id)objectForWebScript {
+ //NSLog(@"objectForWebScript => %@", self);
+ return self;
+}
+
++ (NSString *)webScriptNameForSelector:(SEL)aSelector {
+ // javascript may call GetVariable("$version") on us
+
+ NSString *result = nil;
+
+ if (aSelector == @selector(flashGetVariable:))
+ result = @"GetVariable";
+
+ //NSLog(@"webScriptNameForSelector:%@ => %@", NSStringFromSelector(aSelector), result);
+ return result;
+}
+
++ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector {
+ BOOL result = YES;
+
+ if (aSelector == @selector(flashGetVariable:))
+ result = NO;
+
+ //NSLog(@"isSelectorExcludedFromWebScript:%@ => %d", NSStringFromSelector(aSelector), result);
+ return result;
+}
+
+- (id)flashGetVariable:(id)flashVar {
+ static NSString *sFlashVersion = nil;
+ static NSString *sClickToFlashVersion = nil;
+
+ //NSLog(@"flashVar: %p %@", flashVar, flashVar);
+
+ if (flashVar && [flashVar isKindOfClass:[NSString class]]) {
+ if ([flashVar isEqualToString:@"$version"]) {
+ if (sFlashVersion == nil) {
+ NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+ if (bundle) {
+ id version = [bundle objectForInfoDictionaryKey:@"CTFFlashVariableVersion"];
+ if (version && [version isKindOfClass:[NSString class]]) {
+ sFlashVersion = [(NSString *)version copy];
+ }
+ }
+ }
+
+ return sFlashVersion;
+ } else if ([flashVar isEqualToString:@"$ClickToFlashVersion"]) {
+ if (sClickToFlashVersion == nil) {
+ NSBundle *bundle = [NSBundle bundleForClass:[self class]];
+ if (bundle) {
+ id version = [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
+ if (version && [version isKindOfClass:[NSString class]]) {
+ sClickToFlashVersion = [(NSString *)version copy];
+ }
+ }
+ }
+
+ return sClickToFlashVersion;
+ } else {
+ return [self flashvarWithName:flashVar];
+ }
+ }
+
+ return nil;
+}
+
+#pragma mark -
#pragma mark YouTube H.264 support
Please sign in to comment.
Something went wrong with that request. Please try again.