OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 I18NExtension::I18NExtension() | 50 I18NExtension::I18NExtension() |
51 : v8::Extension("v8/i18n", GetScriptSource()) { | 51 : v8::Extension("v8/i18n", GetScriptSource()) { |
52 } | 52 } |
53 | 53 |
54 v8::Handle<v8::FunctionTemplate> I18NExtension::GetNativeFunction( | 54 v8::Handle<v8::FunctionTemplate> I18NExtension::GetNativeFunction( |
55 v8::Handle<v8::String> name) { | 55 v8::Handle<v8::String> name) { |
56 if (name->Equals(v8::String::New("NativeJSLocale"))) { | 56 if (name->Equals(v8::String::New("NativeJSLocale"))) { |
57 return v8::FunctionTemplate::New(I18NLocale::JSLocale); | 57 return v8::FunctionTemplate::New(I18NLocale::JSLocale); |
58 } else if (name->Equals(v8::String::New("NativeJSAvailableLocales"))) { | |
59 return v8::FunctionTemplate::New(I18NLocale::JSAvailableLocales); | |
60 } else if (name->Equals(v8::String::New("NativeJSMaximizedLocale"))) { | |
61 return v8::FunctionTemplate::New(I18NLocale::JSMaximizedLocale); | |
62 } else if (name->Equals(v8::String::New("NativeJSMinimizedLocale"))) { | |
63 return v8::FunctionTemplate::New(I18NLocale::JSMinimizedLocale); | |
64 } else if (name->Equals(v8::String::New("NativeJSDisplayLanguage"))) { | |
65 return v8::FunctionTemplate::New(I18NLocale::JSDisplayLanguage); | |
66 } else if (name->Equals(v8::String::New("NativeJSDisplayScript"))) { | |
67 return v8::FunctionTemplate::New(I18NLocale::JSDisplayScript); | |
68 } else if (name->Equals(v8::String::New("NativeJSDisplayRegion"))) { | |
69 return v8::FunctionTemplate::New(I18NLocale::JSDisplayRegion); | |
70 } else if (name->Equals(v8::String::New("NativeJSDisplayName"))) { | |
71 return v8::FunctionTemplate::New(I18NLocale::JSDisplayName); | |
72 } else if (name->Equals(v8::String::New("NativeJSBreakIterator"))) { | 58 } else if (name->Equals(v8::String::New("NativeJSBreakIterator"))) { |
73 return v8::FunctionTemplate::New(BreakIterator::JSBreakIterator); | 59 return v8::FunctionTemplate::New(BreakIterator::JSBreakIterator); |
74 } else if (name->Equals(v8::String::New("NativeJSCollator"))) { | 60 } else if (name->Equals(v8::String::New("NativeJSCollator"))) { |
75 return v8::FunctionTemplate::New(Collator::JSCollator); | 61 return v8::FunctionTemplate::New(Collator::JSCollator); |
76 } | 62 } |
77 | 63 |
78 return v8::Handle<v8::FunctionTemplate>(); | 64 return v8::Handle<v8::FunctionTemplate>(); |
79 } | 65 } |
80 | 66 |
81 I18NExtension* I18NExtension::get() { | 67 I18NExtension* I18NExtension::get() { |
82 if (!extension_) { | 68 if (!extension_) { |
83 extension_ = new I18NExtension(); | 69 extension_ = new I18NExtension(); |
84 } | 70 } |
85 return extension_; | 71 return extension_; |
86 } | 72 } |
87 | 73 |
88 void I18NExtension::Register() { | 74 void I18NExtension::Register() { |
89 static v8::DeclareExtension i18n_extension_declaration(I18NExtension::get()); | 75 static v8::DeclareExtension i18n_extension_declaration(I18NExtension::get()); |
90 } | 76 } |
91 | 77 |
92 } } // namespace v8::internal | 78 } } // namespace v8::internal |
OLD | NEW |