[WebEditingTester] Allow dropping HTML files on the app
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Feb 2015 20:10:35 +0000 (20:10 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Feb 2015 20:10:35 +0000 (20:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141834

Reviewed by Simon Fraser.

* WebEditingTester/AppDelegate.m:
(-[WebEditingAppDelegate openDocument:]):
(-[WebEditingAppDelegate application:openFile:]):
Implement application:openFile:, factoring file loading code out of openDocument.

* WebEditingTester/Info.plist:
Register as an editor for HTML files.

* WebEditingTester/WebEditingTester.xcodeproj/project.pbxproj:
Enrica is not an organization.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180443 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/WebEditingTester/AppDelegate.m
Tools/WebEditingTester/Info.plist
Tools/WebEditingTester/WebEditingTester.xcodeproj/project.pbxproj

index ba5c772fbedc0582213600a95eae15e229b67451..de6cec7f6805612313274b49b875f10e37ad9aba 100644 (file)
@@ -1,3 +1,21 @@
+2015-02-20  Timothy Horton  <timothy_horton@apple.com>
+
+        [WebEditingTester] Allow dropping HTML files on the app
+        https://bugs.webkit.org/show_bug.cgi?id=141834
+
+        Reviewed by Simon Fraser.
+
+        * WebEditingTester/AppDelegate.m:
+        (-[WebEditingAppDelegate openDocument:]):
+        (-[WebEditingAppDelegate application:openFile:]):
+        Implement application:openFile:, factoring file loading code out of openDocument.
+
+        * WebEditingTester/Info.plist:
+        Register as an editor for HTML files.
+
+        * WebEditingTester/WebEditingTester.xcodeproj/project.pbxproj:
+        Enrica is not an organization.
+
 2015-02-20  Timothy Horton  <timothy_horton@apple.com>
 
         [WebEditingTester] Expand "WK" to "WebKit" in a few places
index 37261c46fec323d213df17be384409af344024ec..09692330927aa050d97dc469cce6fc0804775d97 100644 (file)
@@ -183,13 +183,22 @@ static NSString * const UseWebKit2ByDefaultPreferenceKey = @"UseWebKit2ByDefault
         if (result != NSFileHandlingPanelOKButton)
             return;
 
-        WebDocumentController *controller = [[_openingDocumentController alloc] init];
-        [controller.window makeKeyAndOrderFront:nil];
-        [_webDocuments addObject:controller];
-        [controller loadHTMLString:[NSString stringWithContentsOfURL:panel.URLs.lastObject encoding:NSUTF8StringEncoding error:nil]];
+        NSURL *URL = panel.URLs.lastObject;
+        [self application:[NSApplication sharedApplication] openFile:URL.path];
+        _openingDocumentController = nil;
     }];
 }
 
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
+{
+    Class controllerClass = _openingDocumentController ? _openingDocumentController : self._defaultWebDocumentControllerClass;
+    WebDocumentController *controller = [[controllerClass alloc] init];
+    [controller.window makeKeyAndOrderFront:nil];
+    [_webDocuments addObject:controller];
+    [controller loadHTMLString:[NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:nil]];
+    return YES;
+}
+
 - (void)_updateNewWindowKeyEquivalents
 {
     if (self.useWebKit2ByDefault) {
index f4ec3460ff048422bdf6d1a9db01fac7e9610039..8964dacc7f2e9e1f4b0026591482190669e44c8f 100644 (file)
@@ -4,6 +4,23 @@
 <dict>
        <key>CFBundleDevelopmentRegion</key>
        <string>en</string>
+       <key>CFBundleDocumentTypes</key>
+       <array>
+               <dict>
+                       <key>CFBundleTypeExtensions</key>
+                       <array>
+                               <string>html</string>
+                       </array>
+                       <key>CFBundleTypeMIMETypes</key>
+                       <array>
+                               <string>text/html</string>
+                       </array>
+                       <key>CFBundleTypeName</key>
+                       <string>HTML</string>
+                       <key>CFBundleTypeRole</key>
+                       <string>Editor</string>
+               </dict>
+       </array>
        <key>CFBundleExecutable</key>
        <string>$(EXECUTABLE_NAME)</string>
        <key>CFBundleIconFile</key>
index d801a42b0b3a31a79757c5f33dd1a6c8bf8d443c..97d4cc26ec5543a1ef237c7dde34d00b2dc2b5a5 100644 (file)
                        isa = PBXProject;
                        attributes = {
                                LastUpgradeCheck = 0700;
-                               ORGANIZATIONNAME = "Enrica Casucci";
                                TargetAttributes = {
                                        C558CDAB1A92D6900059A907 = {
                                                CreatedOnToolsVersion = 7.0;