OLD | NEW |
---|---|
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 Behavior common to Site Settings classes. | 6 * @fileoverview Behavior common to Site Settings classes. |
7 */ | 7 */ |
8 | 8 |
9 /** @polymerBehavior */ | 9 /** @polymerBehavior */ |
10 var SiteSettingsBehaviorImpl = { | 10 var SiteSettingsBehaviorImpl = { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 return loadTimeData.getString('siteSettingsDontShowImages'); | 277 return loadTimeData.getString('siteSettingsDontShowImages'); |
278 } | 278 } |
279 return showRecommendation ? | 279 return showRecommendation ? |
280 loadTimeData.getString('siteSettingsShowAllRecommended') : | 280 loadTimeData.getString('siteSettingsShowAllRecommended') : |
281 loadTimeData.getString('siteSettingsShowAll'); | 281 loadTimeData.getString('siteSettingsShowAll'); |
282 default: | 282 default: |
283 assertNotReached(); | 283 assertNotReached(); |
284 return ''; | 284 return ''; |
285 } | 285 } |
286 }, | 286 }, |
287 | |
288 /** | |
289 * Ensures the URL has a scheme (assumes http if omitted). | |
290 * @param {string} url The URL with or without a scheme. | |
291 * @return {string} The URL with a scheme. | |
michaelpg
2016/04/11 03:55:35
... or the empty string
Finnur
2016/04/11 11:45:33
Done.
| |
292 */ | |
293 ensureUrlHasScheme: function(url) { | |
294 if (url.length == 0) return url; | |
295 return url.indexOf('://') != -1 ? url : 'http://' + url; | |
michaelpg
2016/04/11 03:55:35
url.includes
Finnur
2016/04/11 11:45:33
Done.
| |
296 }, | |
287 }; | 297 }; |
288 | 298 |
289 /** @polymerBehavior */ | 299 /** @polymerBehavior */ |
290 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; | 300 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; |
OLD | NEW |