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

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

Issue 120593003: Move kFileScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 if (!found_scheme) { 419 if (!found_scheme) {
420 // Couldn't determine the scheme, so just pick one. 420 // Couldn't determine the scheme, so just pick one.
421 parts->scheme.reset(); 421 parts->scheme.reset();
422 scheme.assign(StartsWithASCII(*text, "ftp.", false) ? 422 scheme.assign(StartsWithASCII(*text, "ftp.", false) ?
423 content::kFtpScheme : content::kHttpScheme); 423 content::kFtpScheme : content::kHttpScheme);
424 } 424 }
425 } 425 }
426 426
427 // Proceed with about and chrome schemes, but not file or nonstandard schemes. 427 // Proceed with about and chrome schemes, but not file or nonstandard schemes.
428 if ((scheme != chrome::kAboutScheme) && (scheme != chrome::kChromeUIScheme) && 428 if ((scheme != chrome::kAboutScheme) && (scheme != chrome::kChromeUIScheme) &&
429 ((scheme == chrome::kFileScheme) || !url_util::IsStandard(scheme.c_str(), 429 ((scheme == content::kFileScheme) || !url_util::IsStandard(scheme.c_str(),
430 url_parse::Component(0, static_cast<int>(scheme.length()))))) 430 url_parse::Component(0, static_cast<int>(scheme.length())))))
431 return scheme; 431 return scheme;
432 432
433 if (scheme == content::kFileSystemScheme) { 433 if (scheme == content::kFileSystemScheme) {
434 // Have the GURL parser do the heavy lifting for us. 434 // Have the GURL parser do the heavy lifting for us.
435 url_parse::ParseFileSystemURL(text->data(), 435 url_parse::ParseFileSystemURL(text->data(),
436 static_cast<int>(text->length()), parts); 436 static_cast<int>(text->length()), parts);
437 return scheme; 437 return scheme;
438 } 438 }
439 439
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // Reject "view-source:view-source:..." to avoid deep recursion. 510 // Reject "view-source:view-source:..." to avoid deep recursion.
511 std::string view_source(content::kViewSourceScheme + std::string(":")); 511 std::string view_source(content::kViewSourceScheme + std::string(":"));
512 if (!StartsWithASCII(text, view_source + view_source, false)) { 512 if (!StartsWithASCII(text, view_source + view_source, false)) {
513 return GURL(content::kViewSourceScheme + std::string(":") + 513 return GURL(content::kViewSourceScheme + std::string(":") +
514 FixupURL(trimmed.substr(scheme.length() + 1), 514 FixupURL(trimmed.substr(scheme.length() + 1),
515 desired_tld).possibly_invalid_spec()); 515 desired_tld).possibly_invalid_spec());
516 } 516 }
517 } 517 }
518 518
519 // We handle the file scheme separately. 519 // We handle the file scheme separately.
520 if (scheme == chrome::kFileScheme) 520 if (scheme == content::kFileScheme)
521 return GURL(parts.scheme.is_valid() ? text : FixupPath(text)); 521 return GURL(parts.scheme.is_valid() ? text : FixupPath(text));
522 522
523 // We handle the filesystem scheme separately. 523 // We handle the filesystem scheme separately.
524 if (scheme == content::kFileSystemScheme) { 524 if (scheme == content::kFileSystemScheme) {
525 if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) 525 if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid())
526 return GURL(text); 526 return GURL(text);
527 return GURL(); 527 return GURL();
528 } 528 }
529 529
530 // Parse and rebuild about: and chrome: URLs, except about:blank. 530 // Parse and rebuild about: and chrome: URLs, except about:blank.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 637
638 if (part->is_valid()) { 638 if (part->is_valid()) {
639 // Offset the location of this component. 639 // Offset the location of this component.
640 part->begin += offset; 640 part->begin += offset;
641 641
642 // This part might not have existed in the original text. 642 // This part might not have existed in the original text.
643 if (part->begin < 0) 643 if (part->begin < 0)
644 part->reset(); 644 part->reset();
645 } 645 }
646 } 646 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/permission_message_util.cc ('k') | chrome/renderer/content_settings_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698