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

Unified Diff: Source/devtools/front_end/inspector.js

Issue 170273003: DevTools: Implement extensions-based shortcut bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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: Source/devtools/front_end/inspector.js
diff --git a/Source/devtools/front_end/inspector.js b/Source/devtools/front_end/inspector.js
index 1401812d4e11a7be59e541d175f854608cd5fdae..a319a74b41f52a200181a39923d151015ac4df19 100644
--- a/Source/devtools/front_end/inspector.js
+++ b/Source/devtools/front_end/inspector.js
@@ -35,7 +35,7 @@ var WebInspector = {
if (WebInspector.isWorkerFrontend()) {
configuration = ["sources", "timeline", "profiles", "console", "codemirror"];
} else {
- configuration = ["elements", "network", "sources", "timeline", "profiles", "resources", "audits", "console", "codemirror", "extensions", "sources-formatter-actions"];
+ configuration = ["core", "elements", "network", "sources", "timeline", "profiles", "resources", "audits", "console", "codemirror", "extensions", "settings", "sources-formatter-actions"];
if (WebInspector.experimentsSettings.layersPanel.isEnabled())
configuration.push("layers");
}
@@ -133,8 +133,6 @@ var WebInspector = {
showConsole: function()
{
- if (this.consoleView.isShowing())
- return;
this.inspectorView.showViewInDrawer("console");
},
@@ -363,6 +361,7 @@ WebInspector._doLoadedDoneWithCapabilities = function()
WebInspector.settings.initializeBackendSettings();
this._registerModules();
+ WebInspector.KeyboardShortcut.loadBindings();
this.panels = {};
WebInspector.inspectorView = new WebInspector.InspectorView();
@@ -590,33 +589,6 @@ WebInspector.postDocumentKeyDown = function(event)
if (WebInspector.inspectElementModeController && WebInspector.inspectElementModeController.handleShortcut(event))
return;
- switch (event.keyIdentifier) {
- case "U+004F": // O key
- case "U+0050": // P key
- if (!event.shiftKey && !event.altKey && WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) {
- WebInspector.showPanel("sources").showGoToSourceDialog();
- event.consume(true);
- }
- break;
- case "U+0052": // R key
- if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) {
- WebInspector.debuggerModel.skipAllPauses(true, true);
- WebInspector.resourceTreeModel.reloadPage(event.shiftKey);
- event.consume(true);
- }
- if (window.DEBUG && event.altKey) {
- WebInspector.reload();
- return;
- }
- break;
- case "F5":
- if (!WebInspector.isMac()) {
- WebInspector.resourceTreeModel.reloadPage(event.ctrlKey || event.shiftKey);
- event.consume(true);
- }
- break;
- }
-
var isValidZoomShortcut = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) &&
!event.altKey &&
!InspectorFrontendHost.isStub;
@@ -625,24 +597,7 @@ WebInspector.postDocumentKeyDown = function(event)
return;
}
- if (event.keyCode === WebInspector.KeyboardShortcut.Keys.F1.code ||
- (event.keyCode === WebInspector.KeyboardShortcut.Keys.QuestionMark.code && event.shiftKey && (!WebInspector.isBeingEdited(event.target) || event.metaKey))) {
- this.settingsController.showSettingsScreen(WebInspector.SettingsScreen.Tabs.General);
- event.consume(true);
- return;
- }
-
- var Esc = "U+001B";
- var doNotOpenDrawerOnEsc = WebInspector.experimentsSettings.doNotOpenDrawerOnEsc.isEnabled();
- if (event.keyIdentifier === Esc) {
- if (this.inspectorView.drawerVisible())
- this.inspectorView.closeDrawer();
- else if (!doNotOpenDrawerOnEsc)
- this.inspectorView.showDrawer();
- }
-
- if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Tilde.code && event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey)
- this.showConsole();
+ WebInspector.KeyboardShortcut.handleShortcut(event);
}
WebInspector.documentCanCopy = function(event)
@@ -852,4 +807,49 @@ WebInspector.addMainEventListeners = function(doc)
doc.addEventListener("click", this.documentClick.bind(this), false);
}
+/**
+ * @constructor
+ * @implements {WebInspector.ActionDelegate}
+ */
+WebInspector.SkipAllPausesAndReloadActionDelegate = function()
pfeldman 2014/02/21 16:29:16 This does not belong to the inspector.js
apavlov 2014/02/24 09:57:57 I was unsure about these two, since they don't see
+{
+}
+
+WebInspector.SkipAllPausesAndReloadActionDelegate.prototype = {
+ /**
+ * @param {!KeyboardEvent=} keyEvent
+ * @return {boolean}
+ */
+ handleAction: function(keyEvent)
+ {
+ WebInspector.debuggerModel.skipAllPauses(true, true);
+ WebInspector.resourceTreeModel.reloadPage(keyEvent && keyEvent.shiftKey);
+ return true;
+ }
+}
+
+/**
+ * @constructor
+ * @implements {WebInspector.ActionDelegate}
+ */
+WebInspector.DebugReloadActionDelegate = function()
pfeldman 2014/02/21 16:29:16 ditto
apavlov 2014/03/17 13:40:59 Agreed on leaving these here for now offline.
+{
+}
+
+WebInspector.DebugReloadActionDelegate.prototype = {
+ /**
+ * @param {!KeyboardEvent=} keyEvent
+ * @return {boolean}
+ */
+ handleAction: function(keyEvent)
+ {
+ if (window.DEBUG) {
+ WebInspector.reload();
+ return true;
+ }
+ return false;
+ }
+}
+
+
window.DEBUG = true;

Powered by Google App Engine
This is Rietveld 408576698