Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/Runtime.js

Issue 2142303002: Revert of DevTools: automatically populate 'More tools' submenu with the drawer views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 448
449 Runtime._console = console; 449 Runtime._console = console;
450 Runtime._originalAssert = console.assert; 450 Runtime._originalAssert = console.assert;
451 Runtime._assert = function(value, message) 451 Runtime._assert = function(value, message)
452 { 452 {
453 if (value) 453 if (value)
454 return; 454 return;
455 Runtime._originalAssert.call(Runtime._console, value, message + " " + new Er ror().stack); 455 Runtime._originalAssert.call(Runtime._console, value, message + " " + new Er ror().stack);
456 } 456 }
457 457
458 Runtime._platform = "";
459
460 /**
461 * @param {string} platform
462 */
463 Runtime.setPlatform = function(platform)
464 {
465 Runtime._platform = platform;
466 }
467
468 Runtime.prototype = { 458 Runtime.prototype = {
469 useTestBase: function() 459 useTestBase: function()
470 { 460 {
471 Runtime._remoteBase = "http://localhost:8000/inspector-sources/"; 461 Runtime._remoteBase = "http://localhost:8000/inspector-sources/";
472 }, 462 },
473 463
474 /** 464 /**
475 * @param {!Runtime.ModuleDescriptor} descriptor 465 * @param {!Runtime.ModuleDescriptor} descriptor
476 */ 466 */
477 _registerModule: function(descriptor) 467 _registerModule: function(descriptor)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 */ 556 */
567 function isContextTypeKnown(targetType) 557 function isContextTypeKnown(targetType)
568 { 558 {
569 return currentContextTypes.has(targetType); 559 return currentContextTypes.has(targetType);
570 } 560 }
571 }, 561 },
572 562
573 /** 563 /**
574 * @param {*} type 564 * @param {*} type
575 * @param {?Object=} context 565 * @param {?Object=} context
576 * @param {boolean=} sortByTitle
577 * @return {!Array.<!Runtime.Extension>} 566 * @return {!Array.<!Runtime.Extension>}
578 */ 567 */
579 extensions: function(type, context, sortByTitle) 568 extensions: function(type, context)
580 { 569 {
581 return this._extensions.filter(filter).sort(sortByTitle ? titleComparato r : orderComparator); 570 return this._extensions.filter(filter).sort(orderComparator);
582 571
583 /** 572 /**
584 * @param {!Runtime.Extension} extension 573 * @param {!Runtime.Extension} extension
585 * @return {boolean} 574 * @return {boolean}
586 */ 575 */
587 function filter(extension) 576 function filter(extension)
588 { 577 {
589 if (extension._type !== type && extension._typeClass() !== type) 578 if (extension._type !== type && extension._typeClass() !== type)
590 return false; 579 return false;
591 if (!extension.enabled()) 580 if (!extension.enabled())
592 return false; 581 return false;
593 return !context || extension.isApplicable(context); 582 return !context || extension.isApplicable(context);
594 } 583 }
595 584
596 /** 585 /**
597 * @param {!Runtime.Extension} extension1 586 * @param {!Runtime.Extension} extension1
598 * @param {!Runtime.Extension} extension2 587 * @param {!Runtime.Extension} extension2
599 * @return {number} 588 * @return {number}
600 */ 589 */
601 function orderComparator(extension1, extension2) 590 function orderComparator(extension1, extension2)
602 { 591 {
603 var order1 = extension1.descriptor()["order"] || 0; 592 var order1 = extension1.descriptor()["order"] || 0;
604 var order2 = extension2.descriptor()["order"] || 0; 593 var order2 = extension2.descriptor()["order"] || 0;
605 return order1 - order2; 594 return order1 - order2;
606 } 595 }
607
608 /**
609 * @param {!Runtime.Extension} extension1
610 * @param {!Runtime.Extension} extension2
611 * @return {number}
612 */
613 function titleComparator(extension1, extension2)
614 {
615 var title1 = extension1.title() || "";
616 var title2 = extension2.title() || "";
617 return title1.localeCompare(title2);
618 }
619 }, 596 },
620 597
621 /** 598 /**
622 * @param {*} type 599 * @param {*} type
623 * @param {?Object=} context 600 * @param {?Object=} context
624 * @return {?Runtime.Extension} 601 * @return {?Runtime.Extension}
625 */ 602 */
626 extension: function(type, context) 603 extension: function(type, context)
627 { 604 {
628 return this.extensions(type, context)[0] || null; 605 return this.extensions(type, context)[0] || null;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 function constructInstance() 971 function constructInstance()
995 { 972 {
996 var result = this._module._instance(className, this); 973 var result = this._module._instance(className, this);
997 if (!result) 974 if (!result)
998 return Promise.reject("Could not instantiate: " + className); 975 return Promise.reject("Could not instantiate: " + className);
999 return result; 976 return result;
1000 } 977 }
1001 }, 978 },
1002 979
1003 /** 980 /**
981 * @param {string} platform
1004 * @return {string} 982 * @return {string}
1005 */ 983 */
1006 title: function() 984 title: function(platform)
1007 { 985 {
1008 // FIXME: should be WebInspector.UIString() but runtime is not l10n awar e yet. 986 // FIXME: should be WebInspector.UIString() but runtime is not l10n awar e yet.
1009 return this._descriptor["title-" + Runtime._platform] || this._descripto r["title"]; 987 return this._descriptor["title-" + platform] || this._descriptor["title" ];
1010 } 988 }
1011 } 989 }
1012 990
1013 /** 991 /**
1014 * @constructor 992 * @constructor
1015 */ 993 */
1016 Runtime.ExperimentsSupport = function() 994 Runtime.ExperimentsSupport = function()
1017 { 995 {
1018 this._supportEnabled = Runtime.queryParam("experiments") !== null; 996 this._supportEnabled = Runtime.queryParam("experiments") !== null;
1019 this._experiments = []; 997 this._experiments = [];
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 { 1189 {
1212 var sourceURL = self.location.href; 1190 var sourceURL = self.location.href;
1213 if (self.location.search) 1191 if (self.location.search)
1214 sourceURL = sourceURL.replace(self.location.search, ""); 1192 sourceURL = sourceURL.replace(self.location.search, "");
1215 sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf("/") + 1) + path; 1193 sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf("/") + 1) + path;
1216 return "\n/*# sourceURL=" + sourceURL + " */"; 1194 return "\n/*# sourceURL=" + sourceURL + " */";
1217 } 1195 }
1218 1196
1219 /** @type {!Runtime} */ 1197 /** @type {!Runtime} */
1220 var runtime; 1198 var runtime;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698