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

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: Fix unit tests 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 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
11 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.
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 TRANSLATE_ERROR_MAX,
24 };
25
26 // struct translate::LanguageDetectionDetails
27 struct LanguageDetectionDetails {
28 mojo.common.mojom.Time time;
29 url.mojom.Url url;
30 string content_language;
31 string cld_language;
32 bool is_cld_reliable;
33 bool has_notranslate;
34 string html_root_language;
35 string adopted_language;
36 string contents;
37 };
38
39 interface Page {
40 // 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
41 // another.
42 // When overlapping calls happened, for example,
43 // #2 call comes up while #1 call is still running:
44 // IF #2 target_lang is the same with #1,
45 // #2 will do nothing but just returns |cancelled| parameter as true;
46 // ELSE
47 // #1 will be cancelled and returns |cancelled| parameter as true.
48 // In case of true |cancelled|, callers should ignore other parameters.
49 Translate(string translate_script, string source_lang, string target_lang)
50 => (bool cancelled,
51 string original_lang,
52 string translated_lang,
53 TranslateErrorsType error_type);
54
55 // Tells the renderer to revert the text of translated page to its original
56 // contents.
57 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.
58 };
59
60 interface ContentTranslateDriver {
61 // Notification that a new page is ready to translate,
62 // and the language for it has been determined.
63 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.
64 LanguageDetectionDetails details,
65 bool page_needs_translation);
66 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698