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

Side by Side 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, 4 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 unified diff | Download patch
OLDNEW
(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 TranslateError {
11 NONE,
12 NETWORK,
13 INITIALIZATION_ERROR,
14 UNKNOWN_LANGUAGE,
15 UNSUPPORTED_LANGUAGE,
16 IDENTICAL_LANGUAGES,
17 TRANSLATION_ERROR,
18 TRANSLATION_TIMEOUT,
19 UNEXPECTED_SCRIPT_ERROR,
20 BAD_ORIGIN,
21 SCRIPT_LOAD_ERROR,
22 TRANSLATE_ERROR_MAX,
23 };
24
25 struct LanguageDetectionDetails {
26 mojo.common.mojom.Time time;
27 url.mojom.Url url;
28 string content_language;
29 string cld_language;
30 bool is_cld_reliable;
31 bool has_notranslate;
32 string html_root_language;
33 string adopted_language;
34 string contents;
35 };
36
37 interface Page {
38 // Requests that the page be translated from |source_lang| to
39 // |target_lang|.
40 //
41 // If a Translate request is already in progress with a matching
42 // |target_lang|, this request will respond with |cancelled| set
43 // to |true|.
44 //
45 // If a Translate request is already in progress with a different
46 // |target_lang|, that request will respond with |cancelled| set
47 // to |true| and this request will proceed normally.
48 //
49 // If |cancelled| is |true| all other response values should be
50 // ignored.
51 Translate(string translate_script, string source_lang, string target_lang)
52 => (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.
53 string original_lang,
54 string translated_lang,
55 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.
56
57 // Requests that the page be reverted to its original language with
58 // no translation applied.
59 RevertTranslation();
60 };
61
62 interface ContentTranslateDriver {
63 // Notification that a new page is ready to translate,
64 // and the language for it has been determined.
65 RegisterPage(Page page,
66 LanguageDetectionDetails details,
67 bool page_needs_translation);
68 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698