| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * AlertOverlay class | 10 * AlertOverlay class |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 if (this.cancelCallback != undefined) { | 68 if (this.cancelCallback != undefined) { |
| 69 this.cancelCallback.call(); | 69 this.cancelCallback.call(); |
| 70 } | 70 } |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * The page is getting hidden. Don't let it be shown again. | 74 * The page is getting hidden. Don't let it be shown again. |
| 75 * @override | 75 * @override |
| 76 */ | 76 */ |
| 77 willHidePage: function() { | 77 willHidePage: function() { |
| 78 canShow_ = false; | 78 this.canShow_ = false; |
| 79 }, | 79 }, |
| 80 | 80 |
| 81 /** @override */ | 81 /** @override */ |
| 82 canShowPage: function() { | 82 canShowPage: function() { |
| 83 return this.canShow_; | 83 return this.canShow_; |
| 84 }, | 84 }, |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 /** | 87 /** |
| 88 * Show an alert overlay with the given message, button titles, and | 88 * Show an alert overlay with the given message, button titles, and |
| 89 * callbacks. | 89 * callbacks. |
| 90 * @param {string} title The alert title to display to the user. | 90 * @param {string} title The alert title to display to the user. |
| 91 * @param {string} message The alert message to display to the user. | 91 * @param {string} message The alert message to display to the user. |
| 92 * @param {string} okTitle The title of the OK button. If undefined or empty, | 92 * @param {string} okTitle The title of the OK button. If undefined or empty, |
| 93 * no button is shown. | 93 * no button is shown. |
| 94 * @param {string} cancelTitle The title of the cancel button. If undefined or | 94 * @param {string} cancelTitle The title of the cancel button. If undefined or |
| 95 * empty, no button is shown. | 95 * empty, no button is shown. |
| 96 * @param {function} okCallback A function to be called when the user presses | 96 * @param {function()} okCallback A function to be called when the user |
| 97 * the ok button. The alert window will be closed automatically. Can be | 97 * presses the ok button. The alert window will be closed automatically. |
| 98 * undefined. | 98 * Can be undefined. |
| 99 * @param {function} cancelCallback A function to be called when the user | 99 * @param {function()} cancelCallback A function to be called when the user |
| 100 * presses the cancel button. The alert window will be closed | 100 * presses the cancel button. The alert window will be closed |
| 101 * automatically. Can be undefined. | 101 * automatically. Can be undefined. |
| 102 */ | 102 */ |
| 103 AlertOverlay.show = function( | 103 AlertOverlay.show = function( |
| 104 title, message, okTitle, cancelTitle, okCallback, cancelCallback) { | 104 title, message, okTitle, cancelTitle, okCallback, cancelCallback) { |
| 105 if (title != undefined) { | 105 if (title != undefined) { |
| 106 $('alertOverlayTitle').textContent = title; | 106 $('alertOverlayTitle').textContent = title; |
| 107 $('alertOverlayTitle').style.display = 'block'; | 107 $('alertOverlayTitle').style.display = 'block'; |
| 108 } else { | 108 } else { |
| 109 $('alertOverlayTitle').style.display = 'none'; | 109 $('alertOverlayTitle').style.display = 'none'; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 138 // Intentionally don't show the URL in the location bar as we don't want | 138 // Intentionally don't show the URL in the location bar as we don't want |
| 139 // people trying to navigate here by hand. | 139 // people trying to navigate here by hand. |
| 140 PageManager.showPageByName('alertOverlay', false); | 140 PageManager.showPageByName('alertOverlay', false); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 // Export | 143 // Export |
| 144 return { | 144 return { |
| 145 AlertOverlay: AlertOverlay | 145 AlertOverlay: AlertOverlay |
| 146 }; | 146 }; |
| 147 }); | 147 }); |
| OLD | NEW |