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 "chrome/common/net/url_fixer_upper.h" | 5 #include "chrome/common/net/url_fixer_upper.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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 (*text)[semicolon] = ':'; | 417 (*text)[semicolon] = ':'; |
418 if (GetValidScheme(*text, &parts->scheme, &scheme)) | 418 if (GetValidScheme(*text, &parts->scheme, &scheme)) |
419 found_scheme = true; | 419 found_scheme = true; |
420 else | 420 else |
421 (*text)[semicolon] = ';'; | 421 (*text)[semicolon] = ';'; |
422 } | 422 } |
423 if (!found_scheme) { | 423 if (!found_scheme) { |
424 // Couldn't determine the scheme, so just pick one. | 424 // Couldn't determine the scheme, so just pick one. |
425 parts->scheme.reset(); | 425 parts->scheme.reset(); |
426 scheme = StartsWithASCII(*text, "ftp.", false) ? | 426 scheme = StartsWithASCII(*text, "ftp.", false) ? |
427 content::kFtpScheme : content::kHttpScheme; | 427 content::kFtpScheme : url::kHttpScheme; |
428 } | 428 } |
429 } | 429 } |
430 | 430 |
431 // Proceed with about and chrome schemes, but not file or nonstandard schemes. | 431 // Proceed with about and chrome schemes, but not file or nonstandard schemes. |
432 if ((scheme != content::kAboutScheme) && | 432 if ((scheme != content::kAboutScheme) && |
433 (scheme != content::kChromeUIScheme) && | 433 (scheme != content::kChromeUIScheme) && |
434 ((scheme == content::kFileScheme) || | 434 ((scheme == content::kFileScheme) || |
435 !url::IsStandard(scheme.c_str(), | 435 !url::IsStandard(scheme.c_str(), |
436 url::Component(0, | 436 url::Component(0, |
437 static_cast<int>(scheme.length()))))) { | 437 static_cast<int>(scheme.length()))))) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 | 646 |
647 if (part->is_valid()) { | 647 if (part->is_valid()) { |
648 // Offset the location of this component. | 648 // Offset the location of this component. |
649 part->begin += offset; | 649 part->begin += offset; |
650 | 650 |
651 // This part might not have existed in the original text. | 651 // This part might not have existed in the original text. |
652 if (part->begin < 0) | 652 if (part->begin < 0) |
653 part->reset(); | 653 part->reset(); |
654 } | 654 } |
655 } | 655 } |
OLD | NEW |