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 | 9 |
10 /** | 10 /** |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 * Removes redundant ports, such as port 80 for http and 443 for https. | 65 * Removes redundant ports, such as port 80 for http and 443 for https. |
66 * @param {string} url The URL to sanitize. | 66 * @param {string} url The URL to sanitize. |
67 * @return {string} The URL without redundant ports, if any. | 67 * @return {string} The URL without redundant ports, if any. |
68 */ | 68 */ |
69 sanitizePort: function(url) { | 69 sanitizePort: function(url) { |
70 var urlWithScheme = this.ensureUrlHasScheme(url); | 70 var urlWithScheme = this.ensureUrlHasScheme(url); |
71 if (urlWithScheme.startsWith('https://') && | 71 if (urlWithScheme.startsWith('https://') && |
72 urlWithScheme.endsWith(':443')) { | 72 urlWithScheme.endsWith(':443')) { |
73 return url.slice(0, -4); | 73 return url.slice(0, -4); |
74 } | 74 } |
75 if (urlWithScheme.startsWith('http://') && | 75 if (urlWithScheme.startsWith('http://') && urlWithScheme.endsWith(':80')) { |
76 urlWithScheme.endsWith(':80')) { | |
77 return url.slice(0, -3); | 76 return url.slice(0, -3); |
78 } | 77 } |
79 return url; | 78 return url; |
80 }, | 79 }, |
81 | 80 |
82 /** | 81 /** |
83 * Removes the wildcard prefix from a pattern string. | 82 * Removes the wildcard prefix from a pattern string. |
84 * @param {string} pattern The pattern to remove the wildcard from. | 83 * @param {string} pattern The pattern to remove the wildcard from. |
85 * @return {string} The resulting pattern. | 84 * @return {string} The resulting pattern. |
86 * @private | 85 * @private |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 setting: exception.setting, | 184 setting: exception.setting, |
186 enforcement: enforcement, | 185 enforcement: enforcement, |
187 controlledBy: controlledBy, | 186 controlledBy: controlledBy, |
188 }; | 187 }; |
189 }, | 188 }, |
190 | 189 |
191 }; | 190 }; |
192 | 191 |
193 /** @polymerBehavior */ | 192 /** @polymerBehavior */ |
194 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; | 193 var SiteSettingsBehavior = [SiteSettingsBehaviorImpl]; |
OLD | NEW |