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

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: Address feedback 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 var setting = /** @type {{setting: number}} */((sites[origin]).setting);
Dan Beam 2015/11/11 07:01:39 this is also casting incorrectly because you're sa
147 if (setting == this.categorySubtype) {
147 var tokens = origin.split(','); 148 var tokens = origin.split(',');
148 newList.push({url: tokens[0]}); 149 newList.push({url: tokens[0]});
149 } 150 }
150 } 151 }
151 152
152 this.sites_ = newList; 153 this.sites_ = newList;
153 }, 154 },
154 155
155 /** 156 /**
156 * Setup the values to use for the action menu. 157 * Setup the values to use for the action menu.
157 * @private 158 * @private
158 */ 159 */
159 setUpActionMenu_: function() { 160 setUpActionMenu_: function() {
160 this.showAllowAction_ = 161 this.showAllowAction_ =
161 this.categorySubtype == settings.DefaultValues.BLOCK; 162 this.categorySubtype == settings.DefaultValues.BLOCK;
162 this.showBlockAction_ = 163 this.showBlockAction_ =
163 this.categorySubtype == settings.DefaultValues.ALLOW && 164 this.categorySubtype == settings.DefaultValues.ALLOW &&
164 this.category != settings.ContentSettingsTypes.FULLSCREEN; 165 this.category != settings.ContentSettingsTypes.FULLSCREEN;
165 }, 166 },
166 167
167 /** 168 /**
168 * A handler for selecting a site (by clicking on the origin). 169 * A handler for selecting a site (by clicking on the origin).
169 * @private 170 * @private
170 */ 171 */
171 onOriginTap_: function(event) { 172 onOriginTap_: function(event) {
173 /** @type {{model:Object}}*/
Dan Beam 2015/11/11 07:01:39 the current code means "this.selectedOrigin is an
172 this.selectedOrigin = event.model.item.url; 174 this.selectedOrigin = event.model.item.url;
173 }, 175 },
174 176
175 /** 177 /**
176 * A handler for activating one of the menu action items. 178 * A handler for activating one of the menu action items.
177 * @private 179 * @private
178 */ 180 */
179 onActionMenuIronSelect_: function(event) { 181 onActionMenuIronSelect_: function(event) {
180 // TODO(finnur): Implement. 182 // TODO(finnur): Implement.
181 }, 183 },
182 184
183 /** 185 /**
184 * Returns the appropriate header value for display. 186 * Returns the appropriate header value for display.
185 * @param {array<string>} siteList The list of all sites to display for this 187 * @param {Array<string>} siteList The list of all sites to display for this
186 * category subtype. 188 * category subtype.
187 * @param {boolean} toggleState The state of the global toggle for this 189 * @param {boolean} toggleState The state of the global toggle for this
188 * category. 190 * category.
189 * @private 191 * @private
190 */ 192 */
191 computeSiteListHeader_: function(siteList, toggleState) { 193 computeSiteListHeader_: function(siteList, toggleState) {
192 if (this.categorySubtype == settings.DefaultValues.ALLOW) { 194 if (this.categorySubtype == settings.DefaultValues.ALLOW) {
193 return loadTimeData.getStringF( 195 return loadTimeData.getStringF(
194 'titleAndCount', 196 'titleAndCount',
195 loadTimeData.getString( 197 loadTimeData.getString(
(...skipping 10 matching lines...) Expand all
206 /** 208 /**
207 * Returns true if this widget is showing the allow list. 209 * Returns true if this widget is showing the allow list.
208 * @private 210 * @private
209 */ 211 */
210 isAllowList_: function() { 212 isAllowList_: function() {
211 return this.categorySubtype == settings.DefaultValues.ALLOW; 213 return this.categorySubtype == settings.DefaultValues.ALLOW;
212 }, 214 },
213 215
214 /** 216 /**
215 * Returns whether to show the site list. 217 * Returns whether to show the site list.
216 * @param {array} siteList The list of all sites to display for this category 218 * @param {Array} siteList The list of all sites to display for this category
217 * subtype. 219 * subtype.
218 * @param {boolean} toggleState The state of the global toggle for this 220 * @param {boolean} toggleState The state of the global toggle for this
219 * category. 221 * category.
220 * @private 222 * @private
221 */ 223 */
222 showSiteList_: function(siteList, toggleState) { 224 showSiteList_: function(siteList, toggleState) {
223 if (siteList.length == 0) 225 if (siteList.length == 0)
224 return false; 226 return false;
225 // The Block list is only shown when the category is set to Allow since it 227 // 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. 228 // is redundant to also list all the sites that are blocked.
227 if (this.isAllowList_()) 229 if (this.isAllowList_())
228 return true; 230 return true;
229 231
230 return toggleState; 232 return toggleState;
231 }, 233 },
232 234
233 /** 235 /**
234 * Returns the icon to use for a given site. 236 * Returns the icon to use for a given site.
235 * @param {string} url The url of the site to fetch the icon for. 237 * @param {string} url The url of the site to fetch the icon for.
236 * @private 238 * @private
237 */ 239 */
238 computeSiteIcon_: function(url) { 240 computeSiteIcon_: function(url) {
239 // TODO(finnur): For now, we're returning a placeholder image for each site 241 // 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. 242 // but the actual favicon for each site will need to be returned.
241 return 'communication:message'; 243 return 'communication:message';
242 }, 244 },
243 }); 245 });
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