| 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 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 531 |
| 532 // We handle the filesystem scheme separately. | 532 // We handle the filesystem scheme separately. |
| 533 if (scheme == url::kFileSystemScheme) { | 533 if (scheme == url::kFileSystemScheme) { |
| 534 if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) | 534 if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) |
| 535 return GURL(text); | 535 return GURL(text); |
| 536 return GURL(); | 536 return GURL(); |
| 537 } | 537 } |
| 538 | 538 |
| 539 // Parse and rebuild about: and chrome: URLs, except about:blank. | 539 // Parse and rebuild about: and chrome: URLs, except about:blank. |
| 540 bool chrome_url = | 540 bool chrome_url = |
| 541 !LowerCaseEqualsASCII(trimmed, url::kAboutBlankURL) && | 541 !base::LowerCaseEqualsASCII(trimmed, url::kAboutBlankURL) && |
| 542 ((scheme == url::kAboutScheme) || (scheme == kChromeUIScheme)); | 542 ((scheme == url::kAboutScheme) || (scheme == kChromeUIScheme)); |
| 543 | 543 |
| 544 // For some schemes whose layouts we understand, we rebuild it. | 544 // For some schemes whose layouts we understand, we rebuild it. |
| 545 if (chrome_url || | 545 if (chrome_url || |
| 546 url::IsStandard(scheme.c_str(), | 546 url::IsStandard(scheme.c_str(), |
| 547 url::Component(0, static_cast<int>(scheme.length())))) { | 547 url::Component(0, static_cast<int>(scheme.length())))) { |
| 548 // Replace the about: scheme with the chrome: scheme. | 548 // Replace the about: scheme with the chrome: scheme. |
| 549 std::string url(chrome_url ? kChromeUIScheme : scheme); | 549 std::string url(chrome_url ? kChromeUIScheme : scheme); |
| 550 url.append(url::kStandardSchemeSeparator); | 550 url.append(url::kStandardSchemeSeparator); |
| 551 | 551 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 | 653 |
| 654 if (part->is_valid()) { | 654 if (part->is_valid()) { |
| 655 // Offset the location of this component. | 655 // Offset the location of this component. |
| 656 part->begin += offset; | 656 part->begin += offset; |
| 657 | 657 |
| 658 // This part might not have existed in the original text. | 658 // This part might not have existed in the original text. |
| 659 if (part->begin < 0) | 659 if (part->begin < 0) |
| 660 part->reset(); | 660 part->reset(); |
| 661 } | 661 } |
| 662 } | 662 } |
| OLD | NEW |