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

Unified Diff: third_party/WebKit/Source/devtools/front_end/Runtime.js

Issue 2137763002: DevTools: automatically populate 'More tools' submenu with the drawer views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/Runtime.js
diff --git a/third_party/WebKit/Source/devtools/front_end/Runtime.js b/third_party/WebKit/Source/devtools/front_end/Runtime.js
index a1e681fb335bb6848dcae97e927f64116c6244a3..e79325f04c432999ec998c5dfa7768851289f816 100644
--- a/third_party/WebKit/Source/devtools/front_end/Runtime.js
+++ b/third_party/WebKit/Source/devtools/front_end/Runtime.js
@@ -455,6 +455,16 @@ Runtime._assert = function(value, message)
Runtime._originalAssert.call(Runtime._console, value, message + " " + new Error().stack);
}
+Runtime._platform = "";
+
+/**
+ * @param {string} platform
+ */
+Runtime.setPlatform = function(platform)
+{
+ Runtime._platform = platform;
+}
+
Runtime.prototype = {
useTestBase: function()
{
@@ -563,11 +573,12 @@ Runtime.prototype = {
/**
* @param {*} type
* @param {?Object=} context
+ * @param {boolean=} sortByTitle
* @return {!Array.<!Runtime.Extension>}
*/
- extensions: function(type, context)
+ extensions: function(type, context, sortByTitle)
{
- return this._extensions.filter(filter).sort(orderComparator);
+ return this._extensions.filter(filter).sort(sortByTitle ? titleComparator : orderComparator);
/**
* @param {!Runtime.Extension} extension
@@ -593,6 +604,18 @@ Runtime.prototype = {
var order2 = extension2.descriptor()["order"] || 0;
return order1 - order2;
}
+
+ /**
+ * @param {!Runtime.Extension} extension1
+ * @param {!Runtime.Extension} extension2
+ * @return {number}
+ */
+ function titleComparator(extension1, extension2)
+ {
+ var title1 = extension1.title() || "";
+ var title2 = extension2.title() || "";
+ return title1.localeCompare(title2);
+ }
},
/**
@@ -978,13 +1001,12 @@ Runtime.Extension.prototype = {
},
/**
- * @param {string} platform
* @return {string}
*/
- title: function(platform)
+ title: function()
{
// FIXME: should be WebInspector.UIString() but runtime is not l10n aware yet.
- return this._descriptor["title-" + platform] || this._descriptor["title"];
+ return this._descriptor["title-" + Runtime._platform] || this._descriptor["title"];
}
}

Powered by Google App Engine
This is Rietveld 408576698