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

Side by Side Diff: chrome/browser/resources/settings/site_settings/protocol_handlers.js

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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
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 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 protocols: Array, 51 protocols: Array,
52 52
53 /** 53 /**
54 * The targetted object for menu operations. 54 * The targetted object for menu operations.
55 * @private {?Object} 55 * @private {?Object}
56 */ 56 */
57 actionMenuModel_: Object 57 actionMenuModel_: Object
58 }, 58 },
59 59
60 ready: function() { 60 ready: function() {
61 this.addWebUIListener('setHandlersEnabled', 61 this.addWebUIListener(
62 this.setHandlersEnabled_.bind(this)); 62 'setHandlersEnabled', this.setHandlersEnabled_.bind(this));
63 this.addWebUIListener('setProtocolHandlers', 63 this.addWebUIListener(
64 this.setProtocolHandlers_.bind(this)); 64 'setProtocolHandlers', this.setProtocolHandlers_.bind(this));
65 this.addWebUIListener('setIgnoredProtocolHandlers', 65 this.addWebUIListener(
66 'setIgnoredProtocolHandlers',
66 this.setIgnoredProtocolHandlers_.bind(this)); 67 this.setIgnoredProtocolHandlers_.bind(this));
67 this.browserProxy.observeProtocolHandlers(); 68 this.browserProxy.observeProtocolHandlers();
68 }, 69 },
69 70
70 /** 71 /**
71 * Obtains the description for the main toggle. 72 * Obtains the description for the main toggle.
72 * @return {string} The description to use. 73 * @return {string} The description to use.
73 * @private 74 * @private
74 */ 75 */
75 computeHandlersDescription_: function() { 76 computeHandlersDescription_: function() {
76 var setting = this.categoryEnabled ? 77 var setting = this.categoryEnabled ? settings.PermissionValues.ALLOW :
77 settings.PermissionValues.ALLOW : settings.PermissionValues.BLOCK; 78 settings.PermissionValues.BLOCK;
78 return this.computeCategoryDesc( 79 return this.computeCategoryDesc(
79 settings.ContentSettingsTypes.PROTOCOL_HANDLERS, setting, true); 80 settings.ContentSettingsTypes.PROTOCOL_HANDLERS, setting, true);
80 }, 81 },
81 82
82 /** 83 /**
83 * Returns whether the given index matches the default handler. 84 * Returns whether the given index matches the default handler.
84 * @param {number} index The index to evaluate. 85 * @param {number} index The index to evaluate.
85 * @param {number} defaultHandler The default handler index. 86 * @param {number} defaultHandler The default handler index.
86 * @return {boolean} Whether the item is default. 87 * @return {boolean} Whether the item is default.
87 * @private 88 * @private
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 this.actionMenuModel_ = null; 151 this.actionMenuModel_ = null;
151 this.browserProxy.removeProtocolHandler(item.protocol, item.spec); 152 this.browserProxy.removeProtocolHandler(item.protocol, item.spec);
152 }, 153 },
153 154
154 /** 155 /**
155 * Checks whether or not the selected actionMenuModel is the default handler 156 * Checks whether or not the selected actionMenuModel is the default handler
156 * for its protocol. 157 * for its protocol.
157 * @return {boolean} if actionMenuModel_ is default handler of its protocol. 158 * @return {boolean} if actionMenuModel_ is default handler of its protocol.
158 */ 159 */
159 isModelDefault_: function() { 160 isModelDefault_: function() {
160 return !!this.actionMenuModel_ && (this.actionMenuModel_.index == 161 return !!this.actionMenuModel_ &&
161 this.actionMenuModel_.protocol.default_handler); 162 (this.actionMenuModel_.index ==
163 this.actionMenuModel_.protocol.default_handler);
162 }, 164 },
163 165
164 /** 166 /**
165 * A handler to show the action menu next to the clicked menu button. 167 * A handler to show the action menu next to the clicked menu button.
166 * @param {!{model: !{protocol: HandlerEntry, item: ProtocolEntry, 168 * @param {!{model: !{protocol: HandlerEntry, item: ProtocolEntry,
167 * index: number}}} event 169 * index: number}}} event
168 * @private 170 * @private
169 */ 171 */
170 showMenu_: function(event) { 172 showMenu_: function(event) {
171 this.actionMenuModel_ = event.model; 173 this.actionMenuModel_ = event.model;
172 /** @type {!CrActionMenuElement} */ ( 174 /** @type {!CrActionMenuElement} */ (this.$$('dialog[is=cr-action-menu]'))
173 this.$$('dialog[is=cr-action-menu]')).showAt( 175 .showAt(
174 /** @type {!Element} */ ( 176 /** @type {!Element} */ (
175 Polymer.dom(/** @type {!Event} */ (event)).localTarget)); 177 Polymer.dom(/** @type {!Event} */ (event)).localTarget));
176 } 178 }
177 }); 179 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698