| Index: components/translate/content/public/interfaces/translate.mojom
|
| diff --git a/components/translate/content/public/interfaces/translate.mojom b/components/translate/content/public/interfaces/translate.mojom
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..857fbfbe0a39278a91b04db7ea97e4926b98f8f4
|
| --- /dev/null
|
| +++ b/components/translate/content/public/interfaces/translate.mojom
|
| @@ -0,0 +1,66 @@
|
| +// Copyright 2016 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.
|
| +
|
| +module translate.mojom;
|
| +
|
| +import "mojo/common/common_custom_types.mojom";
|
| +import "url/mojo/url.mojom";
|
| +
|
| +// enum translate::TranslateErrors::Type
|
| +enum TranslateErrorsType {
|
| + NONE,
|
| + NETWORK,
|
| + INITIALIZATION_ERROR,
|
| + UNKNOWN_LANGUAGE,
|
| + UNSUPPORTED_LANGUAGE,
|
| + IDENTICAL_LANGUAGES,
|
| + TRANSLATION_ERROR,
|
| + TRANSLATION_TIMEOUT,
|
| + UNEXPECTED_SCRIPT_ERROR,
|
| + BAD_ORIGIN,
|
| + SCRIPT_LOAD_ERROR,
|
| + TRANSLATE_ERROR_MAX,
|
| +};
|
| +
|
| +// struct translate::LanguageDetectionDetails
|
| +struct LanguageDetectionDetails {
|
| + mojo.common.mojom.Time time;
|
| + url.mojom.Url url;
|
| + string content_language;
|
| + string cld_language;
|
| + bool is_cld_reliable;
|
| + bool has_notranslate;
|
| + string html_root_language;
|
| + string adopted_language;
|
| + string contents;
|
| +};
|
| +
|
| +interface Page {
|
| + // Tells the renderer to translate the page contents from one language to
|
| + // another.
|
| + // When overlapping calls happened, for example,
|
| + // #2 call comes up while #1 call is still running:
|
| + // IF #2 target_lang is the same with #1,
|
| + // #2 will do nothing but just returns |cancelled| parameter as true;
|
| + // ELSE
|
| + // #1 will be cancelled and returns |cancelled| parameter as true.
|
| + // In case of true |cancelled|, callers should ignore other parameters.
|
| + Translate(string translate_script, string source_lang, string target_lang)
|
| + => (bool cancelled,
|
| + string original_lang,
|
| + string translated_lang,
|
| + TranslateErrorsType error_type);
|
| +
|
| + // Tells the renderer to revert the text of translated page to its original
|
| + // contents.
|
| + RevertTranslation();
|
| +};
|
| +
|
| +interface ContentTranslateDriver {
|
| + // Notification that a new page is ready to translate,
|
| + // and the language for it has been determined.
|
| + NewPage(Page page,
|
| + LanguageDetectionDetails details,
|
| + bool page_needs_translation);
|
| +};
|
|
|