| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 module translate.mojom; |
| 6 |
| 7 import "mojo/common/common_custom_types.mojom"; |
| 8 import "url/mojo/url.mojom"; |
| 9 |
| 10 // enum translate::TranslateErrors::Type |
| 11 enum TranslateErrorsType { |
| 12 NONE, |
| 13 NETWORK, |
| 14 INITIALIZATION_ERROR, |
| 15 UNKNOWN_LANGUAGE, |
| 16 UNSUPPORTED_LANGUAGE, |
| 17 IDENTICAL_LANGUAGES, |
| 18 TRANSLATION_ERROR, |
| 19 TRANSLATION_TIMEOUT, |
| 20 UNEXPECTED_SCRIPT_ERROR, |
| 21 BAD_ORIGIN, |
| 22 SCRIPT_LOAD_ERROR, |
| 23 }; |
| 24 |
| 25 // struct translate::LanguageDetectionDetails |
| 26 struct LanguageDetectionDetails { |
| 27 mojo.common.mojom.Time time; |
| 28 url.mojom.Url url; |
| 29 string content_language; |
| 30 string cld_language; |
| 31 bool is_cld_reliable; |
| 32 bool has_notranslate; |
| 33 string html_root_language; |
| 34 string adopted_language; |
| 35 string contents; |
| 36 }; |
| 37 |
| 38 interface TranslateHelper { |
| 39 // Tells the renderer to translate the page contents from one language to |
| 40 // another. |
| 41 TranslatePage(int32 page_seq_no, |
| 42 string translate_script, |
| 43 string source_lang, |
| 44 string target_lang); |
| 45 |
| 46 // Tells the renderer to revert the text of translated page to its original |
| 47 // contents. |
| 48 RevertTranslation(int32 page_seq_no); |
| 49 }; |
| 50 |
| 51 interface ContentTranslateDriver { |
| 52 // Notification that the current page was assigned a sequence number. |
| 53 TranslateAssignedSequenceNumber(int32 page_seq_no); |
| 54 |
| 55 // Notification that the language for the tab has been determined. |
| 56 TranslateLanguageDetermined(LanguageDetectionDetails, |
| 57 bool page_needs_translation); |
| 58 |
| 59 // Notifies the browser that a page has been translated. |
| 60 PageTranslated(string original_lang, |
| 61 string translated_lang, |
| 62 TranslateErrorsType error_type); |
| 63 }; |
| OLD | NEW |