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

Unified Diff: chrome/browser/guest_view/web_view/web_view_guest.cc

Issue 296593003: Make various string_util functions take StringPieces instead of char[]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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/guest_view/web_view/web_view_guest.cc
diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc
index 465495e7a3c9cfd107f733072dbdaa9218b49dcd..46bb93baff38f6545ff0913655550b7e50b3c42d 100644
--- a/chrome/browser/guest_view/web_view/web_view_guest.cc
+++ b/chrome/browser/guest_view/web_view/web_view_guest.cc
@@ -807,8 +807,9 @@ void WebViewGuest::DidFailProvisionalLoad(
const base::string16& error_description,
content::RenderViewHost* render_view_host) {
// Translate the |error_code| into an error string.
- std::string error_type;
- base::RemoveChars(net::ErrorToString(error_code), "net::", &error_type);
+ std::string error_type(net::ErrorToString(error_code));
+ DCHECK(StartsWithASCII(error_type, "net::", true));
darin (slow to review) 2014/05/22 23:49:46 I don't know that it is guaranteed that the error
Peter Kasting 2014/05/22 23:54:50 net::ErrorToString() prefixes "net::" onto all ret
darin (slow to review) 2014/05/30 00:03:17 Oh, nevermind. I was mistakenly thinking the strin
+ error_type.erase(0, 5);
LoadAbort(is_main_frame, validated_url, error_type);
}
@@ -1023,9 +1024,9 @@ void WebViewGuest::NavigateGuest(const std::string& src) {
!url.SchemeIs(content::kAboutScheme)) ||
url.SchemeIs(content::kJavaScriptScheme);
if (scheme_is_blocked || !url.is_valid()) {
- std::string error_type;
- base::RemoveChars(net::ErrorToString(net::ERR_ABORTED), "net::",
- &error_type);
+ std::string error_type(net::ErrorToString(net::ERR_ABORTED));
+ DCHECK(StartsWithASCII(error_type, "net::", true));
+ error_type.erase(0, 5);
LoadAbort(true /* is_top_level */, url, error_type);
return;
}

Powered by Google App Engine
This is Rietveld 408576698