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

Unified Diff: chrome/browser/net/url_fixer_upper.cc

Issue 6306011: Remove wstring from autocomplete. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/url_fixer_upper.cc
===================================================================
--- chrome/browser/net/url_fixer_upper.cc (revision 72388)
+++ chrome/browser/net/url_fixer_upper.cc (working copy)
@@ -72,7 +72,51 @@
parts->ref =
UTF8ComponentToWideComponent(text_utf8, parts_utf8.ref);
}
+#if defined(WCHAR_T_IS_UTF32)
+url_parse::Component UTF8ComponentToUTF16Component(
+ const std::string& text_utf8,
+ const url_parse::Component& component_utf8) {
+ if (component_utf8.len == -1)
+ return url_parse::Component();
+ std::string before_component_string =
+ text_utf8.substr(0, component_utf8.begin);
+ std::string component_string = text_utf8.substr(component_utf8.begin,
+ component_utf8.len);
+ string16 before_component_string_16 = UTF8ToUTF16(before_component_string);
+ string16 component_string_16 = UTF8ToUTF16(component_string);
+ url_parse::Component component_16(before_component_string_16.length(),
+ component_string_16.length());
+ return component_16;
+}
+
+void UTF8PartsToUTF16Parts(const std::string& text_utf8,
+ const url_parse::Parsed& parts_utf8,
+ url_parse::Parsed* parts) {
+ if (IsStringASCII(text_utf8)) {
+ *parts = parts_utf8;
+ return;
+ }
+
+ parts->scheme =
+ UTF8ComponentToUTF16Component(text_utf8, parts_utf8.scheme);
+ parts ->username =
+ UTF8ComponentToUTF16Component(text_utf8, parts_utf8.username);
+ parts->password =
+ UTF8ComponentToUTF16Component(text_utf8, parts_utf8.password);
+ parts->host =
+ UTF8ComponentToUTF16Component(text_utf8, parts_utf8.host);
+ parts->port =
+ UTF8ComponentToUTF16Component(text_utf8, parts_utf8.port);
+ parts->path =
+ UTF8ComponentToUTF16Component(text_utf8, parts_utf8.path);
+ parts->query =
+ UTF8ComponentToUTF16Component(text_utf8, parts_utf8.query);
+ parts->ref =
+ UTF8ComponentToUTF16Component(text_utf8, parts_utf8.ref);
+}
+#endif
+
TrimPositions TrimWhitespaceUTF8(const std::string& input,
TrimPositions positions,
std::string* output) {
@@ -581,6 +625,16 @@
UTF8PartsToWideParts(text_utf8, parts_utf8, parts);
return UTF8ToWide(scheme_utf8);
}
+#if defined(WCHAR_T_IS_UTF32)
+string16 URLFixerUpper::SegmentURL(const string16& text,
+ url_parse::Parsed* parts) {
+ std::string text_utf8 = UTF16ToUTF8(text);
+ url_parse::Parsed parts_utf8;
+ std::string scheme_utf8 = SegmentURL(text_utf8, &parts_utf8);
+ UTF8PartsToUTF16Parts(text_utf8, parts_utf8, parts);
+ return UTF8ToUTF16(scheme_utf8);
+}
+#endif
GURL URLFixerUpper::FixupRelativeFile(const std::wstring& base_dir,
const std::wstring& text) {
return FixupRelativeFile(FilePath::FromWStringHack(base_dir),
Property changes on: chrome/browser/net/url_fixer_upper.cc
___________________________________________________________________
Deleted: svn:mergeinfo

Powered by Google App Engine
This is Rietveld 408576698