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

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

Issue 8890086: Issue 71980: Extensions code should use UTF-16 for user-visible Unicode strings (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/extensions/extension_error_utils.h" 5 #include "chrome/common/extensions/extension_error_utils.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h"
8 9
9 std::string ExtensionErrorUtils::FormatErrorMessage( 10 std::string ExtensionErrorUtils::FormatErrorMessage(
10 const std::string& format, 11 const std::string& format,
11 const std::string& s1) { 12 const std::string& s1) {
12 std::string ret_val = format; 13 std::string ret_val = format;
13 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); 14 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
14 return ret_val; 15 return ret_val;
15 } 16 }
16 17
17 std::string ExtensionErrorUtils::FormatErrorMessage( 18 std::string ExtensionErrorUtils::FormatErrorMessage(
(...skipping 10 matching lines...) Expand all
28 const std::string& format, 29 const std::string& format,
29 const std::string& s1, 30 const std::string& s1,
30 const std::string& s2, 31 const std::string& s2,
31 const std::string& s3) { 32 const std::string& s3) {
32 std::string ret_val = format; 33 std::string ret_val = format;
33 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); 34 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1);
34 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2); 35 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2);
35 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s3); 36 ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s3);
36 return ret_val; 37 return ret_val;
37 } 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
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_error_utils.h ('k') | chrome/common/extensions/extension_unpacker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698