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

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

Issue 191293009: Cleanup: Move kAboutScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 421 }
422 if (!found_scheme) { 422 if (!found_scheme) {
423 // Couldn't determine the scheme, so just pick one. 423 // Couldn't determine the scheme, so just pick one.
424 parts->scheme.reset(); 424 parts->scheme.reset();
425 scheme = StartsWithASCII(*text, "ftp.", false) ? 425 scheme = StartsWithASCII(*text, "ftp.", false) ?
426 content::kFtpScheme : content::kHttpScheme; 426 content::kFtpScheme : content::kHttpScheme;
427 } 427 }
428 } 428 }
429 429
430 // Proceed with about and chrome schemes, but not file or nonstandard schemes. 430 // Proceed with about and chrome schemes, but not file or nonstandard schemes.
431 if ((scheme != chrome::kAboutScheme) && 431 if ((scheme != content::kAboutScheme) &&
432 (scheme != content::kChromeUIScheme) && 432 (scheme != content::kChromeUIScheme) &&
433 ((scheme == content::kFileScheme) || 433 ((scheme == content::kFileScheme) ||
434 !url_util::IsStandard( 434 !url_util::IsStandard(
435 scheme.c_str(), 435 scheme.c_str(),
436 url_parse::Component(0, static_cast<int>(scheme.length()))))) 436 url_parse::Component(0, static_cast<int>(scheme.length())))))
437 return scheme; 437 return scheme;
438 438
439 if (scheme == content::kFileSystemScheme) { 439 if (scheme == content::kFileSystemScheme) {
440 // Have the GURL parser do the heavy lifting for us. 440 // Have the GURL parser do the heavy lifting for us.
441 url_parse::ParseFileSystemURL(text->data(), 441 url_parse::ParseFileSystemURL(text->data(),
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 528
529 // We handle the filesystem scheme separately. 529 // We handle the filesystem scheme separately.
530 if (scheme == content::kFileSystemScheme) { 530 if (scheme == content::kFileSystemScheme) {
531 if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) 531 if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid())
532 return GURL(text); 532 return GURL(text);
533 return GURL(); 533 return GURL();
534 } 534 }
535 535
536 // Parse and rebuild about: and chrome: URLs, except about:blank. 536 // Parse and rebuild about: and chrome: URLs, except about:blank.
537 bool chrome_url = !LowerCaseEqualsASCII(trimmed, content::kAboutBlankURL) && 537 bool chrome_url = !LowerCaseEqualsASCII(trimmed, content::kAboutBlankURL) &&
538 ((scheme == chrome::kAboutScheme) || 538 ((scheme == content::kAboutScheme) ||
539 (scheme == content::kChromeUIScheme)); 539 (scheme == content::kChromeUIScheme));
540 540
541 // For some schemes whose layouts we understand, we rebuild it. 541 // For some schemes whose layouts we understand, we rebuild it.
542 if (chrome_url || url_util::IsStandard(scheme.c_str(), 542 if (chrome_url || url_util::IsStandard(scheme.c_str(),
543 url_parse::Component(0, static_cast<int>(scheme.length())))) { 543 url_parse::Component(0, static_cast<int>(scheme.length())))) {
544 // Replace the about: scheme with the chrome: scheme. 544 // Replace the about: scheme with the chrome: scheme.
545 std::string url(chrome_url ? content::kChromeUIScheme : scheme); 545 std::string url(chrome_url ? content::kChromeUIScheme : scheme);
546 url.append(content::kStandardSchemeSeparator); 546 url.append(content::kStandardSchemeSeparator);
547 547
548 // We need to check whether the |username| is valid because it is our 548 // We need to check whether the |username| is valid because it is our
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 644
645 if (part->is_valid()) { 645 if (part->is_valid()) {
646 // Offset the location of this component. 646 // Offset the location of this component.
647 part->begin += offset; 647 part->begin += offset;
648 648
649 // This part might not have existed in the original text. 649 // This part might not have existed in the original text.
650 if (part->begin < 0) 650 if (part->begin < 0)
651 part->reset(); 651 part->reset();
652 } 652 }
653 } 653 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/origin_chip_info.cc ('k') | chrome/utility/importer/bookmarks_file_importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698