OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Multiply-included message file, hence no include guard. | 5 // Multiply-included message file, hence no include guard. |
6 | 6 |
7 #include "components/translate/core/common/language_detection_details.h" | 7 #include "components/translate/core/common/language_detection_details.h" |
8 #include "components/translate/core/common/translate_errors.h" | 8 #include "components/translate/core/common/translate_errors.h" |
9 #include "content/public/common/common_param_traits.h" | 9 #include "content/public/common/common_param_traits.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
11 #include "ipc/ipc_message_utils.h" | 11 #include "ipc/ipc_message_utils.h" |
12 | 12 |
13 #if defined(CLD2_DYNAMIC_MODE) | |
14 #include "ipc/ipc_platform_file.h" | |
15 #endif | |
16 | |
17 #define IPC_MESSAGE_START TranslateMsgStart | 13 #define IPC_MESSAGE_START TranslateMsgStart |
18 | 14 |
19 IPC_ENUM_TRAITS(TranslateErrors::Type) | 15 IPC_ENUM_TRAITS(TranslateErrors::Type) |
20 | 16 |
21 IPC_STRUCT_TRAITS_BEGIN(LanguageDetectionDetails) | 17 IPC_STRUCT_TRAITS_BEGIN(LanguageDetectionDetails) |
22 IPC_STRUCT_TRAITS_MEMBER(time) | 18 IPC_STRUCT_TRAITS_MEMBER(time) |
23 IPC_STRUCT_TRAITS_MEMBER(url) | 19 IPC_STRUCT_TRAITS_MEMBER(url) |
24 IPC_STRUCT_TRAITS_MEMBER(content_language) | 20 IPC_STRUCT_TRAITS_MEMBER(content_language) |
25 IPC_STRUCT_TRAITS_MEMBER(cld_language) | 21 IPC_STRUCT_TRAITS_MEMBER(cld_language) |
26 IPC_STRUCT_TRAITS_MEMBER(is_cld_reliable) | 22 IPC_STRUCT_TRAITS_MEMBER(is_cld_reliable) |
27 IPC_STRUCT_TRAITS_MEMBER(html_root_language) | 23 IPC_STRUCT_TRAITS_MEMBER(html_root_language) |
28 IPC_STRUCT_TRAITS_MEMBER(adopted_language) | 24 IPC_STRUCT_TRAITS_MEMBER(adopted_language) |
29 IPC_STRUCT_TRAITS_MEMBER(contents) | 25 IPC_STRUCT_TRAITS_MEMBER(contents) |
30 IPC_STRUCT_TRAITS_END() | 26 IPC_STRUCT_TRAITS_END() |
31 | 27 |
32 //----------------------------------------------------------------------------- | 28 //----------------------------------------------------------------------------- |
33 // RenderView messages | 29 // RenderView messages |
34 // These are messages sent from the browser to the renderer process. | 30 // These are messages sent from the browser to the renderer process. |
35 | 31 |
36 // Tells the renderer to translate the page contents from one language to | 32 // Tells the renderer to translate the page contents from one language to |
37 // another. | 33 // another. |
38 IPC_MESSAGE_ROUTED4(ChromeViewMsg_TranslatePage, | 34 IPC_MESSAGE_ROUTED4(ChromeViewMsg_TranslatePage, |
39 int /* page id */, | 35 int /* page id */, |
40 std::string, /* the script injected in the page */ | 36 std::string, /* the script injected in the page */ |
41 std::string, /* BCP 47/RFC 5646 language code the page | 37 std::string, /* BCP 47/RFC 5646 language code the page |
42 is in */ | 38 is in */ |
43 std::string /* BCP 47/RFC 5646 language code to translate | 39 std::string /* BCP 47/RFC 5646 language code to translate |
44 to */) | 40 to */) |
45 | 41 |
46 #if defined(CLD2_DYNAMIC_MODE) | |
47 // Informs the renderer process that Compact Language Detector (CLD) data is | |
48 // available and provides an IPC::PlatformFileForTransit obtained from | |
49 // IPC::GetFileHandleForProcess(...) | |
50 // See also: ChromeViewHostMsg_NeedCLDData | |
51 IPC_MESSAGE_ROUTED3(ChromeViewMsg_CLDDataAvailable, | |
52 IPC::PlatformFileForTransit /* ipc_file_handle */, | |
53 uint64 /* data_offset */, | |
54 uint64 /* data_length */) | |
55 #endif | |
56 | |
57 //----------------------------------------------------------------------------- | 42 //----------------------------------------------------------------------------- |
58 // Misc messages | 43 // Misc messages |
59 // These are messages sent from the renderer to the browser process. | 44 // These are messages sent from the renderer to the browser process. |
60 | 45 |
61 // Notification that the language for the tab has been determined. | 46 // Notification that the language for the tab has been determined. |
62 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_TranslateLanguageDetermined, | 47 IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_TranslateLanguageDetermined, |
63 LanguageDetectionDetails /* details about lang detection */, | 48 LanguageDetectionDetails /* details about lang detection */, |
64 bool /* whether the page needs translation */) | 49 bool /* whether the page needs translation */) |
65 | 50 |
66 // Notifies the browser that a page has been translated. | 51 // Notifies the browser that a page has been translated. |
67 IPC_MESSAGE_ROUTED4(ChromeViewHostMsg_PageTranslated, | 52 IPC_MESSAGE_ROUTED4(ChromeViewHostMsg_PageTranslated, |
68 int, /* page id */ | 53 int, /* page id */ |
69 std::string /* the original language */, | 54 std::string /* the original language */, |
70 std::string /* the translated language */, | 55 std::string /* the translated language */, |
71 TranslateErrors::Type /* the error type if available */) | 56 TranslateErrors::Type /* the error type if available */) |
72 | 57 |
73 // Tells the renderer to revert the text of translated page to its original | 58 // Tells the renderer to revert the text of translated page to its original |
74 // contents. | 59 // contents. |
75 IPC_MESSAGE_ROUTED1(ChromeViewMsg_RevertTranslation, | 60 IPC_MESSAGE_ROUTED1(ChromeViewMsg_RevertTranslation, |
76 int /* page id */) | 61 int /* page id */) |
77 | |
78 #if defined(CLD2_DYNAMIC_MODE) | |
79 // Informs the browser process that Compact Language Detector (CLD) data is | |
80 // required by the originating renderer. The browser process should respond | |
81 // with a ChromeViewMsg_CLDDataAvailable if the data is available, else it | |
82 // should go unanswered (the renderer will ask again later). | |
83 // See also: ChromeViewMsg_CLDDataAvailable | |
84 IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_NeedCLDData) | |
85 #endif | |
OLD | NEW |