| OLD | NEW |
| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 const char* tag, string16* result) { | 1420 const char* tag, string16* result) { |
| 1421 return LocalizeStringWithSubstitution(localize_func, tag, NULL, result); | 1421 return LocalizeStringWithSubstitution(localize_func, tag, NULL, result); |
| 1422 } | 1422 } |
| 1423 | 1423 |
| 1424 bool HostNPScriptObject::LocalizeStringWithSubstitution( | 1424 bool HostNPScriptObject::LocalizeStringWithSubstitution( |
| 1425 NPObject* localize_func, | 1425 NPObject* localize_func, |
| 1426 const char* tag, | 1426 const char* tag, |
| 1427 const char* substitution, | 1427 const char* substitution, |
| 1428 string16* result) { | 1428 string16* result) { |
| 1429 int argc = substitution ? 2 : 1; | 1429 int argc = substitution ? 2 : 1; |
| 1430 scoped_array<NPVariant> args(new NPVariant[argc]); | 1430 scoped_ptr<NPVariant[]> args(new NPVariant[argc]); |
| 1431 STRINGZ_TO_NPVARIANT(tag, args[0]); | 1431 STRINGZ_TO_NPVARIANT(tag, args[0]); |
| 1432 if (substitution) { | 1432 if (substitution) { |
| 1433 STRINGZ_TO_NPVARIANT(substitution, args[1]); | 1433 STRINGZ_TO_NPVARIANT(substitution, args[1]); |
| 1434 } | 1434 } |
| 1435 NPVariant np_result; | 1435 NPVariant np_result; |
| 1436 bool is_good = g_npnetscape_funcs->invokeDefault( | 1436 bool is_good = g_npnetscape_funcs->invokeDefault( |
| 1437 plugin_, localize_func, args.get(), argc, &np_result); | 1437 plugin_, localize_func, args.get(), argc, &np_result); |
| 1438 if (!is_good) { | 1438 if (!is_good) { |
| 1439 LOG(ERROR) << "Localization failed for " << tag; | 1439 LOG(ERROR) << "Localization failed for " << tag; |
| 1440 return false; | 1440 return false; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1584 } | 1584 } |
| 1585 | 1585 |
| 1586 void HostNPScriptObject::SetException(const std::string& exception_string) { | 1586 void HostNPScriptObject::SetException(const std::string& exception_string) { |
| 1587 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); | 1587 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); |
| 1588 | 1588 |
| 1589 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); | 1589 g_npnetscape_funcs->setexception(parent_, exception_string.c_str()); |
| 1590 LOG(INFO) << exception_string; | 1590 LOG(INFO) << exception_string; |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 } // namespace remoting | 1593 } // namespace remoting |
| OLD | NEW |