| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/content_settings/content_settings_pattern.h" | 5 #include "chrome/browser/content_settings/content_settings_pattern.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 builder->WithScheme(url.scheme())->WithHost(url.host()); | 294 builder->WithScheme(url.scheme())->WithHost(url.host()); |
| 295 } else if (url.SchemeIs(chrome::kHttpScheme)) { | 295 } else if (url.SchemeIs(chrome::kHttpScheme)) { |
| 296 builder->WithSchemeWildcard()->WithDomainWildcard()->WithHost(url.host()); | 296 builder->WithSchemeWildcard()->WithDomainWildcard()->WithHost(url.host()); |
| 297 } else if (url.SchemeIs(chrome::kHttpsScheme)) { | 297 } else if (url.SchemeIs(chrome::kHttpsScheme)) { |
| 298 builder->WithScheme(url.scheme())->WithDomainWildcard()->WithHost( | 298 builder->WithScheme(url.scheme())->WithDomainWildcard()->WithHost( |
| 299 url.host()); | 299 url.host()); |
| 300 } else { | 300 } else { |
| 301 // Unsupported scheme | 301 // Unsupported scheme |
| 302 } | 302 } |
| 303 if (url.port().empty()) { | 303 if (url.port().empty()) { |
| 304 builder->WithPortWildcard(); | 304 if (url.SchemeIs(chrome::kHttpsScheme)) |
| 305 builder->WithPort(GetDefaultPort(chrome::kHttpsScheme)); |
| 306 else |
| 307 builder->WithPortWildcard(); |
| 305 } else { | 308 } else { |
| 306 builder->WithPort(url.port()); | 309 builder->WithPort(url.port()); |
| 307 } | 310 } |
| 308 } | 311 } |
| 309 return builder->Build(); | 312 return builder->Build(); |
| 310 } | 313 } |
| 311 | 314 |
| 312 // static | 315 // static |
| 313 ContentSettingsPattern ContentSettingsPattern::FromURLNoWildcard( | 316 ContentSettingsPattern ContentSettingsPattern::FromURLNoWildcard( |
| 314 const GURL& url) { | 317 const GURL& url) { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 if (!parts.is_port_wildcard && other_parts.is_port_wildcard) | 596 if (!parts.is_port_wildcard && other_parts.is_port_wildcard) |
| 594 return ContentSettingsPattern::PREDECESSOR; | 597 return ContentSettingsPattern::PREDECESSOR; |
| 595 | 598 |
| 596 int result = parts.port.compare(other_parts.port); | 599 int result = parts.port.compare(other_parts.port); |
| 597 if (result == 0) | 600 if (result == 0) |
| 598 return ContentSettingsPattern::IDENTITY; | 601 return ContentSettingsPattern::IDENTITY; |
| 599 if (result > 0) | 602 if (result > 0) |
| 600 return ContentSettingsPattern::DISJOINT_ORDER_PRE; | 603 return ContentSettingsPattern::DISJOINT_ORDER_PRE; |
| 601 return ContentSettingsPattern::DISJOINT_ORDER_POST; | 604 return ContentSettingsPattern::DISJOINT_ORDER_POST; |
| 602 } | 605 } |
| OLD | NEW |