Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: chrome/common/net/url_fixer_upper.cc

Issue 325443002: Move about://-related constants from //content to //url (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 url::kFtpScheme : url::kHttpScheme; 427 url::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 != url::kAboutScheme) &&
433 (scheme != content::kChromeUIScheme) && 433 (scheme != content::kChromeUIScheme) &&
434 ((scheme == url::kFileScheme) || 434 ((scheme == url::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()))))) {
438 return scheme; 438 return scheme;
439 } 439 }
440 440
441 if (scheme == url::kFileSystemScheme) { 441 if (scheme == url::kFileSystemScheme) {
442 // Have the GURL parser do the heavy lifting for us. 442 // Have the GURL parser do the heavy lifting for us.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 return GURL(parts.scheme.is_valid() ? text : FixupPath(text)); 528 return GURL(parts.scheme.is_valid() ? text : FixupPath(text));
529 529
530 // We handle the filesystem scheme separately. 530 // We handle the filesystem scheme separately.
531 if (scheme == url::kFileSystemScheme) { 531 if (scheme == url::kFileSystemScheme) {
532 if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) 532 if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid())
533 return GURL(text); 533 return GURL(text);
534 return GURL(); 534 return GURL();
535 } 535 }
536 536
537 // Parse and rebuild about: and chrome: URLs, except about:blank. 537 // Parse and rebuild about: and chrome: URLs, except about:blank.
538 bool chrome_url = !LowerCaseEqualsASCII(trimmed, content::kAboutBlankURL) && 538 bool chrome_url = !LowerCaseEqualsASCII(trimmed, url::kAboutBlankURL) &&
539 ((scheme == content::kAboutScheme) || 539 ((scheme == url::kAboutScheme) ||
540 (scheme == content::kChromeUIScheme)); 540 (scheme == content::kChromeUIScheme));
541 541
542 // For some schemes whose layouts we understand, we rebuild it. 542 // For some schemes whose layouts we understand, we rebuild it.
543 if (chrome_url || 543 if (chrome_url ||
544 url::IsStandard(scheme.c_str(), 544 url::IsStandard(scheme.c_str(),
545 url::Component(0, static_cast<int>(scheme.length())))) { 545 url::Component(0, static_cast<int>(scheme.length())))) {
546 // Replace the about: scheme with the chrome: scheme. 546 // Replace the about: scheme with the chrome: scheme.
547 std::string url(chrome_url ? content::kChromeUIScheme : scheme); 547 std::string url(chrome_url ? content::kChromeUIScheme : scheme);
548 url.append(content::kStandardSchemeSeparator); 548 url.append(content::kStandardSchemeSeparator);
549 549
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698