Permalink
Browse files

commit all the changes; we are in git not mercurial, doh!

  • Loading branch information...
1 parent f3c7058 commit 28a528d9e53cdb2ceb5decbc57c4d47d4fe0c86a @azinman azinman committed Apr 12, 2011
Showing with 30 additions and 2,653 deletions.
  1. +3 −0 .gitignore
  2. +12 −12 safari-extension-mac/DepthJS.safariextension/Info.plist
  3. +7 −7 safari-extension-mac/DepthJS.safariextension/background.html
  4. +0 −184 safari-extension-mac/DepthJS.safariextension/background/backend.js
  5. +0 −52 safari-extension-mac/DepthJS.safariextension/background/message_routing.js
  6. +0 −80 safari-extension-mac/DepthJS.safariextension/background/root.js
  7. +0 −18 safari-extension-mac/DepthJS.safariextension/background/tabs.js
  8. +0 −84 safari-extension-mac/DepthJS.safariextension/background/test.js
  9. +0 −107 safari-extension-mac/DepthJS.safariextension/content_script/depthose.js
  10. +0 −174 safari-extension-mac/DepthJS.safariextension/content_script/event_handlers.js
  11. +0 −26 safari-extension-mac/DepthJS.safariextension/content_script/event_link.js
  12. +0 −35 safari-extension-mac/DepthJS.safariextension/content_script/init.js
  13. +0 −66 safari-extension-mac/DepthJS.safariextension/content_script/panner.js
  14. +0 −68 safari-extension-mac/DepthJS.safariextension/content_script/root.js
  15. +0 −183 safari-extension-mac/DepthJS.safariextension/content_script/selector_box.js
  16. +0 −65 safari-extension-mac/DepthJS.safariextension/css/selectorBox.css
  17. BIN safari-extension-mac/DepthJS.safariextension/images/logo_128x128.png
  18. BIN safari-extension-mac/DepthJS.safariextension/images/logo_16x16.png
  19. +0 −376 safari-extension-mac/DepthJS.safariextension/old_background.html
  20. +0 −495 safari-extension-mac/DepthJS.safariextension/old_content_script.js
  21. +0 −167 safari-extension-mac/DepthJS.safariextension/third_party/jquery-1.4.4.min.js
  22. +0 −24 safari-extension-mac/DepthJS.safariextension/third_party/underscore-min.js
  23. +0 −62 safari-extension-mac/DepthJS.safariextension/third_party/vfx/zflow/zflow.css
  24. +0 −357 safari-extension-mac/DepthJS.safariextension/third_party/vfx/zflow/zflow.js
  25. +6 −4 webkit-plugin-mac/gesture_engine.cpp
  26. +1 −1 webkit-plugin-mac/gesture_engine.hpp
  27. +0 −4 webkit-plugin-mac/webkit-plugin-mac.xcodeproj/project.pbxproj
  28. +1 −2 webkit-plugin-mac/webkit_plugin_macView.mm
