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

Side by Side Diff: ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js

Issue 2180823004: Migrate <cr-dialog> from PaperDialogBehavior to native <dialog>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge conflicts with Tommy's CL. Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** 5 /**
6 * @fileoverview 'cr-dialog' is a component for showing a modal dialog. 6 * @fileoverview 'cr-dialog' is a component for showing a modal dialog. If the
7 * dialog is closed via close(), a 'close' event is fired. If the dialog is
8 * canceled via cancel(), a 'cancel' event is fired followed by a 'close' event.
9 * Additionally clients can inspect the dialog's |returnValue| property inside
10 * the 'close' event listener to determine whether it was canceled or just
11 * closed, where a truthy value means success, and a falsy value means it was
12 * canceled.
7 */ 13 */
8 Polymer({ 14 Polymer({
9 is: 'cr-dialog', 15 is: 'cr-dialog',
16 extends: 'dialog',
10 17
11 properties: { 18 cancel: function() {
12 /** @override */ 19 this.fire('cancel');
13 noCancelOnOutsideClick: { 20 HTMLDialogElement.prototype.close.call(this, '');
14 type: Boolean,
15 value: true,
16 },
17
18 /** @override */
19 noCancelOnEscKey: {
20 type: Boolean,
21 value: false,
22 },
23
24 /**
25 * @type {!Element}
26 * @override
27 */
28 sizingTarget: {
29 type: Element,
30 value: function() {
31 return assert(this.$$('.body-container'));
32 },
33 },
34
35 /** @override */
36 withBackdrop: {
37 type: Boolean,
38 value: true,
39 },
40 }, 21 },
41 22
42 behaviors: [Polymer.PaperDialogBehavior], 23 /**
24 * @param {string=} opt_returnValue
25 * @override
26 */
27 close: function(opt_returnValue) {
28 HTMLDialogElement.prototype.close.call(this, 'success');
29 },
43 30
44 /** @return {!PaperIconButtonElement} */ 31 /** @return {!PaperIconButtonElement} */
45 getCloseButton: function() { 32 getCloseButton: function() {
46 return this.$.close; 33 return this.$.close;
47 }, 34 },
48 }); 35 });
OLDNEW
« no previous file with comments | « ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698