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

Unified Diff: extensions/common/error_utils.cc

Issue 2604033002: [Extensions] Use base::StringPiece in ErrorUtils (Closed)
Patch Set: 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 | « extensions/common/error_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/error_utils.cc
diff --git a/extensions/common/error_utils.cc b/extensions/common/error_utils.cc
index 14ca2a96c2f8aca36f5885c7e27845bbf4aa8aca..f8f04b7c617e27d0bb6d6f637e4c0851c3a79310 100644
--- a/extensions/common/error_utils.cc
+++ b/extensions/common/error_utils.cc
@@ -9,48 +9,48 @@
namespace extensions {
-std::string ErrorUtils::FormatErrorMessage(const std::string& format,
- const std::string& s1) {
- std::string ret_val = format;
+std::string ErrorUtils::FormatErrorMessage(base::StringPiece format,
+ base::StringPiece s1) {
+ std::string ret_val = format.as_string();
base::ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
return ret_val;
}
-std::string ErrorUtils::FormatErrorMessage(const std::string& format,
- const std::string& s1,
- const std::string& s2) {
- std::string ret_val = format;
+std::string ErrorUtils::FormatErrorMessage(base::StringPiece format,
+ base::StringPiece s1,
+ base::StringPiece s2) {
+ std::string ret_val = format.as_string();
base::ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
base::ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2);
return ret_val;
}
-std::string ErrorUtils::FormatErrorMessage(const std::string& format,
- const std::string& s1,
- const std::string& s2,
- const std::string& s3) {
- std::string ret_val = format;
+std::string ErrorUtils::FormatErrorMessage(base::StringPiece format,
+ base::StringPiece s1,
+ base::StringPiece s2,
+ base::StringPiece s3) {
+ std::string ret_val = format.as_string();
base::ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
base::ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2);
base::ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s3);
return ret_val;
}
-base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format,
- const std::string& s1) {
+base::string16 ErrorUtils::FormatErrorMessageUTF16(base::StringPiece format,
+ base::StringPiece s1) {
return base::UTF8ToUTF16(FormatErrorMessage(format, s1));
}
-base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format,
- const std::string& s1,
- const std::string& s2) {
+base::string16 ErrorUtils::FormatErrorMessageUTF16(base::StringPiece format,
+ base::StringPiece s1,
+ base::StringPiece s2) {
return base::UTF8ToUTF16(FormatErrorMessage(format, s1, s2));
}
-base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format,
- const std::string& s1,
- const std::string& s2,
- const std::string& s3) {
+base::string16 ErrorUtils::FormatErrorMessageUTF16(base::StringPiece format,
+ base::StringPiece s1,
+ base::StringPiece s2,
+ base::StringPiece s3) {
return base::UTF8ToUTF16(FormatErrorMessage(format, s1, s2, s3));
}
« no previous file with comments | « extensions/common/error_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698