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

Side by Side Diff: chrome/renderer/extensions/i18n_custom_bindings.cc

Issue 9657026: Revert 125801 - Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 "chrome/renderer/extensions/i18n_custom_bindings.h" 5 #include "chrome/renderer/extensions/i18n_custom_bindings.h"
6 6
7 #include "chrome/common/extensions/extension_messages.h" 7 #include "chrome/common/extensions/extension_messages.h"
8 #include "chrome/common/extensions/extension_message_bundle.h" 8 #include "chrome/common/extensions/extension_message_bundle.h"
9 #include "content/public/renderer/render_view.h" 9 #include "content/public/renderer/render_view.h"
10 #include "grit/renderer_resources.h" 10 #include "grit/renderer_resources.h"
11 #include "v8/include/v8.h" 11 #include "v8/include/v8.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 I18NCustomBindings::I18NCustomBindings() 15 I18NCustomBindings::I18NCustomBindings(
16 : ChromeV8Extension(NULL) { 16 int dependency_count, const char** dependencies)
17 RouteStaticFunction("GetL10nMessage", &GetL10nMessage); 17 : ChromeV8Extension(
18 "extensions/i18n_custom_bindings.js",
19 IDR_I18N_CUSTOM_BINDINGS_JS,
20 dependency_count,
21 dependencies,
22 NULL) {}
23
24 v8::Handle<v8::FunctionTemplate> I18NCustomBindings::GetNativeFunction(
25 v8::Handle<v8::String> name) {
26 if (name->Equals(v8::String::New("GetL10nMessage")))
27 return v8::FunctionTemplate::New(GetL10nMessage);
28
29 return ChromeV8Extension::GetNativeFunction(name);
18 } 30 }
19 31
20 // static 32 // static
21 v8::Handle<v8::Value> I18NCustomBindings::GetL10nMessage( 33 v8::Handle<v8::Value> I18NCustomBindings::GetL10nMessage(
22 const v8::Arguments& args) { 34 const v8::Arguments& args) {
23 if (args.Length() != 3 || !args[0]->IsString()) { 35 if (args.Length() != 3 || !args[0]->IsString()) {
24 NOTREACHED() << "Bad arguments"; 36 NOTREACHED() << "Bad arguments";
25 return v8::Undefined(); 37 return v8::Undefined();
26 } 38 }
27 39
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } else { 95 } else {
84 NOTREACHED() << "Couldn't parse second parameter."; 96 NOTREACHED() << "Couldn't parse second parameter.";
85 return v8::Undefined(); 97 return v8::Undefined();
86 } 98 }
87 99
88 return v8::String::New(ReplaceStringPlaceholders( 100 return v8::String::New(ReplaceStringPlaceholders(
89 message, substitutions, NULL).c_str()); 101 message, substitutions, NULL).c_str());
90 } 102 }
91 103
92 } // namespace extension 104 } // namespace extension
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/i18n_custom_bindings.h ('k') | chrome/renderer/extensions/json_schema_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698