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

Unified Diff: content/child/web_url_loader_impl.cc

Issue 2537953003: WebString: makes string16 conversions explicit (part 1: blink, content) (Closed)
Patch Set: fix Created 4 years 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
« no previous file with comments | « content/child/web_database_observer_impl.cc ('k') | content/child/web_url_request_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/web_url_loader_impl.cc
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index c138e0cd844d85ea23e844c8134f12c91631d965..1b1f67cb388239dbad6b17108d681938a9d0fb84 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -51,6 +51,8 @@
#include "net/ssl/ssl_cipher_suite_names.h"
#include "net/ssl/ssl_connection_status_flags.h"
#include "net/url_request/url_request_data_job.h"
+#include "third_party/WebKit/public/platform/FilePathConversion.h"
+#include "third_party/WebKit/public/platform/StringVectorCopier.h"
#include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
#include "third_party/WebKit/public/platform/WebSecurityStyle.h"
@@ -323,29 +325,13 @@ void SetSecurityStyleAndDetails(const GURL& url,
return;
}
- blink::WebVector<blink::WebString> web_san(san.size());
- std::transform(
- san.begin(),
- san.end(), web_san.begin(),
- [](const std::string& h) { return blink::WebString::fromLatin1(h); });
-
- blink::WebVector<blink::WebString> web_cert(info.certificate.size());
- std::transform(
- info.certificate.begin(),
- info.certificate.end(), web_cert.begin(),
- [](const std::string& h) { return blink::WebString::fromLatin1(h); });
-
blink::WebURLResponse::WebSecurityDetails webSecurityDetails(
WebString::fromUTF8(protocol), WebString::fromUTF8(key_exchange),
- WebString::fromUTF8(key_exchange_group),
- WebString::fromUTF8(cipher), WebString::fromUTF8(mac),
- WebString::fromUTF8(subject),
- web_san,
- WebString::fromUTF8(issuer),
- valid_start.ToDoubleT(),
- valid_expiry.ToDoubleT(),
- web_cert,
- sct_list);
+ WebString::fromUTF8(key_exchange_group), WebString::fromUTF8(cipher),
+ WebString::fromUTF8(mac), WebString::fromUTF8(subject),
+ blink::CopyStringVectorFromLatin1(san), WebString::fromUTF8(issuer),
+ valid_start.ToDoubleT(), valid_expiry.ToDoubleT(),
+ blink::CopyStringVectorFromLatin1(info.certificate), sct_list);
response->setSecurityDetails(webSecurityDetails);
}
@@ -1044,7 +1030,8 @@ void WebURLLoaderImpl::PopulateURLResponse(const GURL& url,
response->setRemotePort(info.socket_address.port());
response->setConnectionID(info.load_timing.socket_log_id);
response->setConnectionReused(info.load_timing.socket_reused);
- response->setDownloadFilePath(info.download_file_path.AsUTF16Unsafe());
+ response->setDownloadFilePath(
+ blink::FilePathToWebString(info.download_file_path));
response->setWasFetchedViaSPDY(info.was_fetched_via_spdy);
response->setWasFetchedViaServiceWorker(info.was_fetched_via_service_worker);
response->setWasFetchedViaForeignFetch(info.was_fetched_via_foreign_fetch);
@@ -1057,13 +1044,8 @@ void WebURLLoaderImpl::PopulateURLResponse(const GURL& url,
info.is_in_cache_storage
? blink::WebString::fromUTF8(info.cache_storage_cache_name)
: blink::WebString());
- blink::WebVector<blink::WebString> cors_exposed_header_names(
- info.cors_exposed_header_names.size());
- std::transform(
- info.cors_exposed_header_names.begin(),
- info.cors_exposed_header_names.end(), cors_exposed_header_names.begin(),
- [](const std::string& h) { return blink::WebString::fromLatin1(h); });
- response->setCorsExposedHeaderNames(cors_exposed_header_names);
+ response->setCorsExposedHeaderNames(
+ blink::CopyStringVectorFromLatin1(info.cors_exposed_header_names));
response->setEncodedDataLength(info.encoded_data_length);
SetSecurityStyleAndDetails(url, info, response, report_security_info);
@@ -1145,13 +1127,12 @@ void WebURLLoaderImpl::PopulateURLResponse(const GURL& url,
// pass it to GetSuggestedFilename.
std::string value;
headers->EnumerateHeader(NULL, "content-disposition", &value);
- response->setSuggestedFileName(
- net::GetSuggestedFilename(url,
- value,
- std::string(), // referrer_charset
- std::string(), // suggested_name
- std::string(), // mime_type
- std::string())); // default_name
+ response->setSuggestedFileName(blink::WebString::fromUTF16(
+ net::GetSuggestedFilename(url, value,
+ std::string(), // referrer_charset
+ std::string(), // suggested_name
+ std::string(), // mime_type
+ std::string()))); // default_name
Time time_val;
if (headers->GetLastModifiedValue(&time_val))
« no previous file with comments | « content/child/web_database_observer_impl.cc ('k') | content/child/web_url_request_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698