OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/common/extensions/extension_error_utils.h" | |
6 | |
7 #include "base/string_util.h" | |
8 #include "base/utf_string_conversions.h" | |
9 | |
10 std::string ExtensionErrorUtils::FormatErrorMessage( | |
11 const std::string& format, | |
12 const std::string& s1) { | |
13 std::string ret_val = format; | |
14 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); | |
15 return ret_val; | |
16 } | |
17 | |
18 std::string ExtensionErrorUtils::FormatErrorMessage( | |
19 const std::string& format, | |
20 const std::string& s1, | |
21 const std::string& s2) { | |
22 std::string ret_val = format; | |
23 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); | |
24 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2); | |
25 return ret_val; | |
26 } | |
27 | |
28 std::string ExtensionErrorUtils::FormatErrorMessage( | |
29 const std::string& format, | |
30 const std::string& s1, | |
31 const std::string& s2, | |
32 const std::string& s3) { | |
33 std::string ret_val = format; | |
34 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); | |
35 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2); | |
36 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s3); | |
37 return ret_val; | |
38 } | |
39 | |
40 string16 ExtensionErrorUtils::FormatErrorMessageUTF16( | |
41 const std::string& format, | |
42 const std::string& s1) { | |
43 std::string ret_val = format; | |
44 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); | |
45 return UTF8ToUTF16(ret_val); | |
46 } | |
47 | |
48 string16 ExtensionErrorUtils::FormatErrorMessageUTF16( | |
49 const std::string& format, | |
50 const std::string& s1, | |
51 const std::string& s2) { | |
52 std::string ret_val = format; | |
53 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); | |
54 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2); | |
55 return UTF8ToUTF16(ret_val); | |
56 } | |
57 | |
58 string16 ExtensionErrorUtils::FormatErrorMessageUTF16( | |
59 const std::string& format, | |
60 const std::string& s1, | |
61 const std::string& s2, | |
62 const std::string& s3) { | |
63 std::string ret_val = format; | |
64 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); | |
65 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2); | |
66 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s3); | |
67 return UTF8ToUTF16(ret_val); | |
68 } | |
69 | |
OLD | NEW |