OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/url_fixer/url_fixer.h" | 5 #include "components/url_fixer/url_fixer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 540 |
541 // We handle the filesystem scheme separately. | 541 // We handle the filesystem scheme separately. |
542 if (scheme == url::kFileSystemScheme) { | 542 if (scheme == url::kFileSystemScheme) { |
543 if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) | 543 if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) |
544 return GURL(text); | 544 return GURL(text); |
545 return GURL(); | 545 return GURL(); |
546 } | 546 } |
547 | 547 |
548 // Parse and rebuild about: and chrome: URLs, except about:blank. | 548 // Parse and rebuild about: and chrome: URLs, except about:blank. |
549 bool chrome_url = | 549 bool chrome_url = |
550 !LowerCaseEqualsASCII(trimmed, url::kAboutBlankURL) && | 550 !base::LowerCaseEqualsASCII(trimmed, url::kAboutBlankURL) && |
551 ((scheme == url::kAboutScheme) || (scheme == kChromeUIScheme)); | 551 ((scheme == url::kAboutScheme) || (scheme == kChromeUIScheme)); |
552 | 552 |
553 // For some schemes whose layouts we understand, we rebuild it. | 553 // For some schemes whose layouts we understand, we rebuild it. |
554 if (chrome_url || | 554 if (chrome_url || |
555 url::IsStandard(scheme.c_str(), | 555 url::IsStandard(scheme.c_str(), |
556 url::Component(0, static_cast<int>(scheme.length())))) { | 556 url::Component(0, static_cast<int>(scheme.length())))) { |
557 // Replace the about: scheme with the chrome: scheme. | 557 // Replace the about: scheme with the chrome: scheme. |
558 std::string url(chrome_url ? kChromeUIScheme : scheme); | 558 std::string url(chrome_url ? kChromeUIScheme : scheme); |
559 url.append(url::kStandardSchemeSeparator); | 559 url.append(url::kStandardSchemeSeparator); |
560 | 560 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 part->reset(); | 669 part->reset(); |
670 } | 670 } |
671 } | 671 } |
672 | 672 |
673 bool url_fixer::IsEquivalentScheme(const std::string& scheme1, | 673 bool url_fixer::IsEquivalentScheme(const std::string& scheme1, |
674 const std::string& scheme2) { | 674 const std::string& scheme2) { |
675 return scheme1 == scheme2 || | 675 return scheme1 == scheme2 || |
676 (scheme1 == url::kAboutScheme && scheme2 == kChromeUIScheme) || | 676 (scheme1 == url::kAboutScheme && scheme2 == kChromeUIScheme) || |
677 (scheme1 == kChromeUIScheme && scheme2 == url::kAboutScheme); | 677 (scheme1 == kChromeUIScheme && scheme2 == url::kAboutScheme); |
678 } | 678 } |
OLD | NEW |