OLD | NEW |
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 settings-certificate-subentry represents an SSL certificate | 6 * @fileoverview settings-certificate-subentry represents an SSL certificate |
7 * sub-entry. | 7 * sub-entry. |
8 */ | 8 */ |
9 | 9 |
10 cr.define('settings', function() { | 10 cr.define('settings', function() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 * @param {!CertificateAction} action | 44 * @param {!CertificateAction} action |
45 * @private | 45 * @private |
46 */ | 46 */ |
47 dispatchCertificateActionEvent_: function(action) { | 47 dispatchCertificateActionEvent_: function(action) { |
48 this.fire( | 48 this.fire( |
49 settings.CertificateActionEvent, | 49 settings.CertificateActionEvent, |
50 /** @type {!CertificateActionEventDetail} */ ({ | 50 /** @type {!CertificateActionEventDetail} */ ({ |
51 action: action, | 51 action: action, |
52 subnode: this.model, | 52 subnode: this.model, |
53 certificateType: this.certificateType, | 53 certificateType: this.certificateType, |
| 54 anchor: this.$.dots, |
54 })); | 55 })); |
55 }, | 56 }, |
56 | 57 |
57 /** | 58 /** |
58 * Handles the case where a call to the browser resulted in a rejected | 59 * Handles the case where a call to the browser resulted in a rejected |
59 * promise. | 60 * promise. |
60 * @param {*} error Expects {?CertificatesError}. | 61 * @param {*} error Expects {?CertificatesError}. |
61 * @private | 62 * @private |
62 */ | 63 */ |
63 onRejected_: function(error) { | 64 onRejected_: function(error) { |
64 if (error === null) { | 65 if (error === null) { |
65 // Nothing to do here. Null indicates that the user clicked "cancel" on | 66 // Nothing to do here. Null indicates that the user clicked "cancel" on |
66 // the native file chooser dialog. | 67 // the native file chooser dialog. |
67 return; | 68 return; |
68 } | 69 } |
69 | 70 |
70 // Otherwise propagate the error to the parents, such that a dialog | 71 // Otherwise propagate the error to the parents, such that a dialog |
71 // displaying the error will be shown. | 72 // displaying the error will be shown. |
72 this.fire('certificates-error', error); | 73 this.fire('certificates-error', {error: error, anchor: this.$.dots}); |
73 }, | 74 }, |
74 | 75 |
75 /** | 76 /** |
76 * @param {!Event} event | 77 * @param {!Event} event |
77 * @private | 78 * @private |
78 */ | 79 */ |
79 onViewTap_: function(event) { | 80 onViewTap_: function(event) { |
80 this.closePopupMenu_(); | 81 this.closePopupMenu_(); |
81 this.browserProxy_.viewCertificate(this.model.id); | 82 this.browserProxy_.viewCertificate(this.model.id); |
82 }, | 83 }, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 152 |
152 /** @private */ | 153 /** @private */ |
153 closePopupMenu_: function() { | 154 closePopupMenu_: function() { |
154 this.$$('dialog[is=cr-action-menu]').close(); | 155 this.$$('dialog[is=cr-action-menu]').close(); |
155 }, | 156 }, |
156 | 157 |
157 /** @private */ | 158 /** @private */ |
158 onDotsTap_: function() { | 159 onDotsTap_: function() { |
159 var actionMenu = /** @type {!CrActionMenuElement} */( | 160 var actionMenu = /** @type {!CrActionMenuElement} */( |
160 this.$.menu.get()); | 161 this.$.menu.get()); |
161 actionMenu.showAt(assert(this.$$('paper-icon-button'))); | 162 actionMenu.showAt(this.$.dots); |
162 }, | 163 }, |
163 }); | 164 }); |
OLD | NEW |