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

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

Issue 1428523006: Add Closure compiling instructions for site_list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « chrome/browser/resources/settings/site_settings/compiled_resources.gyp ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * 'settings-site-list' shows a list of Allowed and Blocked sites for a given 7 * 'settings-site-list' shows a list of Allowed and Blocked sites for a given
8 * category. 8 * category.
9 * 9 *
10 * Example: 10 * Example:
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 /** 136 /**
137 * Populate the sites list for display. 137 * Populate the sites list for display.
138 * @private 138 * @private
139 */ 139 */
140 populateList_: function() { 140 populateList_: function() {
141 var newList = []; 141 var newList = [];
142 var pref = this.getPref( 142 var pref = this.getPref(
143 this.computeCategoryExceptionsPrefName(this.category)); 143 this.computeCategoryExceptionsPrefName(this.category));
144 var sites = pref.value; 144 var sites = pref.value;
145 for (var origin in sites) { 145 for (var origin in sites) {
146 if (sites[origin].setting == this.categorySubtype) { 146 /** @type {{setting:Number}}*/
Dan Beam 2015/11/09 19:28:55 this @type doesn't make sense here, but this might
Finnur 2015/11/10 11:58:50 It is modeled after other code in the tree and did
Dan Beam 2015/11/11 07:01:39 i think it's just confusing the compiler into thin
147 var setting = sites[origin].setting;
Finnur 2015/11/09 15:56:09 Is this (and the change in onOriginTap_) the right
Dan Beam 2015/11/09 19:28:55 Number -> number
Finnur 2015/11/10 11:58:50 Bah. That's unfortunate (Polymer wanting |Number|,
Dan Beam 2015/11/11 07:01:39 Polymer({ properties: { doUseWrappers: {
148 if (setting == this.categorySubtype) {
147 var tokens = origin.split(','); 149 var tokens = origin.split(',');
148 newList.push({url: tokens[0]}); 150 newList.push({url: tokens[0]});
149 } 151 }
150 } 152 }
151 153
152 this.sites_ = newList; 154 this.sites_ = newList;
153 }, 155 },
154 156
155 /** 157 /**
156 * Setup the values to use for the action menu. 158 * Setup the values to use for the action menu.
157 * @private 159 * @private
158 */ 160 */
159 setUpActionMenu_: function() { 161 setUpActionMenu_: function() {
160 this.showAllowAction_ = 162 this.showAllowAction_ =
161 this.categorySubtype == settings.DefaultValues.BLOCK; 163 this.categorySubtype == settings.DefaultValues.BLOCK;
162 this.showBlockAction_ = 164 this.showBlockAction_ =
163 this.categorySubtype == settings.DefaultValues.ALLOW && 165 this.categorySubtype == settings.DefaultValues.ALLOW &&
164 this.category != settings.ContentSettingsTypes.FULLSCREEN; 166 this.category != settings.ContentSettingsTypes.FULLSCREEN;
165 }, 167 },
166 168
167 /** 169 /**
168 * A handler for selecting a site (by clicking on the origin). 170 * A handler for selecting a site (by clicking on the origin).
169 * @private 171 * @private
170 */ 172 */
171 onOriginTap_: function(event) { 173 onOriginTap_: function(event) {
174 /** @type {{model:Object}}*/
Dan Beam 2015/11/09 19:28:55 i don't understand what this is supposed to do? a
Finnur 2015/11/10 00:39:43 Um... I think so. Well, the error (as I recall, I'
Dan Beam 2015/11/10 05:58:58 have you actually been able to run the compiler?
Finnur 2015/11/10 11:58:50 Yes, couldn't be doing this without it -- got the
172 this.selectedOrigin = event.model.item.url; 175 this.selectedOrigin = event.model.item.url;
173 }, 176 },
174 177
175 /** 178 /**
176 * A handler for activating one of the menu action items. 179 * A handler for activating one of the menu action items.
177 * @private 180 * @private
178 */ 181 */
179 onActionMenuIronSelect_: function(event) { 182 onActionMenuIronSelect_: function(event) {
180 // TODO(finnur): Implement. 183 // TODO(finnur): Implement.
181 }, 184 },
182 185
183 /** 186 /**
184 * Returns the appropriate header value for display. 187 * Returns the appropriate header value for display.
185 * @param {array<string>} siteList The list of all sites to display for this 188 * @param {Array<string>} siteList The list of all sites to display for this
186 * category subtype. 189 * category subtype.
187 * @param {boolean} toggleState The state of the global toggle for this 190 * @param {boolean} toggleState The state of the global toggle for this
188 * category. 191 * category.
189 * @private 192 * @private
190 */ 193 */
191 computeSiteListHeader_: function(siteList, toggleState) { 194 computeSiteListHeader_: function(siteList, toggleState) {
192 if (this.categorySubtype == settings.DefaultValues.ALLOW) { 195 if (this.categorySubtype == settings.DefaultValues.ALLOW) {
193 return loadTimeData.getStringF( 196 return loadTimeData.getStringF(
194 'titleAndCount', 197 'titleAndCount',
195 loadTimeData.getString( 198 loadTimeData.getString(
(...skipping 10 matching lines...) Expand all
206 /** 209 /**
207 * Returns true if this widget is showing the allow list. 210 * Returns true if this widget is showing the allow list.
208 * @private 211 * @private
209 */ 212 */
210 isAllowList_: function() { 213 isAllowList_: function() {
211 return this.categorySubtype == settings.DefaultValues.ALLOW; 214 return this.categorySubtype == settings.DefaultValues.ALLOW;
212 }, 215 },
213 216
214 /** 217 /**
215 * Returns whether to show the site list. 218 * Returns whether to show the site list.
216 * @param {array} siteList The list of all sites to display for this category 219 * @param {Array} siteList The list of all sites to display for this category
217 * subtype. 220 * subtype.
218 * @param {boolean} toggleState The state of the global toggle for this 221 * @param {boolean} toggleState The state of the global toggle for this
219 * category. 222 * category.
220 * @private 223 * @private
221 */ 224 */
222 showSiteList_: function(siteList, toggleState) { 225 showSiteList_: function(siteList, toggleState) {
223 if (siteList.length == 0) 226 if (siteList.length == 0)
224 return false; 227 return false;
225 // The Block list is only shown when the category is set to Allow since it 228 // The Block list is only shown when the category is set to Allow since it
226 // is redundant to also list all the sites that are blocked. 229 // is redundant to also list all the sites that are blocked.
227 if (this.isAllowList_()) 230 if (this.isAllowList_())
228 return true; 231 return true;
229 232
230 return toggleState; 233 return toggleState;
231 }, 234 },
232 235
233 /** 236 /**
234 * Returns the icon to use for a given site. 237 * Returns the icon to use for a given site.
235 * @param {string} url The url of the site to fetch the icon for. 238 * @param {string} url The url of the site to fetch the icon for.
236 * @private 239 * @private
237 */ 240 */
238 computeSiteIcon_: function(url) { 241 computeSiteIcon_: function(url) {
239 // TODO(finnur): For now, we're returning a placeholder image for each site 242 // TODO(finnur): For now, we're returning a placeholder image for each site
240 // but the actual favicon for each site will need to be returned. 243 // but the actual favicon for each site will need to be returned.
241 return 'communication:message'; 244 return 'communication:message';
242 }, 245 },
243 }); 246 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/site_settings/compiled_resources.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698