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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 return url.slice(0, -4); | 383 return url.slice(0, -4); |
384 } | 384 } |
385 if (urlWithScheme.startsWith('http://') && | 385 if (urlWithScheme.startsWith('http://') && |
386 urlWithScheme.endsWith(':80')) { | 386 urlWithScheme.endsWith(':80')) { |
387 return url.slice(0, -3); | 387 return url.slice(0, -3); |
388 } | 388 } |
389 return url; | 389 return url; |
390 }, | 390 }, |
391 | 391 |
392 /** | 392 /** |
393 * Adds the wildcard prefix to a pattern string. | 393 * Adds the wildcard prefix to a pattern string (if missing). |
394 * @param {string} pattern The pattern to add the wildcard to. | 394 * @param {string} pattern The pattern to add the wildcard to. |
395 * @return {string} The resulting pattern. | 395 * @return {string} The resulting pattern. |
396 * @private | 396 * @private |
397 */ | 397 */ |
398 addPatternWildcard: function(pattern) { | 398 addPatternWildcard: function(pattern) { |
399 if (pattern.indexOf('[*.]') > -1) | |
400 return pattern; | |
Finnur
2016/09/05 11:23:17
When the user manually enters a URL pattern with a
dschuyler
2016/09/06 18:20:29
Acknowledged.
| |
399 if (pattern.startsWith('http://')) | 401 if (pattern.startsWith('http://')) |
400 return pattern.replace('http://', 'http://[*.]'); | 402 return pattern.replace('http://', 'http://[*.]'); |
401 else if (pattern.startsWith('https://')) | 403 else if (pattern.startsWith('https://')) |
402 return pattern.replace('https://', 'https://[*.]'); | 404 return pattern.replace('https://', 'https://[*.]'); |
403 else | 405 else |
404 return '[*.]' + pattern; | 406 return '[*.]' + pattern; |
405 }, | 407 }, |
406 | 408 |
407 /** | 409 /** |
408 * Removes the wildcard prefix from a pattern string. | 410 * Removes the wildcard prefix from a pattern string. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 computeIsSettingEnabled: function(category, setting) { | 459 computeIsSettingEnabled: function(category, setting) { |
458 // FullScreen is Allow vs. Ask. | 460 // FullScreen is Allow vs. Ask. |
459 return category == settings.ContentSettingsTypes.FULLSCREEN ? | 461 return category == settings.ContentSettingsTypes.FULLSCREEN ? |
460 setting != settings.PermissionValues.ASK : | 462 setting != settings.PermissionValues.ASK : |
461 setting != settings.PermissionValues.BLOCK; | 463 setting != settings.PermissionValues.BLOCK; |
462 }, | 464 }, |
463 }; | 465 }; |
464 | 466 |
465 /** @polymerBehavior */ | 467 /** @polymerBehavior */ |
466 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; | 468 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; |
OLD | NEW |