blob: 3af90141d6ab75caaace9436b116aab636db4804 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Installs iOS Translate callbacks on cr.googleTranslate.
*
* TODO(crbug.com/659442): Enable checkTypes, checkVars errors for this file.
* @suppress {checkTypes, checkVars}
*/
/**
* Defines function to install callbacks on cr.googleTranslate.
* See translate_script.cc for usage.
*/
var installTranslateCallbacks = function() {
/**
* Sets a callback to inform host of the ready state of the translate element.
*/
cr.googleTranslate.readyCallback = function() {
__gCrWeb.message.invokeOnHost({
'command': 'translate.ready',
'errorCode': cr.googleTranslate.errorCode,
'loadTime': cr.googleTranslate.loadTime,
'readyTime': cr.googleTranslate.readyTime});
}
/**
* Sets a callback to inform host of the result of translation.
*/
cr.googleTranslate.resultCallback = function() {
__gCrWeb.message.invokeOnHost({
'command': 'translate.status',
'errorCode': cr.googleTranslate.errorCode,
'originalPageLanguage': cr.googleTranslate.sourceLang,
'translationTime': cr.googleTranslate.translationTime});
}
} // installTranslateCallbacks