GURL::Replacements methods accept a StringPiece instead of std::string&.
Previously, it was unsafe to pass a char* because it would be implicitly
converted to a string with a very short lifetime. Now, you can safely
pass a char* as long as the memory pointed to by the char* outlives the
Replacements (which is always true for string literals).
All existing usage of Replacements should continue to work as usual.
Updated every call to Replacements Set*Str methods that that could be
simplified by the new StringPiece API (for example, passing string
literals directly, instead of copying them into a string object).
Internally, renamed StdStringReplacements to StringPieceReplacements.
BUG=454274
Review URL: https://codereview.chromium.org/889463003
Cr-Commit-Position: refs/heads/master@{#314771}
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index a189991..09a0e0c 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -49,8 +49,7 @@
// as in the test apps manifests.
GURL GetTestBaseURL(const std::string& test_directory) {
GURL::Replacements replace_host;
- std::string host_str("localhost"); // must stay in scope with replace_host
- replace_host.SetHostStr(host_str);
+ replace_host.SetHostStr("localhost");
GURL base_url = embedded_test_server()->GetURL(
"/extensions/api_test/" + test_directory + "/");
return base_url.ReplaceComponents(replace_host);