| Index: chrome/common/content_settings_pattern.cc
|
| ===================================================================
|
| --- chrome/common/content_settings_pattern.cc (revision 130291)
|
| +++ chrome/common/content_settings_pattern.cc (working copy)
|
| @@ -313,33 +313,28 @@
|
| scoped_ptr<ContentSettingsPattern::BuilderInterface> builder(
|
| ContentSettingsPattern::CreateBuilder(false));
|
|
|
| - const GURL* local_url = &url;
|
| - if (url.SchemeIsFileSystem() && url.inner_url()) {
|
| - local_url = url.inner_url();
|
| - }
|
| - if (local_url->SchemeIsFile()) {
|
| - builder->WithScheme(local_url->scheme())->WithPath(local_url->path());
|
| + if (url.SchemeIsFile()) {
|
| + builder->WithScheme(url.scheme())->WithPath(url.path());
|
| } else {
|
| // Please keep the order of the ifs below as URLs with an IP as host can
|
| // also have a "http" scheme.
|
| - if (local_url->HostIsIPAddress()) {
|
| - builder->WithScheme(local_url->scheme())->WithHost(local_url->host());
|
| - } else if (local_url->SchemeIs(chrome::kHttpScheme)) {
|
| - builder->WithSchemeWildcard()->WithDomainWildcard()->WithHost(
|
| - local_url->host());
|
| - } else if (local_url->SchemeIs(chrome::kHttpsScheme)) {
|
| - builder->WithScheme(local_url->scheme())->WithDomainWildcard()->WithHost(
|
| - local_url->host());
|
| + if (url.HostIsIPAddress()) {
|
| + builder->WithScheme(url.scheme())->WithHost(url.host());
|
| + } else if (url.SchemeIs(chrome::kHttpScheme)) {
|
| + builder->WithSchemeWildcard()->WithDomainWildcard()->WithHost(url.host());
|
| + } else if (url.SchemeIs(chrome::kHttpsScheme)) {
|
| + builder->WithScheme(url.scheme())->WithDomainWildcard()->WithHost(
|
| + url.host());
|
| } else {
|
| // Unsupported scheme
|
| }
|
| - if (local_url->port().empty()) {
|
| - if (local_url->SchemeIs(chrome::kHttpsScheme))
|
| + if (url.port().empty()) {
|
| + if (url.SchemeIs(chrome::kHttpsScheme))
|
| builder->WithPort(GetDefaultPort(chrome::kHttpsScheme));
|
| else
|
| builder->WithPortWildcard();
|
| } else {
|
| - builder->WithPort(local_url->port());
|
| + builder->WithPort(url.port());
|
| }
|
| }
|
| return builder->Build();
|
| @@ -351,18 +346,14 @@
|
| scoped_ptr<ContentSettingsPattern::BuilderInterface> builder(
|
| ContentSettingsPattern::CreateBuilder(false));
|
|
|
| - const GURL* local_url = &url;
|
| - if (url.SchemeIsFileSystem() && url.inner_url()) {
|
| - local_url = url.inner_url();
|
| - }
|
| - if (local_url->SchemeIsFile()) {
|
| - builder->WithScheme(local_url->scheme())->WithPath(local_url->path());
|
| + if (url.SchemeIsFile()) {
|
| + builder->WithScheme(url.scheme())->WithPath(url.path());
|
| } else {
|
| - builder->WithScheme(local_url->scheme())->WithHost(local_url->host());
|
| - if (local_url->port().empty()) {
|
| - builder->WithPort(GetDefaultPort(local_url->scheme()));
|
| + builder->WithScheme(url.scheme())->WithHost(url.host());
|
| + if (url.port().empty()) {
|
| + builder->WithPort(GetDefaultPort(url.scheme()));
|
| } else {
|
| - builder->WithPort(local_url->port());
|
| + builder->WithPort(url.port());
|
| }
|
| }
|
| return builder->Build();
|
| @@ -423,13 +414,8 @@
|
| if (!is_valid_)
|
| return false;
|
|
|
| - const GURL* local_url = &url;
|
| - if (url.SchemeIsFileSystem() && url.inner_url()) {
|
| - local_url = url.inner_url();
|
| - }
|
| -
|
| // Match the scheme part.
|
| - const std::string scheme(local_url->scheme());
|
| + const std::string scheme(url.scheme());
|
| if (!parts_.is_scheme_wildcard &&
|
| parts_.scheme != scheme) {
|
| return false;
|
| @@ -437,17 +423,11 @@
|
|
|
| // File URLs have no host. Matches if the pattern has the path wildcard set,
|
| // or if the path in the URL is identical to the one in the pattern.
|
| - // For filesystem:file URLs, the path used is the filesystem type, so all
|
| - // filesystem:file:///temporary/... are equivalent.
|
| - // TODO(markusheintz): Content settings should be defined for all files on
|
| - // a machine. Unless there is a good use case for supporting paths for file
|
| - // patterns, stop supporting path for file patterns.
|
| if (!parts_.is_scheme_wildcard && scheme == chrome::kFileScheme)
|
| - return parts_.is_path_wildcard ||
|
| - parts_.path == std::string(local_url->path());
|
| + return parts_.is_path_wildcard || parts_.path == std::string(url.path());
|
|
|
| // Match the host part.
|
| - const std::string host(net::TrimEndingDot(local_url->host()));
|
| + const std::string host(net::TrimEndingDot(url.host()));
|
| if (!parts_.has_domain_wildcard) {
|
| if (parts_.host != host)
|
| return false;
|
| @@ -461,7 +441,7 @@
|
| return true;
|
|
|
| // Match the port part.
|
| - std::string port(local_url->port());
|
| + std::string port(url.port());
|
|
|
| // Use the default port if the port string is empty. GURL returns an empty
|
| // string if no port at all was specified or if the default port was
|
|
|