OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 444 |
445 /** | 445 /** |
446 * @param {!Runtime.Extension} extension | 446 * @param {!Runtime.Extension} extension |
447 * @param {?function(function(new:Object)):boolean} predicate | 447 * @param {?function(function(new:Object)):boolean} predicate |
448 * @return {boolean} | 448 * @return {boolean} |
449 */ | 449 */ |
450 _checkExtensionApplicability: function(extension, predicate) | 450 _checkExtensionApplicability: function(extension, predicate) |
451 { | 451 { |
452 if (!predicate) | 452 if (!predicate) |
453 return false; | 453 return false; |
454 var contextTypes = extension.descriptor().contextTypes; | 454 var contextTypes = /** @type {!Array.<string>|undefined} */ (extension.d
escriptor().contextTypes); |
455 if (!contextTypes) | 455 if (!contextTypes) |
456 return true; | 456 return true; |
457 for (var i = 0; i < contextTypes.length; ++i) { | 457 for (var i = 0; i < contextTypes.length; ++i) { |
458 var contextType = this._resolve(contextTypes[i]); | 458 var contextType = this._resolve(contextTypes[i]); |
459 var isMatching = !!contextType && predicate(contextType); | 459 var isMatching = !!contextType && predicate(contextType); |
460 if (isMatching) | 460 if (isMatching) |
461 return true; | 461 return true; |
462 } | 462 } |
463 return false; | 463 return false; |
464 }, | 464 }, |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 return new constructorFunction(this); | 912 return new constructorFunction(this); |
913 }, | 913 }, |
914 | 914 |
915 /** | 915 /** |
916 * @return {string} | 916 * @return {string} |
917 */ | 917 */ |
918 title: function() | 918 title: function() |
919 { | 919 { |
920 // FIXME: should be WebInspector.UIString() but runtime is not l10n awar
e yet. | 920 // FIXME: should be WebInspector.UIString() but runtime is not l10n awar
e yet. |
921 return this._descriptor["title-" + Runtime._platform] || this._descripto
r["title"]; | 921 return this._descriptor["title-" + Runtime._platform] || this._descripto
r["title"]; |
922 }, | |
923 | |
924 /** | |
925 * @param {function(new:Object)} contextType | |
926 * @return {boolean} | |
927 */ | |
928 hasContextType: function(contextType) | |
929 { | |
930 var contextTypes = this.descriptor().contextTypes; | |
931 if (!contextTypes) | |
932 return false; | |
933 for (var i = 0; i < contextTypes.length; ++i) { | |
934 if (contextType === this._module._manager._resolve(contextTypes[i])) | |
935 return true; | |
936 } | |
937 return false; | |
938 } | 922 } |
939 } | 923 } |
940 | 924 |
941 /** | 925 /** |
942 * @constructor | 926 * @constructor |
943 */ | 927 */ |
944 Runtime.ExperimentsSupport = function() | 928 Runtime.ExperimentsSupport = function() |
945 { | 929 { |
946 this._supportEnabled = Runtime.queryParam("experiments") !== null; | 930 this._supportEnabled = Runtime.queryParam("experiments") !== null; |
947 this._experiments = []; | 931 this._experiments = []; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 { | 1123 { |
1140 var sourceURL = self.location.href; | 1124 var sourceURL = self.location.href; |
1141 if (self.location.search) | 1125 if (self.location.search) |
1142 sourceURL = sourceURL.replace(self.location.search, ""); | 1126 sourceURL = sourceURL.replace(self.location.search, ""); |
1143 sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf("/") + 1) + path; | 1127 sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf("/") + 1) + path; |
1144 return "\n/*# sourceURL=" + sourceURL + " */"; | 1128 return "\n/*# sourceURL=" + sourceURL + " */"; |
1145 } | 1129 } |
1146 | 1130 |
1147 /** @type {!Runtime} */ | 1131 /** @type {!Runtime} */ |
1148 var runtime; | 1132 var runtime; |
OLD | NEW |