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

Unified Diff: src/extensions/i18n/i18n-utils.js

Issue 21499003: Move helper methods from i18n extension into runtime. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: src/extensions/i18n/i18n-utils.js
diff --git a/src/extensions/i18n/i18n-utils.js b/src/extensions/i18n/i18n-utils.js
index d7e9486c507681c73973fb25e9bb7a39198cfc21..545082ecbba4d6ba9755c9639234a28ba4889cf5 100644
--- a/src/extensions/i18n/i18n-utils.js
+++ b/src/extensions/i18n/i18n-utils.js
@@ -255,8 +255,6 @@ function resolveLocale(service, requestedLocales, options) {
* lookup algorithm.
*/
function lookupMatcher(service, requestedLocales) {
- native function NativeJSGetDefaultICULocale();
-
if (service.match(SERVICE_RE) === null) {
throw new Error('Internal error, wrong service type: ' + service);
}
@@ -287,7 +285,7 @@ function lookupMatcher(service, requestedLocales) {
// Didn't find a match, return default.
if (DEFAULT_ICU_LOCALE === undefined) {
- DEFAULT_ICU_LOCALE = NativeJSGetDefaultICULocale();
+ DEFAULT_ICU_LOCALE = %GetDefaultICULocale();
}
return {'locale': DEFAULT_ICU_LOCALE, 'extension': '', 'position': -1};
@@ -446,14 +444,12 @@ function getOptimalLanguageTag(original, resolved) {
// Returns Array<Object>, where each object has maximized and base properties.
// Maximized: zh -> zh-Hans-CN
// Base: zh-CN-u-ca-gregory -> zh-CN
- native function NativeJSGetLanguageTagVariants();
-
// Take care of grandfathered or simple cases.
if (original === resolved) {
return original;
}
- var locales = NativeJSGetLanguageTagVariants([original, resolved]);
+ var locales = %GetLanguageTagVariants([original, resolved]);
if (locales[0].maximized !== locales[1].maximized) {
return resolved;
}
@@ -471,8 +467,7 @@ function getOptimalLanguageTag(original, resolved) {
* that is supported. This is required by the spec.
*/
function getAvailableLocalesOf(service) {
- native function NativeJSAvailableLocalesOf();
- var available = NativeJSAvailableLocalesOf(service);
+ var available = %AvailableLocalesOf(service);
for (var i in available) {
if (available.hasOwnProperty(i)) {

Powered by Google App Engine
This is Rietveld 408576698