Skip to content

Commit

Permalink
Cleanup: Simplify ErrorUtils::FormatErrorMessageUTF16().
Browse files Browse the repository at this point in the history
Review URL: https://codereview.chromium.org/137233018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247328 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
thestig@chromium.org committed Jan 27, 2014
1 parent b722c55 commit 8f585c8
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions extensions/common/error_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,20 @@ std::string ErrorUtils::FormatErrorMessage(const std::string& format,

base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format,
const std::string& s1) {
std::string ret_val = format;
ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
return base::UTF8ToUTF16(ret_val);
return base::UTF8ToUTF16(FormatErrorMessage(format, s1));
}

base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format,
const std::string& s1,
const std::string& s2) {
std::string ret_val = format;
ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2);
return base::UTF8ToUTF16(ret_val);
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) {
std::string ret_val = format;
ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2);
ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s3);
return base::UTF8ToUTF16(ret_val);
return base::UTF8ToUTF16(FormatErrorMessage(format, s1, s2, s3));
}

} // namespace
} // namespace extensions

0 comments on commit 8f585c8

Please sign in to comment.