Chromium Code Reviews| 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 |
|
Ken Rockot(use gerrit already)
2016/07/28 20:16:06
I don't think we should reference typemapped types
leonhsl(Using Gerrit)
2016/07/29 12:54:32
Yeah, it is true. Done. Also removed other similar
|
| +enum TranslateErrorsType { |
|
Ken Rockot(use gerrit already)
2016/07/28 20:16:06
nit: TranslateError seems like a better name?
leonhsl(Using Gerrit)
2016/07/29 12:54:32
Done.
|
| + 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 |
|
Ken Rockot(use gerrit already)
2016/07/28 20:16:06
I wonder if we could make this documentation more
leonhsl(Using Gerrit)
2016/07/29 12:54:32
Aha,, Thank you!! Now it's very clear and easy 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(); |
|
Ken Rockot(use gerrit already)
2016/07/28 20:16:06
suggestion:
// Requests that the page be reverted
leonhsl(Using Gerrit)
2016/07/29 12:54:32
Done.
|
| +}; |
| + |
| +interface ContentTranslateDriver { |
| + // Notification that a new page is ready to translate, |
| + // and the language for it has been determined. |
| + NewPage(Page page, |
|
Ken Rockot(use gerrit already)
2016/07/28 20:16:06
nit: RegisterPage? Method names should generally b
leonhsl(Using Gerrit)
2016/07/29 12:54:32
Got it and done.
|
| + LanguageDetectionDetails details, |
| + bool page_needs_translation); |
| +}; |