Revision: 7941
Author: [email protected]
Date: Mon Apr 19 08:17:29 2010
Log: Have the WebKit development mode plugin touch a file to tell the local GoogleSoftwareUpdate agent that the plugin has been used.
Patch by: bobv
Review by: knorton

http://code.google.com/p/google-web-toolkit/source/detail?r=7941

Modified:
 /trunk/plugins/webkit/Plugin/OophmPlugin.mm

=======================================
--- /trunk/plugins/webkit/Plugin/OophmPlugin.mm Mon Nov 23 13:36:18 2009
+++ /trunk/plugins/webkit/Plugin/OophmPlugin.mm Mon Apr 19 08:17:29 2010
@@ -18,6 +18,11 @@
 #import "OophmWebScriptObject.h"
 #import "SlowScriptProxy.h"

+...@interface OophmPlugin (Private)
+/* Tell GoogleSoftwareUpdate the plugin is being used */
+- (void)recordActive;
+...@end
+
 @implementation OophmPlugin
 + (NSView *)plugInViewWithArguments:(NSDictionary *)arguments {
   return [[[OophmPlugin alloc] initWithArguments: arguments] autorelease];
@@ -50,7 +55,9 @@
if ([_slowScriptProxy respondsToSelector:@selector(webView:setStatusText:)]) { [_slowScriptProxy webView:view setStatusText:@"GWT Developer Plugin Active"];
   }
-
+
+  [self recordActive];
+
   return self;
 }

@@ -71,3 +78,31 @@
   _slowScriptProxy = nil;
 }
 @end
+
+...@implementation OophmPlugin (Private)
+// Touch a file in ~/Library/Google/GoogleSoftwareUpdate/Actives
+- (void)recordActive {
+  NSFileManager* manager = [[NSFileManager alloc] init];
+  [manager autorelease];
+  NSError* error = NULL;
+
+ NSString* activesDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Google/GoogleSoftwareUpdate/Actives"]; + Debug::log(Debug::Info) << "Ensuring directory " << [activesDirectory UTF8String] << Debug::flush; + if (![manager createDirectoryAtPath:activesDirectory withIntermediateDirectories:YES attributes:nil error:&error]) { + Debug::log(Debug::Error) << "Unable to create actives directory " << [activesDirectory UTF8String] <<
+        ": " << [[error localizedDescription] UTF8String] << Debug::flush;
+    return;
+  }
+
+  // Add the product id
+ NSString* file = [activesDirectory stringByAppendingPathComponent:@"com.google.gwt.dev.plugin.safari"];
+
+  // Create an empty file using an empty NSData object
+ if (![manager createFileAtPath:file contents:[NSData data] attributes:nil]) { + Debug::log(Debug::Error) << "Unable to create actives file" << Debug::flush;
+    return;
+  }
+
+ Debug::log(Debug::Info) << "Created actives file " << [file UTF8String] << Debug::flush;
+}
+...@end

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to