1. devtaste
  2. conductory

Commits

sunhaitao  committed c53e23a

Added support to choice demands.

  • Participants
  • Parent commits 20eed31
  • Branches default

Comments (0)

Files changed (4)

File Components/BackEnds/AudioInput/AudioInput.vcproj

View file
  • Ignore whitespace
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="1"
-				TreatWChar_tAsBuiltInType="false"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="0"
-				TreatWChar_tAsBuiltInType="false"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="1"
-				TreatWChar_tAsBuiltInType="false"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="0"
-				TreatWChar_tAsBuiltInType="false"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"

File Components/BackEnds/VideoInput/VideoInput.vcproj

View file
  • Ignore whitespace
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="1"
-				TreatWChar_tAsBuiltInType="false"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="0"
-				TreatWChar_tAsBuiltInType="false"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="1"
-				TreatWChar_tAsBuiltInType="false"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="0"
 				RuntimeLibrary="0"
-				TreatWChar_tAsBuiltInType="false"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="true"

File Extension/chrome/content/Conductory.js

View file
  • Ignore whitespace
     };
 
     this.book = function (/* ...demandList, callback */) {
-      var demandList = [], callback, asynchronously = false;
+      var demandGroupList = [], callback, asynchronously = false;
 
-      var last = 0;
-      for (; last < arguments.length - 1; last++) {
-          demandList.push(arguments[last]);
-      }
-      if (typeof arguments[last] == 'function') {
-        callback = arguments[last];
-        asynchronously = true;
-      } else {
-        demandList.push(arguments[last]);
+      for (var i = 0; i < arguments.length; i++) {
+        var demandOrCallback = arguments[i];
+        var optional = !!demandOrCallback.optional;
+        if (demandOrCallback.protocol != undefined) {
+          demandGroupList.push({
+            optional:optional,
+            items:[demandOrCallback]
+          });
+        }
+        else if (Array.isArray(demandOrCallback.anyOf)) {
+          demandGroupList.push({
+            optional:optional,
+            items:demandOrCallback.anyOf
+          });
+        }
+        else if (typeof demandOrCallback == 'function') {
+          if (i != arguments.length - 1) {
+            throw new Error('Only the last argument can be a function.');
+          } else {
+            callback = demandOrCallback;
+            asynchronously = true;
+          }
+        }
+        else {
+          throw new RangeError("Illegel argument");
+        }
       }
 
       var requestList = [];
-      for each (demand in demandList) {
-        if (demand.protocol == undefined) {
-          throw new Error("Protocol not specified");
-        }
+      for each (demandGroup in demandGroupList) {
         var request = {
-          demand:demand,
+          optional:demandGroup.optional,
           offers:[]
         };
-        for each (manager in classData.managerList) {
-          var reply = manager.respondTo(demand, demandSource);
+        for each (demand in demandGroup.items) {
+          if (demand.protocol == undefined) {
+            throw new Error("Protocol not specified");
+          }
+          for each (manager in classData.managerList) {
+            var reply = manager.respondTo(demand, demandSource);
+            if (request.icon == undefined) {
+              request.icon = reply.icon;
+            }
+            if (request.hint == undefined) {
+              request.hint = reply.hint;
+            }
+            if (reply.offers != undefined) {
+              request.offers = request.offers.concat(reply.offers);
+            }
+          }
           if (request.icon == undefined) {
-            request.icon = reply.icon;
+            request.icon = strings.defaultIcon;
           }
           if (request.hint == undefined) {
-            request.hint = reply.hint;
+            request.hint = strings.defaultHint;
           }
-          if (reply.offers != undefined) {
-            request.offers = request.offers.concat(reply.offers);
-          }
-        }
-        if (request.icon == undefined) {
-          request.icon = strings.defaultIcon;
-        }
-        if (request.hint == undefined) {
-          request.hint = strings.defaultHint;
         }
         requestList.push(request);
       }

File Extension/chrome/content/device-picker.js

View file
  • Ignore whitespace
 var reserveList = arguments[1];
 
 function makeDeviceItem(request) {
-  assert(request.demand != undefined);
-  assert(request.demand.protocol != undefined);
   assert(request.offers != undefined);
 
   var icon = node("image");
   var hint = node("description");
 
-  var optional = (request.demand.optional == true);
+  var optional = (request.optional == true);
 
   var menupopup = node("menupopup");
   for each (offer in request.offers) {