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

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

Issue 2235233002: Site Settings Desktop: Add Closure coverage for Protocol Handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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
11 /**
12 * All possible actions in the menu.
13 * @enum {string}
14 */
11 var MenuActions = { 15 var MenuActions = {
12 SET_DEFAULT: 'SetDefault', 16 SET_DEFAULT: 'SetDefault',
13 REMOVE: 'Remove', 17 REMOVE: 'Remove',
14 }; 18 };
15 19
16 /** 20 /**
17 * @typedef {{host: string, 21 * @typedef {{host: string,
18 * protocol: string, 22 * protocol: string,
19 * spec: string}} 23 * spec: string}}
20 */ 24 */
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 this.setHandlersEnabled_.bind(this)); 66 this.setHandlersEnabled_.bind(this));
63 this.addWebUIListener('setProtocolHandlers', 67 this.addWebUIListener('setProtocolHandlers',
64 this.setProtocolHandlers_.bind(this)); 68 this.setProtocolHandlers_.bind(this));
65 this.addWebUIListener('setIgnoredProtocolHandlers', 69 this.addWebUIListener('setIgnoredProtocolHandlers',
66 this.setIgnoredProtocolHandlers_.bind(this)); 70 this.setIgnoredProtocolHandlers_.bind(this));
67 this.browserProxy.initializeProtocolHandlerList(); 71 this.browserProxy.initializeProtocolHandlerList();
68 }, 72 },
69 73
70 /** 74 /**
71 * Obtains the description for the main toggle. 75 * Obtains the description for the main toggle.
72 * @param {number} categoryEnabled Whether the main toggle is enabled. 76 * @param {boolean} categoryEnabled Whether the main toggle is enabled.
73 * @return {string} The description to use. 77 * @return {string} The description to use.
74 * @private 78 * @private
75 */ 79 */
76 computeHandlersDescription_: function(categoryEnabled) { 80 computeHandlersDescription_: function(categoryEnabled) {
77 return this.computeCategoryDesc( 81 return this.computeCategoryDesc(
78 settings.ContentSettingsTypes.PROTOCOL_HANDLERS, categoryEnabled, true); 82 settings.ContentSettingsTypes.PROTOCOL_HANDLERS, categoryEnabled, true);
79 }, 83 },
80 84
81 /** 85 /**
82 * Returns whether the given index matches the default handler. 86 * Returns whether the given index matches the default handler.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 /** 125 /**
122 * A handler when the toggle is flipped. 126 * A handler when the toggle is flipped.
123 * @private 127 * @private
124 */ 128 */
125 onToggleChange_: function(event) { 129 onToggleChange_: function(event) {
126 this.browserProxy.setProtocolHandlerDefault(this.categoryEnabled); 130 this.browserProxy.setProtocolHandlerDefault(this.categoryEnabled);
127 }, 131 },
128 132
129 /** 133 /**
130 * A handler when an action is selected in the action menu. 134 * A handler when an action is selected in the action menu.
135 * @param {!{model: !{item: ProtocolHandlerEntry},
136 * detail: !{selected: string}}} event
131 * @private 137 * @private
132 */ 138 */
133 onActionMenuIronActivate_: function(event) { 139 onActionMenuIronActivate_: function(event) {
134 var protocol = event.model.item.protocol; 140 var protocol = event.model.item.protocol;
135 var url = event.model.item.spec; 141 var url = event.model.item.spec;
136 if (event.detail.selected == MenuActions.SET_DEFAULT) { 142 if (event.detail.selected == MenuActions.SET_DEFAULT) {
137 this.browserProxy.setProtocolDefault(protocol, url); 143 this.browserProxy.setProtocolDefault(protocol, url);
138 } else if (event.detail.selected == MenuActions.REMOVE) { 144 } else if (event.detail.selected == MenuActions.REMOVE) {
139 this.browserProxy.removeProtocolHandler(protocol, url); 145 this.browserProxy.removeProtocolHandler(protocol, url);
140 } 146 }
141 }, 147 },
142 }); 148 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698