View
@@ -11,6 +11,7 @@ build/*
*.pbxuser
*.mode1v3
*.perspectivev3
+webkit-plugin-mac/build
# old skool
.svn
@@ -19,3 +20,5 @@ build/*
.DS_Store
profile
+# common extension hard links
+safari-extension-mac/DepthJS.safariextension/extension-common
@@ -42,23 +42,23 @@
<dict>
<key>Start</key>
<array>
- <string>third_party/jquery-1.4.4.min.js</string>
- <string>third_party/underscore-min.js</string>
- <string>content_script/root.js</string>
+ <string>extension-common/third_party/jquery-1.4.4.min.js</string>
+ <string>extension-common/third_party/underscore-min.js</string>
+ <string>extension-common/background/root.js</string>
<string>safari.js</string>
- <string>content_script/event_link.js</string>
- <string>content_script/event_handlers.js</string>
- <string>content_script/depthose.js</string>
- <string>content_script/panner.js</string>
- <string>content_script/selector_box.js</string>
- <string>third_party/vfx/zflow/zflow.js</string>
- <string>content_script/init.js</string>
+ <string>extension-common/content_script/event_link.js</string>
+ <string>extension-common/content_script/event_handlers.js</string>
+ <string>extension-common/content_script/depthose.js</string>
+ <string>extension-common/content_script/panner.js</string>
+ <string>extension-common/content_script/selector_box.js</string>
+ <string>extension-common/third_party/vfx/zflow/zflow.js</string>
+ <string>extension-common/content_script/init.js</string>
</array>
</dict>
<key>Stylesheets</key>
<array>
- <string>third_party/vfx/zflow/zflow.css</string>
- <string>css/selectorBox.css</string>
+ <string>extension-common/third_party/vfx/zflow/zflow.css</string>
+ <string>extension-common/css/selectorBox.css</string>
</array>
</dict>
<key>Description</key>
@@ -1,11 +1,11 @@
<html><head>
-<script src="third_party/jquery-1.4.4.min.js"></script>
-<script src="third_party/underscore-min.js"></script>
-<script src="background/root.js"></script>
-<script src="background/backend.js"></script>
-<script src="background/tabs.js"></script>
-<script src="background/test.js"></script>
-<script src="background/message_routing.js"></script>
+<script src="extension-common/third_party/jquery-1.4.4.min.js"></script>
+<script src="extension-common/third_party/underscore-min.js"></script>
+<script src="extension-common/background/root.js"></script>
+<script src="extension-common/background/backend.js"></script>
+<script src="extension-common/background/tabs.js"></script>
+<script src="extension-common/background/test.js"></script>
+<script src="extension-common/background/message_routing.js"></script>
<script src="safari.js"></script>
</head>
@@ -1,184 +0,0 @@
-var WS_CONNECTING = 0;
-var WS_OPEN = 1;
-var WS_CLOSING = 2;
-var WS_CLOSED = 3;
-
-// WEB SOCKETS BASED BACKEND -----------------------------------------------------------------------
-
-DepthJS.wsBackend = {};
-
-DepthJS.wsBackend.eventWs = null;
-DepthJS.wsBackend.imageWs = null;
-DepthJS.wsBackend.depthWs = null;
-DepthJS.wsBackend.host = "localhost";
-DepthJS.wsBackend.port = 8000;
-DepthJS.wsBackend.connect = function() {
- DepthJS.backend.connecting = true;
- DepthJS.browser.sendMessageToPopup("connecting");
- var connected = 0;
- function check() {
- connected++;
- if (connected == 3) {
- if (DepthJS.verbose) console.log("All 3 connected");
- DepthJS.browser.sendMessageToPopup("connected");
- DepthJS.backend.connecting = false;
- DepthJS.backend.connected = true;
- }
- }
-
- // If we do not connect within a timeout period,
- // effectively cancel it and let the popup know.
- setTimeout(function() {
- if (connected != 3) {
- DepthJS.wsBackend.disconnect();
- }
- }, 3000);
-
- return _.all(_.map(["event", "image", "depth"], function(stream) {
- var path = "ws://" + DepthJS.wsBackend.host + ":" + DepthJS.wsBackend.port + "/" + stream;
- if (DepthJS.verbose) console.log("Connecting to " + stream + " stream on " + path);
-
- // Clear out any old sockets
- var oldSocket = DepthJS.wsBackend[stream+"Ws"];
- if (oldSocket != null) {
- oldSocket.onmessage = null;
- oldSocket.onclose = null;
- oldSocket.onopen = null;
-
- if (oldSocket.readyState == WS_OPEN ||
- oldSocket.readyState == WS_CONNECTING) {
- oldSocket.close();
- }
- }
-
- var socket = new WebSocket(path);
- DepthJS.wsBackend[stream+"Ws"] = socket;
-
- socket.onmessage = function(data){
- DepthJS.wsBackend.onMessage(stream, data);
- };
-
- socket.onclose = function() {
- DepthJS.wsBackend.onDisconnect(stream);
- };
-
- socket.onopen = function() {
- DepthJS.wsBackend.onConnect(stream);
- check();
- };
-
- return true;
- }));
-};
-
-DepthJS.wsBackend.onMessage = function (stream, data) {
- if (stream == "event") {
- if (data === undefined || data.data == null) {
- return;
- }
- var msg = JSON.parse(data.data);
- if (!$.isPlainObject(msg)) {
- if (DepthJS.verbose) console.log('Unknown message: ' + data);
- return;
- }
- DepthJS.logSortaVerbose(msg.type, msg);
- var handler = DepthJS.eventHandlers["on"+msg.type];
- if (handler != null) {
- handler(msg.data);
- }
-
- msg.jsonRep = data.data;
- // Don't send to all--send to only the current tab.
- DepthJS.browser.sendMessageToActiveTab(msg);
- } else if (stream == "image") {
- /*DepthJS.eventHandlers.onImageMsg(data);*/
- } else if (stream == "depth") {
- /*DepthJS.eventHandlers.onDepthMsg(data);*/
- }
-};
-
-DepthJS.wsBackend.disconnect = function() {
- DepthJS.backend.connected = false;
- if (DepthJS.verbose) console.log("Disconnecting");
- DepthJS.browser.sendMessageToPopup("disconnected");
- return _.map(["event", "image", "depth"], function(stream) {
- var oldSocket = DepthJS.wsBackend[stream+"Ws"];
- if (oldSocket != null) {
- oldSocket.onmessage = null;
- oldSocket.onclose = null;
- oldSocket.onopen = null;
-
- if (oldSocket.readyState == WS_OPEN ||
- oldSocket.readyState == WS_CONNECTING) {
- oldSocket.close();
- }
- }
- DepthJS.wsBackend[stream+"Ws"] = null;
- });
-};
-
-DepthJS.wsBackend.onDisconnect = function (stream) {
- if (DepthJS.verbose) console.log("Disconnected on " + stream + " stream");
- // If one is closed, close them all.
- DepthJS.wsBackend.disconnect();
-};
-
-DepthJS.wsBackend.onConnect = function (stream) {
- if (DepthJS.verbose) console.log("Connect on " + stream + " stream");
-};
-
-
-// NPAPI PLUGIN BASED BACKEND ----------------------------------------------------------------------
-
-DepthJS.npBackend = {};
-DepthJS.npBackend.connect = function() {
- if (DepthJS.backend.connecting || DepthJS.backend.connected) {
- console.log("Already connectted... disconnecting and reconnecting");
- DepthJS.npBackend.disconnect();
- }
- DepthJS.browser.sendMessageToPopup("connecting");
-
- DepthJS.backend.connected = false;
- var success = DepthJS.pluginObj.InitDepthJS();
- DepthJS.backend.connecting = false;
- if (success) {
- console.log("Successfully acquired Kinect event monitor from plugin!");
- DepthJS.backend.connected = true;
- } else {
- console.log("ERROR: Could not acquire Kinect event monitor from plugin");
- DepthJS.backend.connected = false;
- }
- return success;
-};
-
-DepthJS.npBackend.receiveEvent = function (msg) {
- if (msg == null || msg.type == null) {
- return;
- }
- DepthJS.logSortaVerbose(msg.type, msg);
- var handler = DepthJS.eventHandlers["on"+msg.type];
- if (handler != null) {
- handler(msg.data);
- }
-
- msg.jsonRep = JSON.stringify(msg);
- // Don't send to all--send to only the current tab.
- DepthJS.browser.sendMessageToActiveTab(msg);
-};
-
-DepthJS.npBackend.disconnect = function() {
- DepthJS.backend.connected = false;
- DepthJS.backend.connecting = false;
- if (DepthJS.verbose) console.log("Disconnecting");
- DepthJS.browser.sendMessageToPopup("disconnected");
- DepthJS.pluginObj.ShutdownDepthJS();
-};
-
-// Native library chooses; default websocket
-
-DepthJS.backend = {
- connect: DepthJS.wsBackend.connect,
- disconnect: DepthJS.wsBackend.disconnect,
- connecting: false,
- connected: false
-}
@@ -1,52 +0,0 @@
-console.log("Initing background.html message handling");
-DepthJS.background.handleMessage = function(action, data, reply) {
- var handlers = {
- connect: DepthJS.backend.connect,
-
- disconnect: DepthJS.backend.disconnect,
-
- getConnectState: function() {
- if (DepthJS.backend.connecting) {
- reply("connectState", {state: "connecting", mode: DepthJS.registerMode});
- } else {
- var state = DepthJS.backend.connected ? "connected" : "disconnected";
- reply("connectState", {state: state, mode: DepthJS.registerMode});
- }
- },
-
- depthoseTest: DepthJS.test.depthoseTest,
-
- pannerTest: DepthJS.test.pannerTest,
-
- selectorBoxTest: DepthJS.test.selectorBoxTest,
-
- getThumbnails: function() {
- DepthJS.tabs.populateActiveWindowCache(function(tabs) {
- tabs = _.map(tabs, DepthJS.tabs.sanitizeTabObject);
- if (DepthJS.verbose) console.log(["sending thumbnails", tabs]);
- reply("thumbnails", {tabs: tabs});
- });
- },
-
- selectTab: function() {
- var tabId = data.tabId;
- DepthJS.tabs.selectTab(tabId);
- },
-
- depthoseMode: function() {
- DepthJS.registerMode = "depthose";
- DepthJS.test.sendTestEvent({type: "DepthoseMode", data:{}});
- },
-
- pannerMode: function() {
- DepthJS.registerMode = "panner";
- DepthJS.test.sendTestEvent({type: "PannerMode", data:{}});
- },
-
- selectorBoxMode: function() {
- DepthJS.registerMode = "selectorBox";
- DepthJS.test.sendTestEvent({type: "SelectorBoxMode", data:{}});
- }
- };
- handlers[action](data);
-};
@@ -1,80 +0,0 @@
-/*
-DepthJS
-Copyright (C) 2010 Aaron Zinman, Doug Fritz, Roy Shilkrot, and Greg Elliott
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as
-published by the Free Software Foundation, either version 3 of the
-License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-
-console.log('background.html Starting DepthJS');
-var DepthJS = {
- __VERSION__: '0.3',
- verbose: true,
- backend: {},
- eventHandlers: {},
- cv: {},
- tools: {},
- portsByTabId: {},
- tabs: {},
- test: {},
- toolbar: {},
- browser: {},
- background: {},
- registerMode: "selectorBox",
- pluginObj: null
-};
-
-DepthJS.init = function (pluginObj) {
- console.log("Initing DepthJS background");
- DepthJS.pluginObj = pluginObj;
- DepthJS.initBrowserBackground();
- DepthJS.browser.addBackgroundListener(DepthJS.background.handleMessage);
- if (DepthJS.verbose) console.log("Connecting to Backend");
- if (!DepthJS.backend.connect()) {
- if (DepthJS.verbose) console.log("Couldn't connect... aborting");
- return false;
- }
- console.log("Init complete");
- return true;
-};
-
-
-(function() {
-var lastMessages = [];
-DepthJS.logSortaVerbose = function(type, fullMessage) {
- lastMessages.push({type: type, data:fullMessage});
-};
-
-function print() {
- setTimeout(print, 1000);
- if (lastMessages.length == 0) return;
- var counts = {};
- var lastByType = {};
- _.each(lastMessages, function(msg) {
- if (counts[msg.type] == null) counts[msg.type] = 0;
- counts[msg.type] = counts[msg.type] + 1;
- lastByType[msg.type] = msg.data;
- });
-
- var alphabeticalKeys = _.keys(counts).sort();
- console.log("------" + (new Date() + ""));
- _.each(alphabeticalKeys, function(type) {
- console.log([" " + counts[type] + " " + type + "; last = ", lastByType[type]]);
- });
-
- lastMessages = [];
-}
-setTimeout(print, 1000);
-
-})();
Oops, something went wrong.

0 comments on commit 28a528d

Please sign in to comment.