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

Unified Diff: chrome/browser/autocomplete/autocomplete.cc

Issue 7811006: Add full support for filesystem URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test updates Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/autocomplete.cc
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index e6404e44c1c3601421a6bc831baf296b7244b536..1093b87f7bea753ec49969bcfe856af288de2862 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -90,6 +90,7 @@ AutocompleteInput::AutocompleteInput(const string16& text,
if (((type_ == UNKNOWN) || (type_ == REQUESTED_URL) || (type_ == URL)) &&
canonicalized_url.is_valid() &&
(!canonicalized_url.IsStandard() || canonicalized_url.SchemeIsFile() ||
+ canonicalized_url.SchemeIsFileSystem() ||
!canonicalized_url.host().empty()))
canonicalized_url_ = canonicalized_url;
@@ -161,6 +162,15 @@ AutocompleteInput::Type AutocompleteInput::Parse(
return URL;
}
+ if (LowerCaseEqualsASCII(parsed_scheme, chrome::kFileSystemScheme)) {
sky 2012/02/15 16:17:28 Can you add test coverage for these cases?
ericu 2012/02/16 01:42:56 Done.
+ // This could theoretically be a strange search, but let's check.
+ ParseFileSystemURL(text.data(), text.length(), parts);
+ // If it's got an inner_url with a scheme, it's a URL, whether it's valid or
+ // not.
+ if (parts->inner_parsed() && parts->inner_parsed()->scheme.is_valid())
+ return URL;
+ }
+
// If the user typed a scheme, and it's HTTP or HTTPS, we know how to parse it
// well enough that we can fall through to the heuristics below. If it's
// something else, we can just determine our action based on what we do with
@@ -450,6 +460,9 @@ void AutocompleteInput::ParseForEmphasizeComponents(
host->reset();
}
}
+ } else if (LowerCaseEqualsASCII(scheme_str, chrome::kFileSystemScheme) &&
+ parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) {
sky 2012/02/15 16:17:28 spacing is off.
ericu 2012/02/15 22:48:09 Got it.
+ *host = parts.inner_parsed()->host;
}
}

Powered by Google App Engine
This is Rietveld 408576698