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_thread.h" | 8 #include "content/public/renderer/render_thread.h" |
9 #include "content/public/renderer/render_view.h" | 9 #include "content/public/renderer/render_view.h" |
10 #include "extensions/common/extension_messages.h" | 10 #include "extensions/common/extension_messages.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 *v8::String::Utf8Value( | 77 *v8::String::Utf8Value( |
78 placeholders->Get(v8::Integer::New(isolate, i))->ToString())); | 78 placeholders->Get(v8::Integer::New(isolate, i))->ToString())); |
79 } | 79 } |
80 } else if (args[1]->IsString()) { | 80 } else if (args[1]->IsString()) { |
81 // chrome.i18n.getMessage("message_name", "one param"); | 81 // chrome.i18n.getMessage("message_name", "one param"); |
82 substitutions.push_back(*v8::String::Utf8Value(args[1]->ToString())); | 82 substitutions.push_back(*v8::String::Utf8Value(args[1]->ToString())); |
83 } | 83 } |
84 | 84 |
85 args.GetReturnValue().Set(v8::String::NewFromUtf8( | 85 args.GetReturnValue().Set(v8::String::NewFromUtf8( |
86 isolate, | 86 isolate, |
87 ReplaceStringPlaceholders(message, substitutions, NULL).c_str())); | 87 ReplaceStringPlaceholders(message, substitutions, nullptr).c_str())); |
88 } | 88 } |
89 | 89 |
90 void I18NCustomBindings::GetL10nUILanguage( | 90 void I18NCustomBindings::GetL10nUILanguage( |
91 const v8::FunctionCallbackInfo<v8::Value>& args) { | 91 const v8::FunctionCallbackInfo<v8::Value>& args) { |
92 args.GetReturnValue().Set(v8::String::NewFromUtf8( | 92 args.GetReturnValue().Set(v8::String::NewFromUtf8( |
93 args.GetIsolate(), content::RenderThread::Get()->GetLocale().c_str())); | 93 args.GetIsolate(), content::RenderThread::Get()->GetLocale().c_str())); |
94 } | 94 } |
95 | 95 |
96 } // namespace extensions | 96 } // namespace extensions |
OLD | NEW |