OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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('cr.ui.dialogs', function() { | 5 cr.define('cr.ui.dialogs', function() { |
6 | 6 |
7 function BaseDialog(parentNode) { | 7 function BaseDialog(parentNode) { |
8 this.parentNode_ = parentNode; | 8 this.parentNode_ = parentNode; |
9 this.document_ = parentNode.ownerDocument; | 9 this.document_ = parentNode.ownerDocument; |
10 | 10 |
11 // The DOM element from the dialog which should receive focus when the | 11 // The DOM element from the dialog which should receive focus when the |
12 // dialog is first displayed. | 12 // dialog is first displayed. |
13 this.initialFocusElement_ = null; | 13 this.initialFocusElement_ = null; |
14 | 14 |
15 // The DOM element from the parent which had focus before we were displayed, | 15 // The DOM element from the parent which had focus before we were displayed, |
16 // so we can restore it when we're hidden. | 16 // so we can restore it when we're hidden. |
17 this.previousActiveElement_ = null; | 17 this.previousActiveElement_ = null; |
18 | 18 |
19 this.initDom_(); | 19 this.initDom_(); |
20 } | 20 } |
21 | 21 |
22 /** | 22 /** |
23 * Default text for Ok and Cancel buttons. | 23 * Default text for Ok and Cancel buttons. |
24 * | 24 * |
25 * Clients should override these with localized labels. | 25 * Clients should override these with localized labels. |
26 */ | 26 */ |
27 BaseDialog.OK_LABEL = 'Ok'; | 27 BaseDialog.OK_LABEL = '[LOCALIZE ME] Ok'; |
28 BaseDialog.CANCEL_LABEL = 'Cancel'; | 28 BaseDialog.CANCEL_LABEL = '[LOCALIZE ME] Cancel'; |
29 | 29 |
30 /** | 30 /** |
31 * Number of miliseconds animation is expected to take, plus some margin for | 31 * Number of miliseconds animation is expected to take, plus some margin for |
32 * error. | 32 * error. |
33 */ | 33 */ |
34 BaseDialog.ANIMATE_STABLE_DURATION = 500; | 34 BaseDialog.ANIMATE_STABLE_DURATION = 500; |
35 | 35 |
36 BaseDialog.prototype.initDom_ = function() { | 36 BaseDialog.prototype.initDom_ = function() { |
37 var doc = this.document_; | 37 var doc = this.document_; |
38 this.container_ = doc.createElement('div'); | 38 this.container_ = doc.createElement('div'); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 this.onOk_(this.getValue()); | 226 this.onOk_(this.getValue()); |
227 }; | 227 }; |
228 | 228 |
229 return { | 229 return { |
230 BaseDialog: BaseDialog, | 230 BaseDialog: BaseDialog, |
231 AlertDialog: AlertDialog, | 231 AlertDialog: AlertDialog, |
232 ConfirmDialog: ConfirmDialog, | 232 ConfirmDialog: ConfirmDialog, |
233 PromptDialog: PromptDialog | 233 PromptDialog: PromptDialog |
234 }; | 234 }; |
235 }); | 235 }); |
OLD | NEW |