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

Side by Side Diff: remoting/host/plugin/host_script_object.cc

Issue 121123002: Update uses of UTF conversions in ppapi/, printing/, remoting/, rlz/, sandbox/, skia/, sql/, sync/,… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/host/plugin/host_script_object.h" 5 #include "remoting/host/plugin/host_script_object.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 } 932 }
933 933
934 void HostNPScriptObject::LocalizeStrings(NPObject* localize_func) { 934 void HostNPScriptObject::LocalizeStrings(NPObject* localize_func) {
935 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); 935 DCHECK(plugin_task_runner_->BelongsToCurrentThread());
936 936
937 // Reload resources for the current locale. The default UI locale is used on 937 // Reload resources for the current locale. The default UI locale is used on
938 // Windows. 938 // Windows.
939 #if !defined(OS_WIN) 939 #if !defined(OS_WIN)
940 base::string16 ui_locale; 940 base::string16 ui_locale;
941 LocalizeString(localize_func, "@@ui_locale", &ui_locale); 941 LocalizeString(localize_func, "@@ui_locale", &ui_locale);
942 remoting::LoadResources(UTF16ToUTF8(ui_locale)); 942 remoting::LoadResources(base::UTF16ToUTF8(ui_locale));
943 #endif // !defined(OS_WIN) 943 #endif // !defined(OS_WIN)
944 } 944 }
945 945
946 bool HostNPScriptObject::LocalizeString(NPObject* localize_func, 946 bool HostNPScriptObject::LocalizeString(NPObject* localize_func,
947 const char* tag, 947 const char* tag,
948 base::string16* result) { 948 base::string16* result) {
949 return LocalizeStringWithSubstitution(localize_func, tag, NULL, result); 949 return LocalizeStringWithSubstitution(localize_func, tag, NULL, result);
950 } 950 }
951 951
952 bool HostNPScriptObject::LocalizeStringWithSubstitution( 952 bool HostNPScriptObject::LocalizeStringWithSubstitution(
(...skipping 13 matching lines...) Expand all
966 if (!is_good) { 966 if (!is_good) {
967 LOG(ERROR) << "Localization failed for " << tag; 967 LOG(ERROR) << "Localization failed for " << tag;
968 return false; 968 return false;
969 } 969 }
970 std::string translation = StringFromNPVariant(np_result); 970 std::string translation = StringFromNPVariant(np_result);
971 g_npnetscape_funcs->releasevariantvalue(&np_result); 971 g_npnetscape_funcs->releasevariantvalue(&np_result);
972 if (translation.empty()) { 972 if (translation.empty()) {
973 LOG(ERROR) << "Missing translation for " << tag; 973 LOG(ERROR) << "Missing translation for " << tag;
974 return false; 974 return false;
975 } 975 }
976 *result = UTF8ToUTF16(translation); 976 *result = base::UTF8ToUTF16(translation);
977 return true; 977 return true;
978 } 978 }
979 979
980 // static 980 // static
981 void HostNPScriptObject::DoGenerateKeyPair( 981 void HostNPScriptObject::DoGenerateKeyPair(
982 const scoped_refptr<AutoThreadTaskRunner>& plugin_task_runner, 982 const scoped_refptr<AutoThreadTaskRunner>& plugin_task_runner,
983 const base::Callback<void (const std::string&, 983 const base::Callback<void (const std::string&,
984 const std::string&)>& callback) { 984 const std::string&)>& callback) {
985 scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::Generate(); 985 scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::Generate();
986 plugin_task_runner->PostTask(FROM_HERE, 986 plugin_task_runner->PostTask(FROM_HERE,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 } 1107 }
1108 1108
1109 void HostNPScriptObject::SetException(const std::string& exception_string) { 1109 void HostNPScriptObject::SetException(const std::string& exception_string) {
1110 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); 1110 DCHECK(plugin_task_runner_->BelongsToCurrentThread());
1111 1111
1112 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); 1112 g_npnetscape_funcs->setexception(parent_, exception_string.c_str());
1113 HOST_LOG << exception_string; 1113 HOST_LOG << exception_string;
1114 } 1114 }
1115 1115
1116 } // namespace remoting 1116 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/pairing_registry_delegate_win_unittest.cc ('k') | remoting/host/policy_hack/policy_watcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698