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

Side by Side Diff: extensions/common/extension_error_utils.cc

Issue 11312228: Move extension_error_utils.* and url_pattern_set.* into (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move into extensions namespace Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 "extensions/common/extension_error_utils.h"
6
7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h"
9
10 namespace extensions {
11
12 std::string ErrorUtils::FormatErrorMessage(const std::string& format,
13 const std::string& s1) {
14 std::string ret_val = format;
15 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
16 return ret_val;
17 }
18
19 std::string ErrorUtils::FormatErrorMessage(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 ErrorUtils::FormatErrorMessage(const std::string& format,
29 const std::string& s1,
30 const std::string& s2,
31 const std::string& s3) {
32 std::string ret_val = format;
33 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
34 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2);
35 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s3);
36 return ret_val;
37 }
38
39 string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format,
40 const std::string& s1) {
41 std::string ret_val = format;
42 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
43 return UTF8ToUTF16(ret_val);
44 }
45
46 string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format,
47 const std::string& s1,
48 const std::string& s2) {
49 std::string ret_val = format;
50 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
51 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2);
52 return UTF8ToUTF16(ret_val);
53 }
54
55 string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format,
56 const std::string& s1,
57 const std::string& s2,
58 const std::string& s3) {
59 std::string ret_val = format;
60 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
61 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2);
62 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s3);
63 return UTF8ToUTF16(ret_val);
64 }
65
66 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698