summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/resources
diff options
context:
space:
mode:
authoramalika <amalika@google.com>2015-08-24 12:00:38 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-24 19:01:24 +0000
commit78d8cc1f0b5f4cb27d7d3b1c377e87c3d76f8160 (patch)
treeed6eb3680f9dc6c29bee8bcd178f5a8912098a8c /extensions/renderer/resources
parentb5387f8df31c544ea12193ac47d18407d8c6d9b6 (diff)
downloadchromium_src-78d8cc1f0b5f4cb27d7d3b1c377e87c3d76f8160.zip
chromium_src-78d8cc1f0b5f4cb27d7d3b1c377e87c3d76f8160.tar.gz
chromium_src-78d8cc1f0b5f4cb27d7d3b1c377e87c3d76f8160.tar.bz2
Fixing dependencies of the reverted commit of the chrome.i18n.detectLanguage API. Implementation on the renderer side
Please, see Original CL: https://codereview.chromium.org/1208993011/ Reverted: https://codereview.chromium.org/1244343002/ Temp CL we used to figure out deps: https://codereview.chromium.org/1268813004/ Initial patch for detectLanguage API implementation BUG=517628 Review URL: https://codereview.chromium.org/1273903002 Cr-Commit-Position: refs/heads/master@{#345134}
Diffstat (limited to 'extensions/renderer/resources')
-rw-r--r--extensions/renderer/resources/i18n_custom_bindings.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/extensions/renderer/resources/i18n_custom_bindings.js b/extensions/renderer/resources/i18n_custom_bindings.js
index 38570f3..4ee5206 100644
--- a/extensions/renderer/resources/i18n_custom_bindings.js
+++ b/extensions/renderer/resources/i18n_custom_bindings.js
@@ -9,6 +9,7 @@ var binding = require('binding').Binding.create('i18n');
var i18nNatives = requireNative('i18n');
var GetL10nMessage = i18nNatives.GetL10nMessage;
var GetL10nUILanguage = i18nNatives.GetL10nUILanguage;
+var DetectTextLanguage = i18nNatives.DetectTextLanguage;
binding.registerCustomHook(function(bindingsAPI, extensionId) {
var apiFunctions = bindingsAPI.apiFunctions;
@@ -36,6 +37,13 @@ binding.registerCustomHook(function(bindingsAPI, extensionId) {
apiFunctions.setHandleRequest('getUILanguage', function() {
return GetL10nUILanguage();
});
+
+ apiFunctions.setHandleRequest('detectLanguage', function(text, callback) {
+ window.setTimeout(function() {
+ var response = DetectTextLanguage(text);
+ callback(response);
+ }, 0);
+ });
});
exports.binding = binding.generate();