Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1120)

Unified Diff: components/translate/content/public/interfaces/translate.mojom

Issue 2143383002: [Translate] Migrate IPCs to Mojo interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from Ken and Anand Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..158a8a74c0b9010ae91c6bef3f23854c97fe33ff
--- /dev/null
+++ b/components/translate/content/public/interfaces/translate.mojom
@@ -0,0 +1,68 @@
+// 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 TranslateError {
+ 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 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 {
+ // Requests that the page be translated from |source_lang| to
+ // |target_lang|.
+ //
+ // If a Translate request is already in progress with a matching
+ // |target_lang|, this request will respond with |cancelled| set
+ // to |true|.
+ //
+ // If a Translate request is already in progress with a different
+ // |target_lang|, that request will respond with |cancelled| set
+ // to |true| and this request will proceed normally.
+ //
+ // If |cancelled| is |true| all other response values should be
+ // ignored.
+ Translate(string translate_script, string source_lang, string target_lang)
+ => (bool cancelled,
Ken Rockot(use gerrit already) 2016/07/29 17:21:17 nit: it's fine (preferrable imho) to fit as many a
leonhsl(Using Gerrit) 2016/07/30 08:45:07 Done.
+ string original_lang,
+ string translated_lang,
+ TranslateError error_type);
Ken Rockot(use gerrit already) 2016/07/29 17:21:17 nit nit: Maybe just error instead of error_type?
leonhsl(Using Gerrit) 2016/07/30 08:45:07 Done.
+
+ // Requests that the page be reverted to its original language with
+ // no translation applied.
+ RevertTranslation();
+};
+
+interface ContentTranslateDriver {
+ // Notification that a new page is ready to translate,
+ // and the language for it has been determined.
+ RegisterPage(Page page,
+ LanguageDetectionDetails details,
+ bool page_needs_translation);
+};

Powered by Google App Engine
This is Rietveld 408576698