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 | 6 * @fileoverview |
7 * 'protocol-handlers' is the polymer element for showing the | 7 * 'protocol-handlers' is the polymer element for showing the |
8 * protocol handlers category under Site Settings. | 8 * protocol handlers category under Site Settings. |
9 */ | 9 */ |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 */ | 56 */ |
57 actionMenuModel_: Object, | 57 actionMenuModel_: Object, |
58 | 58 |
59 /* Labels for the toggle on/off positions. */ | 59 /* Labels for the toggle on/off positions. */ |
60 toggleOffLabel: String, | 60 toggleOffLabel: String, |
61 toggleOnLabel: String, | 61 toggleOnLabel: String, |
62 }, | 62 }, |
63 | 63 |
64 /** @override */ | 64 /** @override */ |
65 ready: function() { | 65 ready: function() { |
66 this.addWebUIListener('setHandlersEnabled', | 66 this.addWebUIListener( |
67 this.setHandlersEnabled_.bind(this)); | 67 'setHandlersEnabled', this.setHandlersEnabled_.bind(this)); |
68 this.addWebUIListener('setProtocolHandlers', | 68 this.addWebUIListener( |
69 this.setProtocolHandlers_.bind(this)); | 69 'setProtocolHandlers', this.setProtocolHandlers_.bind(this)); |
70 this.addWebUIListener('setIgnoredProtocolHandlers', | 70 this.addWebUIListener( |
| 71 'setIgnoredProtocolHandlers', |
71 this.setIgnoredProtocolHandlers_.bind(this)); | 72 this.setIgnoredProtocolHandlers_.bind(this)); |
72 this.browserProxy.observeProtocolHandlers(); | 73 this.browserProxy.observeProtocolHandlers(); |
73 }, | 74 }, |
74 | 75 |
75 /** | 76 /** |
76 * Obtains the description for the main toggle. | 77 * Obtains the description for the main toggle. |
77 * @return {string} The description to use. | 78 * @return {string} The description to use. |
78 * @private | 79 * @private |
79 */ | 80 */ |
80 computeHandlersDescription_: function() { | 81 computeHandlersDescription_: function() { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 this.actionMenuModel_ = null; | 153 this.actionMenuModel_ = null; |
153 this.browserProxy.removeProtocolHandler(item.protocol, item.spec); | 154 this.browserProxy.removeProtocolHandler(item.protocol, item.spec); |
154 }, | 155 }, |
155 | 156 |
156 /** | 157 /** |
157 * Checks whether or not the selected actionMenuModel is the default handler | 158 * Checks whether or not the selected actionMenuModel is the default handler |
158 * for its protocol. | 159 * for its protocol. |
159 * @return {boolean} if actionMenuModel_ is default handler of its protocol. | 160 * @return {boolean} if actionMenuModel_ is default handler of its protocol. |
160 */ | 161 */ |
161 isModelDefault_: function() { | 162 isModelDefault_: function() { |
162 return !!this.actionMenuModel_ && (this.actionMenuModel_.index == | 163 return !!this.actionMenuModel_ && |
163 this.actionMenuModel_.protocol.default_handler); | 164 (this.actionMenuModel_.index == |
| 165 this.actionMenuModel_.protocol.default_handler); |
164 }, | 166 }, |
165 | 167 |
166 /** | 168 /** |
167 * A handler to show the action menu next to the clicked menu button. | 169 * A handler to show the action menu next to the clicked menu button. |
168 * @param {!{model: !{protocol: HandlerEntry, item: ProtocolEntry, | 170 * @param {!{model: !{protocol: HandlerEntry, item: ProtocolEntry, |
169 * index: number}}} event | 171 * index: number}}} event |
170 * @private | 172 * @private |
171 */ | 173 */ |
172 showMenu_: function(event) { | 174 showMenu_: function(event) { |
173 this.actionMenuModel_ = event.model; | 175 this.actionMenuModel_ = event.model; |
174 /** @type {!CrActionMenuElement} */ ( | 176 /** @type {!CrActionMenuElement} */ (this.$$('dialog[is=cr-action-menu]')) |
175 this.$$('dialog[is=cr-action-menu]')).showAt( | 177 .showAt( |
176 /** @type {!Element} */ ( | 178 /** @type {!Element} */ ( |
177 Polymer.dom(/** @type {!Event} */ (event)).localTarget)); | 179 Polymer.dom(/** @type {!Event} */ (event)).localTarget)); |
178 } | 180 } |
179 }); | 181 }); |
OLD | NEW |