| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 5 * Copyright (C) 2009 Joseph Pecoraro | 5 * Copyright (C) 2009 Joseph Pecoraro |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 UI.DragHandler = class { | 88 UI.DragHandler = class { |
| 89 constructor() { | 89 constructor() { |
| 90 this._elementDragMove = this._elementDragMove.bind(this); | 90 this._elementDragMove = this._elementDragMove.bind(this); |
| 91 this._elementDragEnd = this._elementDragEnd.bind(this); | 91 this._elementDragEnd = this._elementDragEnd.bind(this); |
| 92 this._mouseOutWhileDragging = this._mouseOutWhileDragging.bind(this); | 92 this._mouseOutWhileDragging = this._mouseOutWhileDragging.bind(this); |
| 93 } | 93 } |
| 94 | 94 |
| 95 _createGlassPane() { | 95 _createGlassPane() { |
| 96 this._glassPaneInUse = true; | 96 this._glassPaneInUse = true; |
| 97 if (!UI.DragHandler._glassPaneUsageCount++) { | 97 if (!UI.DragHandler._glassPaneUsageCount++) { |
| 98 UI.DragHandler._glassPane = new UI.GlassPane( | 98 UI.DragHandler._glassPane = new UI.GlassPane(); |
| 99 UI.DragHandler._documentForMouseOut, false /* dimmed */, true /* block
PointerEvents */, event => {}); | 99 UI.DragHandler._glassPane.setBlockPointerEvents(true); |
| 100 UI.DragHandler._glassPane.show(); | 100 UI.DragHandler._glassPane.showGlassPane(UI.DragHandler._documentForMouseOu
t); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 _disposeGlassPane() { | 104 _disposeGlassPane() { |
| 105 if (!this._glassPaneInUse) | 105 if (!this._glassPaneInUse) |
| 106 return; | 106 return; |
| 107 this._glassPaneInUse = false; | 107 this._glassPaneInUse = false; |
| 108 if (--UI.DragHandler._glassPaneUsageCount) | 108 if (--UI.DragHandler._glassPaneUsageCount) |
| 109 return; | 109 return; |
| 110 UI.DragHandler._glassPane.hide(); | 110 UI.DragHandler._glassPane.hideGlassPane(); |
| 111 delete UI.DragHandler._glassPane; | 111 delete UI.DragHandler._glassPane; |
| 112 delete UI.DragHandler._documentForMouseOut; | 112 delete UI.DragHandler._documentForMouseOut; |
| 113 } | 113 } |
| 114 | 114 |
| 115 /** | 115 /** |
| 116 * @param {!Element} targetElement | 116 * @param {!Element} targetElement |
| 117 * @param {?function(!MouseEvent):boolean} elementDragStart | 117 * @param {?function(!MouseEvent):boolean} elementDragStart |
| 118 * @param {function(!MouseEvent)} elementDrag | 118 * @param {function(!MouseEvent)} elementDrag |
| 119 * @param {?function(!MouseEvent)} elementDragEnd | 119 * @param {?function(!MouseEvent)} elementDragEnd |
| 120 * @param {string} cursor | 120 * @param {string} cursor |
| (...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 * @const | 2030 * @const |
| 2031 * @type {number} | 2031 * @type {number} |
| 2032 */ | 2032 */ |
| 2033 UI.MaxLengthForDisplayedURLs = 150; | 2033 UI.MaxLengthForDisplayedURLs = 150; |
| 2034 | 2034 |
| 2035 /** | 2035 /** |
| 2036 * @unrestricted | 2036 * @unrestricted |
| 2037 */ | 2037 */ |
| 2038 UI.ConfirmDialog = class extends UI.VBox { | 2038 UI.ConfirmDialog = class extends UI.VBox { |
| 2039 /** | 2039 /** |
| 2040 * @param {!Document|!Element} where |
| 2040 * @param {string} message | 2041 * @param {string} message |
| 2041 * @param {!Function} callback | 2042 * @param {!Function} callback |
| 2042 */ | 2043 */ |
| 2043 static show(message, callback) { | 2044 static show(where, message, callback) { |
| 2044 var dialog = new UI.Dialog(); | 2045 var dialog = new UI.Dialog(); |
| 2045 dialog.setWrapsContent(true); | 2046 dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent); |
| 2046 dialog.addCloseButton(); | 2047 dialog.addCloseButton(); |
| 2047 dialog.setDimmed(true); | 2048 dialog.setDimmed(true); |
| 2048 new UI | 2049 new UI |
| 2049 .ConfirmDialog( | 2050 .ConfirmDialog( |
| 2050 message, | 2051 message, |
| 2051 () => { | 2052 () => { |
| 2052 dialog.detach(); | 2053 dialog.hideDialog(); |
| 2053 callback(); | 2054 callback(); |
| 2054 }, | 2055 }, |
| 2055 () => dialog.detach()) | 2056 () => dialog.hideDialog()) |
| 2056 .show(dialog.element); | 2057 .show(dialog.contentElement); |
| 2057 dialog.show(); | 2058 dialog.showDialog(where); |
| 2058 } | 2059 } |
| 2059 | 2060 |
| 2060 /** | 2061 /** |
| 2061 * @param {string} message | 2062 * @param {string} message |
| 2062 * @param {!Function} okCallback | 2063 * @param {!Function} okCallback |
| 2063 * @param {!Function} cancelCallback | 2064 * @param {!Function} cancelCallback |
| 2064 */ | 2065 */ |
| 2065 constructor(message, okCallback, cancelCallback) { | 2066 constructor(message, okCallback, cancelCallback) { |
| 2066 super(true); | 2067 super(true); |
| 2067 this.registerRequiredCSS('ui/confirmDialog.css'); | 2068 this.registerRequiredCSS('ui/confirmDialog.css'); |
| 2068 this.contentElement.createChild('div', 'message').createChild('span').textCo
ntent = message; | 2069 this.contentElement.createChild('div', 'message').createChild('span').textCo
ntent = message; |
| 2069 var buttonsBar = this.contentElement.createChild('div', 'button'); | 2070 var buttonsBar = this.contentElement.createChild('div', 'button'); |
| 2070 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Ok'), okCallback
)); | 2071 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Ok'), okCallback
)); |
| 2071 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Cancel'), cancel
Callback)); | 2072 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Cancel'), cancel
Callback)); |
| 2072 } | 2073 } |
| 2073 }; | 2074 }; |
| OLD | NEW |