| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/i18n_custom_bindings.h" | 5 #include "extensions/renderer/i18n_custom_bindings.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/public/renderer/render_frame.h" | 8 #include "content/public/renderer/render_frame.h" |
| 9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
| 10 #include "extensions/common/extension_messages.h" | 10 #include "extensions/common/extension_messages.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 substitutions.push_back(*v8::String::Utf8Value(placeholders->Get( | 74 substitutions.push_back(*v8::String::Utf8Value(placeholders->Get( |
| 75 v8::Integer::New(isolate, i)))); | 75 v8::Integer::New(isolate, i)))); |
| 76 } | 76 } |
| 77 } else if (args[1]->IsString()) { | 77 } else if (args[1]->IsString()) { |
| 78 // chrome.i18n.getMessage("message_name", "one param"); | 78 // chrome.i18n.getMessage("message_name", "one param"); |
| 79 substitutions.push_back(*v8::String::Utf8Value(args[1])); | 79 substitutions.push_back(*v8::String::Utf8Value(args[1])); |
| 80 } | 80 } |
| 81 | 81 |
| 82 args.GetReturnValue().Set(v8::String::NewFromUtf8( | 82 args.GetReturnValue().Set(v8::String::NewFromUtf8( |
| 83 isolate, | 83 isolate, |
| 84 ReplaceStringPlaceholders(message, substitutions, NULL).c_str())); | 84 base::ReplaceStringPlaceholders(message, substitutions, NULL).c_str())); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void I18NCustomBindings::GetL10nUILanguage( | 87 void I18NCustomBindings::GetL10nUILanguage( |
| 88 const v8::FunctionCallbackInfo<v8::Value>& args) { | 88 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 89 args.GetReturnValue().Set(v8::String::NewFromUtf8( | 89 args.GetReturnValue().Set(v8::String::NewFromUtf8( |
| 90 args.GetIsolate(), content::RenderThread::Get()->GetLocale().c_str())); | 90 args.GetIsolate(), content::RenderThread::Get()->GetLocale().c_str())); |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace extensions | 93 } // namespace extensions |
| OLD | NEW |