<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[182476] trunk/Tools</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/182476">182476</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2015-04-07 10:07:22 -0700 (Tue, 07 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use content extensions in MiniBrowser.
https://bugs.webkit.org/show_bug.cgi?id=143446
Patch by Sam Weinig <sam@webkit.org> on 2015-04-06
Reviewed by Alex Christensen.
* MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj:
* MiniBrowser/mac/AppDelegate.h:
* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate init]):
(-[BrowserAppDelegate showExtensionsManager:]):
(-[BrowserAppDelegate userContentContoller]):
* MiniBrowser/mac/ExtensionManagerWindowController.h: Added.
* MiniBrowser/mac/ExtensionManagerWindowController.m: Added.
(-[ExtensionManagerWindowController init]):
(-[ExtensionManagerWindowController windowDidLoad]):
(-[ExtensionManagerWindowController add:]):
(-[ExtensionManagerWindowController remove:]):
* MiniBrowser/mac/ExtensionManagerWindowController.xib: Added.
* MiniBrowser/mac/MainMenu.xib:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowserMiniBrowserxcodeprojprojectpbxproj">trunk/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsMiniBrowsermacAppDelegateh">trunk/Tools/MiniBrowser/mac/AppDelegate.h</a></li>
<li><a href="#trunkToolsMiniBrowsermacAppDelegatem">trunk/Tools/MiniBrowser/mac/AppDelegate.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacMainMenuxib">trunk/Tools/MiniBrowser/mac/MainMenu.xib</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsMiniBrowsermacExtensionManagerWindowControllerh">trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.h</a></li>
<li><a href="#trunkToolsMiniBrowsermacExtensionManagerWindowControllerm">trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacExtensionManagerWindowControllerxib">trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.xib</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (182475 => 182476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-04-07 16:32:23 UTC (rev 182475)
+++ trunk/Tools/ChangeLog        2015-04-07 17:07:22 UTC (rev 182476)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-04-06 Sam Weinig <sam@webkit.org>
+
+ Use content extensions in MiniBrowser.
+ https://bugs.webkit.org/show_bug.cgi?id=143446
+
+ Reviewed by Alex Christensen.
+
+ * MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj:
+ * MiniBrowser/mac/AppDelegate.h:
+ * MiniBrowser/mac/AppDelegate.m:
+ (-[BrowserAppDelegate init]):
+ (-[BrowserAppDelegate showExtensionsManager:]):
+ (-[BrowserAppDelegate userContentContoller]):
+ * MiniBrowser/mac/ExtensionManagerWindowController.h: Added.
+ * MiniBrowser/mac/ExtensionManagerWindowController.m: Added.
+ (-[ExtensionManagerWindowController init]):
+ (-[ExtensionManagerWindowController windowDidLoad]):
+ (-[ExtensionManagerWindowController add:]):
+ (-[ExtensionManagerWindowController remove:]):
+ * MiniBrowser/mac/ExtensionManagerWindowController.xib: Added.
+ * MiniBrowser/mac/MainMenu.xib:
+
</ins><span class="cx"> 2015-04-07 Youenn Fablet <youenn.fablet@crf.canon.fr>
</span><span class="cx">
</span><span class="cx"> web-platform-tests server should retrieve the modules file relatively to its docroot path
</span></span></pre></div>
<a id="trunkToolsMiniBrowserMiniBrowserxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj (182475 => 182476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj        2015-04-07 16:32:23 UTC (rev 182475)
+++ trunk/Tools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj        2015-04-07 17:07:22 UTC (rev 182476)
</span><span class="lines">@@ -16,6 +16,8 @@
</span><span class="cx">                 256AC3DA0F4B6AC300CF3369 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* AppDelegate.m */; };
</span><span class="cx">                 2DC37343198B62D300EC33E9 /* SettingsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DC37342198B62D300EC33E9 /* SettingsController.m */; };
</span><span class="cx">                 51E244FA11EFCE07008228D1 /* MBToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 51E244F911EFCE07008228D1 /* MBToolbarItem.m */; };
</span><ins>+                7CA379421AC381C10079DC37 /* ExtensionManagerWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7CA379401AC381C10079DC37 /* ExtensionManagerWindowController.m */; };
+                7CA379431AC381C10079DC37 /* ExtensionManagerWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7CA379411AC381C10079DC37 /* ExtensionManagerWindowController.xib */; };
</ins><span class="cx">                 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
</span><span class="cx">                 BC329487116A92E2008635D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329486116A92E2008635D0 /* main.m */; };
</span><span class="cx">                 BC329498116A941B008635D0 /* WK2BrowserWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC329497116A941B008635D0 /* WK2BrowserWindowController.m */; };
</span><span class="lines">@@ -73,6 +75,9 @@
</span><span class="cx">                 2DC37342198B62D300EC33E9 /* SettingsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SettingsController.m; path = mac/SettingsController.m; sourceTree = "<group>"; };
</span><span class="cx">                 51E244F811EFCE07008228D1 /* MBToolbarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBToolbarItem.h; sourceTree = "<group>"; };
</span><span class="cx">                 51E244F911EFCE07008228D1 /* MBToolbarItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBToolbarItem.m; sourceTree = "<group>"; };
</span><ins>+                7CA3793F1AC381C10079DC37 /* ExtensionManagerWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExtensionManagerWindowController.h; path = mac/ExtensionManagerWindowController.h; sourceTree = "<group>"; };
+                7CA379401AC381C10079DC37 /* ExtensionManagerWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ExtensionManagerWindowController.m; path = mac/ExtensionManagerWindowController.m; sourceTree = "<group>"; };
+                7CA379411AC381C10079DC37 /* ExtensionManagerWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ExtensionManagerWindowController.xib; path = mac/ExtensionManagerWindowController.xib; sourceTree = "<group>"; };
</ins><span class="cx">                 8D1107320486CEB800E47090 /* MiniBrowser.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MiniBrowser.app; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">                 BC329486116A92E2008635D0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = mac/main.m; sourceTree = "<group>"; };
</span><span class="cx">                 BC329496116A941B008635D0 /* WK2BrowserWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WK2BrowserWindowController.h; path = mac/WK2BrowserWindowController.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -114,16 +119,18 @@
</span><span class="cx">                                 256AC3D90F4B6AC300CF3369 /* AppDelegate.m */,
</span><span class="cx">                                 0FE6439F161FA8940059E3FF /* BrowserWindowController.h */,
</span><span class="cx">                                 0FE643A0161FA8940059E3FF /* BrowserWindowController.m */,
</span><ins>+                                7CA3793F1AC381C10079DC37 /* ExtensionManagerWindowController.h */,
+                                7CA379401AC381C10079DC37 /* ExtensionManagerWindowController.m */,
</ins><span class="cx">                                 BC72B89A11E57E8A001EB4EA /* Info.plist */,
</span><span class="cx">                                 BC329486116A92E2008635D0 /* main.m */,
</span><span class="cx">                                 51E244F811EFCE07008228D1 /* MBToolbarItem.h */,
</span><span class="cx">                                 51E244F911EFCE07008228D1 /* MBToolbarItem.m */,
</span><ins>+                                2DC37341198B62D300EC33E9 /* SettingsController.h */,
+                                2DC37342198B62D300EC33E9 /* SettingsController.m */,
</ins><span class="cx">                                 0FE643A2161FAC660059E3FF /* WK1BrowserWindowController.h */,
</span><span class="cx">                                 0FE643A3161FAC660059E3FF /* WK1BrowserWindowController.m */,
</span><span class="cx">                                 BC329496116A941B008635D0 /* WK2BrowserWindowController.h */,
</span><span class="cx">                                 BC329497116A941B008635D0 /* WK2BrowserWindowController.m */,
</span><del>-                                2DC37341198B62D300EC33E9 /* SettingsController.h */,
-                                2DC37342198B62D300EC33E9 /* SettingsController.m */,
</del><span class="cx">                         );
</span><span class="cx">                         name = MiniBrowser;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -187,6 +194,7 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 BC3294A2116A9852008635D0 /* BrowserWindow.xib */,
</span><span class="cx">                                 1DDD58150DA1D0A300B32029 /* MainMenu.xib */,
</span><ins>+                                7CA379411AC381C10079DC37 /* ExtensionManagerWindowController.xib */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = Resources;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -303,6 +311,7 @@
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><span class="cx">                                 BC72B89611E57E0F001EB4EA /* BrowserWindow.xib in Resources */,
</span><ins>+                                7CA379431AC381C10079DC37 /* ExtensionManagerWindowController.xib in Resources */,
</ins><span class="cx">                                 BC72B89511E57E07001EB4EA /* MainMenu.xib in Resources */,
</span><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="lines">@@ -325,6 +334,7 @@
</span><span class="cx">                                 256AC3DA0F4B6AC300CF3369 /* AppDelegate.m in Sources */,
</span><span class="cx">                                 0FE643A1161FA8940059E3FF /* BrowserWindowController.m in Sources */,
</span><span class="cx">                                 2DC37343198B62D300EC33E9 /* SettingsController.m in Sources */,
</span><ins>+                                7CA379421AC381C10079DC37 /* ExtensionManagerWindowController.m in Sources */,
</ins><span class="cx">                                 BC329487116A92E2008635D0 /* main.m in Sources */,
</span><span class="cx">                                 51E244FA11EFCE07008228D1 /* MBToolbarItem.m in Sources */,
</span><span class="cx">                                 0FE643A4161FAC660059E3FF /* WK1BrowserWindowController.m in Sources */,
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacAppDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.h (182475 => 182476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/AppDelegate.h        2015-04-07 16:32:23 UTC (rev 182475)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.h        2015-04-07 17:07:22 UTC (rev 182476)
</span><span class="lines">@@ -23,8 +23,13 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+@class ExtensionManagerWindowController;
+
</ins><span class="cx"> @interface BrowserAppDelegate : NSObject <NSApplicationDelegate> {
</span><span class="cx"> NSMutableSet *_browserWindowControllers;
</span><ins>+#if WK_API_ENABLED
+ ExtensionManagerWindowController *_extensionManagerWindowController;
+#endif
</ins><span class="cx">
</span><span class="cx"> IBOutlet NSMenuItem *_newWebKit1WindowItem;
</span><span class="cx"> IBOutlet NSMenuItem *_newWebKit2WindowItem;
</span><span class="lines">@@ -34,4 +39,8 @@
</span><span class="cx">
</span><span class="cx"> - (void)didChangeSettings;
</span><span class="cx">
</span><ins>+#if WK_API_ENABLED
+@property (readonly) WKUserContentController *userContentContoller;
+#endif
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacAppDelegatem"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.m (182475 => 182476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/AppDelegate.m        2015-04-07 16:32:23 UTC (rev 182475)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.m        2015-04-07 17:07:22 UTC (rev 182476)
</span><span class="lines">@@ -25,14 +25,17 @@
</span><span class="cx">
</span><span class="cx"> #import "AppDelegate.h"
</span><span class="cx">
</span><ins>+#import "ExtensionManagerWindowController.h"
</ins><span class="cx"> #import "SettingsController.h"
</span><span class="cx"> #import "WK1BrowserWindowController.h"
</span><span class="cx"> #import "WK2BrowserWindowController.h"
</span><span class="cx"> #import <WebKit/WKPreferencesPrivate.h>
</span><span class="cx"> #import <WebKit/WKProcessPoolPrivate.h>
</span><ins>+#import <WebKit/WKUserContentControllerPrivate.h>
</ins><span class="cx"> #import <WebKit/WKWebViewConfigurationPrivate.h>
</span><span class="cx"> #import <WebKit/WebKit.h>
</span><span class="cx"> #import <WebKit/_WKProcessPoolConfiguration.h>
</span><ins>+#import <WebKit/_WKUserContentExtensionStore.h>
</ins><span class="cx"> #import <WebKit/_WKWebsiteDataStore.h>
</span><span class="cx">
</span><span class="cx"> enum {
</span><span class="lines">@@ -47,6 +50,9 @@
</span><span class="cx"> self = [super init];
</span><span class="cx"> if (self) {
</span><span class="cx"> _browserWindowControllers = [[NSMutableSet alloc] init];
</span><ins>+#if WK_API_ENABLED
+ _extensionManagerWindowController = [[ExtensionManagerWindowController alloc] init];
+#endif
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return self;
</span><span class="lines">@@ -211,4 +217,18 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (IBAction)showExtensionsManager:(id)sender
+{
+#if WK_API_ENABLED
+ [_extensionManagerWindowController showWindow:sender];
+#endif
+}
+
+#if WK_API_ENABLED
+- (WKUserContentController *)userContentContoller
+{
+ return defaultConfiguration().userContentController;
+}
+#endif
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacExtensionManagerWindowControllerh"></a>
<div class="addfile"><h4>Added: trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.h (0 => 182476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.h         (rev 0)
+++ trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.h        2015-04-07 17:07:22 UTC (rev 182476)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+#if WK_API_ENABLED
+
+@interface ExtensionManagerWindowController : NSWindowController {
+ IBOutlet NSArrayController *arrayController;
+}
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkToolsMiniBrowsermacExtensionManagerWindowControllerm"></a>
<div class="addfile"><h4>Added: trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.m (0 => 182476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.m         (rev 0)
+++ trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.m        2015-04-07 17:07:22 UTC (rev 182476)
</span><span class="lines">@@ -0,0 +1,143 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "ExtensionManagerWindowController.h"
+
+#if WK_API_ENABLED
+
+#import "AppDelegate.h"
+#import <WebKit/WKUserContentControllerPrivate.h>
+#import <WebKit/_WKUserContentExtensionStore.h>
+
+@implementation ExtensionManagerWindowController
+
+- (instancetype)init
+{
+ self = [self initWithWindowNibName:@"ExtensionManagerWindowController"];
+ if (self) {
+ NSArray* installedContentExtensions = [[NSUserDefaults standardUserDefaults] arrayForKey:@"InstalledContentExtensions"];
+ if (installedContentExtensions) {
+ for (NSString *identifier in installedContentExtensions) {
+ [[_WKUserContentExtensionStore defaultStore] lookupContentExtensionForIdentifier:identifier completionHandler:^(_WKUserContentFilter *extension, NSError *error)
+ {
+ if (error) {
+ NSLog(@"Extension store got out of sync with system defaults.");
+ return;
+ }
+
+ BrowserAppDelegate* appDelegate = (BrowserAppDelegate *)[[NSApplication sharedApplication] delegate];
+ [appDelegate.userContentContoller _addUserContentFilter:extension];
+ }];
+ }
+
+ }
+ }
+ return self;
+}
+
+- (void)windowDidLoad
+{
+ [super windowDidLoad];
+
+ NSArray* installedContentExtensions = [[NSUserDefaults standardUserDefaults] arrayForKey:@"InstalledContentExtensions"];
+ if (installedContentExtensions) {
+ for (NSString *extension in installedContentExtensions)
+ [arrayController addObject:extension];
+ }
+}
+
+- (IBAction)add:(id)sender
+{
+ NSOpenPanel *openPanel = [[NSOpenPanel openPanel] retain];
+ openPanel.allowedFileTypes = @[ @"public.json" ];
+
+ [openPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
+ {
+ if (result != NSFileHandlingPanelOKButton)
+ return;
+
+ NSURL *url = [openPanel.URLs objectAtIndex:0];
+ NSString *identifier = url.lastPathComponent;
+ NSString *jsonString = [[NSString alloc] initWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
+
+ [[_WKUserContentExtensionStore defaultStore] compileContentExtensionForIdentifier:identifier encodedContentExtension:jsonString completionHandler:^(_WKUserContentFilter *extension, NSError *error)
+ {
+
+ if (error) {
+ NSAlert *alert = [NSAlert alertWithError:error];
+ [alert runModal];
+ return;
+ }
+
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
+ NSArray* installedContentExtensions = [defaults arrayForKey:@"InstalledContentExtensions"];
+ NSMutableArray *mutableInstalledContentExtensions;
+ if (installedContentExtensions)
+ mutableInstalledContentExtensions = [installedContentExtensions mutableCopy];
+ else
+ mutableInstalledContentExtensions = [[NSMutableArray alloc] init];
+
+ [mutableInstalledContentExtensions addObject:identifier];
+ [defaults setObject:mutableInstalledContentExtensions forKey:@"InstalledContentExtensions"];
+
+ [arrayController addObject:identifier];
+
+ BrowserAppDelegate* appDelegate = (BrowserAppDelegate *)[[NSApplication sharedApplication] delegate];
+ [appDelegate.userContentContoller _addUserContentFilter:extension];
+ }];
+ }];
+
+}
+
+- (IBAction)remove:(id)sender
+{
+ NSUInteger index = [arrayController selectionIndex];
+
+ NSString *identifierToRemove = arrayController.arrangedObjects[index];
+
+ [[_WKUserContentExtensionStore defaultStore] removeContentExtensionForIdentifier:identifierToRemove completionHandler:^(NSError *error)
+ {
+ if (error) {
+ NSAlert *alert = [NSAlert alertWithError:error];
+ [alert runModal];
+ return;
+ }
+
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
+ NSMutableArray *installedContentExtensions = [[defaults arrayForKey:@"InstalledContentExtensions"] mutableCopy];
+ [installedContentExtensions removeObject:identifierToRemove];
+ [defaults setObject:installedContentExtensions forKey:@"InstalledContentExtensions"];
+
+ [arrayController removeObjectAtArrangedObjectIndex:index];
+ BrowserAppDelegate* appDelegate = (BrowserAppDelegate *)[[NSApplication sharedApplication] delegate];
+ [appDelegate.userContentContoller _removeUserContentFilter:identifierToRemove];
+ }];
+}
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkToolsMiniBrowsermacExtensionManagerWindowControllerxib"></a>
<div class="addfile"><h4>Added: trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.xib (0 => 182476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.xib         (rev 0)
+++ trunk/Tools/MiniBrowser/mac/ExtensionManagerWindowController.xib        2015-04-07 17:07:22 UTC (rev 182476)
</span><span class="lines">@@ -0,0 +1,147 @@
</span><ins>+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13F1076" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="ExtensionManagerWindowController">
+ <connections>
+ <outlet property="arrayController" destination="xeI-l9-8Xv" id="O8f-gY-5FH"/>
+ <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <window title="Extensions Manager" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" unifiedTitleAndToolbar="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="196" y="240" width="480" height="270"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
+ <view key="contentView" id="se5-gp-TjO">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3Ps-vx-3Rj">
+ <rect key="frame" x="20" y="58" width="440" height="192"/>
+ <clipView key="contentView" id="228-qF-Rc1">
+ <rect key="frame" x="1" y="1" width="438" height="190"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="mmd-0v-4hR">
+ <rect key="frame" x="0.0" y="0.0" width="438" height="190"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <size key="intercellSpacing" width="3" height="2"/>
+ <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+ <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+ <tableColumns>
+ <tableColumn width="435" minWidth="40" maxWidth="1000" id="6PD-e9-GfD">
+ <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
+ <font key="font" metaFont="smallSystem"/>
+ <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
+ </tableHeaderCell>
+ <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="Sq0-um-maR">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+ <prototypeCellViews>
+ <tableCellView id="R3S-7i-hkn">
+ <rect key="frame" x="1" y="1" width="435" height="17"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DqA-Ee-O6f">
+ <rect key="frame" x="0.0" y="0.0" width="434" height="17"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Table View Cell" id="syf-BT-XBf">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <connections>
+ <binding destination="R3S-7i-hkn" name="value" keyPath="objectValue" id="uwA-wN-TwE"/>
+ </connections>
+ </textField>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="bottom" secondItem="DqA-Ee-O6f" secondAttribute="bottom" id="Eob-Am-Ity"/>
+ <constraint firstItem="DqA-Ee-O6f" firstAttribute="leading" secondItem="R3S-7i-hkn" secondAttribute="leading" constant="2" id="acg-V8-jUr"/>
+ <constraint firstAttribute="trailing" secondItem="DqA-Ee-O6f" secondAttribute="trailing" constant="2" id="gTj-qL-A7r"/>
+ <constraint firstItem="DqA-Ee-O6f" firstAttribute="top" secondItem="R3S-7i-hkn" secondAttribute="top" id="lKF-M8-hn7"/>
+ </constraints>
+ <connections>
+ <outlet property="textField" destination="DqA-Ee-O6f" id="cpI-Wh-atT"/>
+ </connections>
+ </tableCellView>
+ </prototypeCellViews>
+ </tableColumn>
+ </tableColumns>
+ <connections>
+ <binding destination="xeI-l9-8Xv" name="content" keyPath="arrangedObjects" id="paH-6b-cxM"/>
+ <binding destination="xeI-l9-8Xv" name="selectionIndexes" keyPath="selectionIndexes" previousBinding="paH-6b-cxM" id="NDp-MB-3u8"/>
+ </connections>
+ </tableView>
+ </subviews>
+ <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </clipView>
+ <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="iTc-lE-Pk6">
+ <rect key="frame" x="1" y="119" width="223" height="15"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </scroller>
+ <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="ak3-QY-AvJ">
+ <rect key="frame" x="224" y="17" width="15" height="102"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </scroller>
+ </scrollView>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="27H-8l-ZRr">
+ <rect key="frame" x="20" y="21" width="21" height="21"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="21" id="Kv9-Ra-5xj"/>
+ <constraint firstAttribute="height" constant="19" id="Nmn-14-1ea"/>
+ </constraints>
+ <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSAddTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="6T3-fu-laO">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="add:" target="-2" id="nIg-iE-xaG"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="i46-AU-g9W">
+ <rect key="frame" x="40" y="21" width="21" height="21"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="21" id="ECG-hI-EML"/>
+ <constraint firstAttribute="height" constant="19" id="b3A-2I-fDc"/>
+ </constraints>
+ <buttonCell key="cell" type="smallSquare" bezelStyle="smallSquare" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="gfs-sY-cBN">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="remove:" target="-2" id="BOW-Fc-AGp"/>
+ <binding destination="xeI-l9-8Xv" name="enabled" keyPath="canRemove" id="pp1-d7-6Gd"/>
+ </connections>
+ </button>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="bottom" secondItem="3Ps-vx-3Rj" secondAttribute="bottom" constant="58" id="Nej-YX-BMe"/>
+ <constraint firstItem="i46-AU-g9W" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="40" id="SQS-4J-NJE"/>
+ <constraint firstAttribute="bottom" secondItem="i46-AU-g9W" secondAttribute="bottom" constant="22" id="Tri-yU-fA4"/>
+ <constraint firstItem="27H-8l-ZRr" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" id="URC-fD-No6"/>
+ <constraint firstItem="3Ps-vx-3Rj" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="20" id="Udm-Eg-Fmx"/>
+ <constraint firstAttribute="bottom" secondItem="27H-8l-ZRr" secondAttribute="bottom" constant="22" id="gVG-YX-oeX"/>
+ <constraint firstAttribute="trailing" secondItem="3Ps-vx-3Rj" secondAttribute="trailing" constant="20" id="ggD-nm-PDi"/>
+ <constraint firstItem="3Ps-vx-3Rj" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" id="qiw-wC-igh"/>
+ </constraints>
+ </view>
+ <connections>
+ <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+ </connections>
+ </window>
+ <arrayController id="xeI-l9-8Xv"/>
+ </objects>
+ <resources>
+ <image name="NSAddTemplate" width="8" height="8"/>
+ <image name="NSRemoveTemplate" width="8" height="8"/>
+ </resources>
+</document>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacMainMenuxib"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/MainMenu.xib (182475 => 182476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/MainMenu.xib        2015-04-07 16:32:23 UTC (rev 182475)
+++ trunk/Tools/MiniBrowser/mac/MainMenu.xib        2015-04-07 17:07:22 UTC (rev 182476)
</span><span class="lines">@@ -475,6 +475,13 @@
</span><span class="cx"> <action selector="fetchAndClearWebsiteData:" target="-1" id="R06-l2-tP0"/>
</span><span class="cx"> </connections>
</span><span class="cx"> </menuItem>
</span><ins>+ <menuItem isSeparatorItem="YES" id="uef-kb-r9n"/>
+ <menuItem title="Show Extensions Manager" keyEquivalent="m" id="2f0-pH-KRx">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="showExtensionsManager:" target="-1" id="iyL-17-sLo"/>
+ </connections>
+ </menuItem>
</ins><span class="cx"> </items>
</span><span class="cx"> </menu>
</span><span class="cx"> </menuItem>
</span></span></pre>
</div>
</div>
</body>
</html>