Chromium Code Reviews| Index: Source/devtools/front_end/ui/Dialog.js |
| diff --git a/Source/devtools/front_end/ui/Dialog.js b/Source/devtools/front_end/ui/Dialog.js |
| index a7ddbdcf7e375c972368df1f4b681d0672babbe6..c7b9da357475892ff3c499034b7713dbd0dd3554 100644 |
| --- a/Source/devtools/front_end/ui/Dialog.js |
| +++ b/Source/devtools/front_end/ui/Dialog.js |
| @@ -32,11 +32,13 @@ |
| * @constructor |
| * @param {!Element} relativeToElement |
| * @param {!WebInspector.DialogDelegate} delegate |
| + * @param {boolean=} modal |
| */ |
| -WebInspector.Dialog = function(relativeToElement, delegate) |
| +WebInspector.Dialog = function(relativeToElement, delegate, modal) |
| { |
| this._delegate = delegate; |
| this._relativeToElement = relativeToElement; |
| + this._modal = modal; |
| this._glassPane = new WebInspector.GlassPane(/** @type {!Document} */ (relativeToElement.ownerDocument)); |
| WebInspector.GlassPane.DefaultFocusedViewStack.push(this); |
| @@ -71,12 +73,13 @@ WebInspector.Dialog.currentInstance = function() |
| /** |
| * @param {?Element} relativeToElement |
| * @param {!WebInspector.DialogDelegate} delegate |
| + * @param {boolean=} modal |
| */ |
| -WebInspector.Dialog.show = function(relativeToElement, delegate) |
| +WebInspector.Dialog.show = function(relativeToElement, delegate, modal) |
|
caseq
2015/08/28 23:36:55
Let's rename modal?
alph
2015/08/29 00:49:38
Left it as is. Can't find a better short enough na
|
| { |
| if (WebInspector.Dialog._instance) |
| return; |
| - WebInspector.Dialog._instance = new WebInspector.Dialog(relativeToElement || WebInspector.Dialog.modalHostView().element, delegate); |
| + WebInspector.Dialog._instance = new WebInspector.Dialog(relativeToElement || WebInspector.Dialog.modalHostView().element, delegate, modal); |
| } |
| WebInspector.Dialog.hide = function() |
| @@ -105,8 +108,13 @@ WebInspector.Dialog.prototype = { |
| this._glassPane.dispose(); |
| }, |
| + /** |
| + * @param {!Event} event |
| + */ |
| _onGlassPaneFocus: function(event) |
| { |
| + if (this._modal) |
| + return; |
| this._hide(); |
| }, |
| @@ -130,6 +138,8 @@ WebInspector.Dialog.prototype = { |
| if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) |
| this._delegate.onEnter(event); |
| + this._delegate.onKeyDown(event); |
| + |
| if (!event.handled && this._closeKeys.indexOf(event.keyCode) >= 0) { |
| this._hide(); |
| event.consume(true); |
| @@ -178,8 +188,16 @@ WebInspector.DialogDelegate.prototype = { |
| focus: function() { }, |
| + /** |
| + * @param {!KeyboardEvent} event |
| + */ |
| onEnter: function(event) { }, |
| + /** |
| + * @param {!KeyboardEvent} event |
| + */ |
| + onKeyDown: function(event) { }, |
| + |
| willHide: function() { }, |
| __proto__: WebInspector.Object.prototype |