OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 // IPC messages for spellcheck. | |
6 // Multiply-included message file, hence no include guard. | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "chrome/common/spellcheck_bdict_language.h" | |
11 #include "chrome/common/spellcheck_marker.h" | |
12 #include "chrome/common/spellcheck_result.h" | |
13 #include "ipc/ipc_message_macros.h" | |
14 #include "ipc/ipc_platform_file.h" | |
15 | |
16 #if !defined(ENABLE_SPELLCHECK) | |
17 #error "Spellcheck should be enabled" | |
18 #endif | |
19 | |
20 #define IPC_MESSAGE_START SpellCheckMsgStart | |
21 | |
22 IPC_ENUM_TRAITS(SpellCheckResult::Decoration) | |
23 | |
24 IPC_STRUCT_TRAITS_BEGIN(SpellCheckResult) | |
25 IPC_STRUCT_TRAITS_MEMBER(decoration) | |
26 IPC_STRUCT_TRAITS_MEMBER(location) | |
27 IPC_STRUCT_TRAITS_MEMBER(length) | |
28 IPC_STRUCT_TRAITS_MEMBER(replacement) | |
29 IPC_STRUCT_TRAITS_MEMBER(hash) | |
30 IPC_STRUCT_TRAITS_END() | |
31 | |
32 IPC_STRUCT_TRAITS_BEGIN(SpellCheckMarker) | |
33 IPC_STRUCT_TRAITS_MEMBER(hash) | |
34 IPC_STRUCT_TRAITS_MEMBER(offset) | |
35 IPC_STRUCT_TRAITS_END() | |
36 | |
37 IPC_STRUCT_TRAITS_BEGIN(SpellCheckBDictLanguage) | |
38 IPC_STRUCT_TRAITS_MEMBER(file) | |
39 IPC_STRUCT_TRAITS_MEMBER(language) | |
40 IPC_STRUCT_TRAITS_END() | |
41 | |
42 // Messages sent from the browser to the renderer. | |
43 | |
44 IPC_MESSAGE_CONTROL1(SpellCheckMsg_EnableSpellCheck, | |
45 bool) | |
46 | |
47 // Passes some initialization params from the browser to the renderer's | |
48 // spellchecker. This can be called directly after startup or in (async) | |
49 // response to a RequestDictionary ViewHost message. | |
50 IPC_MESSAGE_CONTROL2(SpellCheckMsg_Init, | |
51 std::vector<SpellCheckBDictLanguage> /* bdict_languages */, | |
52 std::set<std::string> /* custom_dict_words */) | |
53 | |
54 // Words have been added and removed in the custom dictionary; update the local | |
55 // custom word list. | |
56 IPC_MESSAGE_CONTROL2(SpellCheckMsg_CustomDictionaryChanged, | |
57 std::set<std::string> /* words_added */, | |
58 std::set<std::string> /* words_removed */) | |
59 | |
60 // Request a list of all document markers in the renderer for spelling service | |
61 // feedback. | |
62 IPC_MESSAGE_CONTROL0(SpellCheckMsg_RequestDocumentMarkers) | |
63 | |
64 // Send a list of document markers in the renderer to the spelling service | |
65 // feedback sender. | |
66 IPC_MESSAGE_CONTROL1(SpellCheckHostMsg_RespondDocumentMarkers, | |
67 std::vector<uint32_t> /* document marker identifiers */) | |
68 | |
69 #if !defined(USE_BROWSER_SPELLCHECKER) | |
70 // Sends text-check results from the Spelling service when the service finishes | |
71 // checking text received by a SpellCheckHostMsg_CallSpellingService message. | |
72 // If the service is not available, the 4th parameter should be false and the | |
73 // 5th parameter should contain the requested sentence. | |
74 IPC_MESSAGE_ROUTED4(SpellCheckMsg_RespondSpellingService, | |
75 int /* request identifier given by WebKit */, | |
76 bool /* succeeded calling service */, | |
77 base::string16 /* sentence */, | |
78 std::vector<SpellCheckResult>) | |
79 #endif | |
80 | |
81 #if defined(USE_BROWSER_SPELLCHECKER) | |
82 // This message tells the renderer to advance to the next misspelling. It is | |
83 // sent when the user clicks the "Find Next" button on the spelling panel. | |
84 IPC_MESSAGE_ROUTED0(SpellCheckMsg_AdvanceToNextMisspelling) | |
85 | |
86 // Sends when NSSpellChecker finishes checking text received by a preceding | |
87 // SpellCheckHostMsg_RequestTextCheck message. | |
88 IPC_MESSAGE_ROUTED3(SpellCheckMsg_RespondTextCheck, | |
89 int /* request identifier given by WebKit */, | |
90 base::string16 /* sentence */, | |
91 std::vector<SpellCheckResult>) | |
92 | |
93 IPC_MESSAGE_ROUTED1(SpellCheckMsg_ToggleSpellPanel, | |
94 bool) | |
95 #endif | |
96 | |
97 // Messages sent from the renderer to the browser. | |
98 | |
99 // The renderer has tried to spell check a word, but couldn't because no | |
100 // dictionary was available to load. Request that the browser find an | |
101 // appropriate dictionary and return it. | |
102 IPC_MESSAGE_CONTROL0(SpellCheckHostMsg_RequestDictionary) | |
103 | |
104 // Tracks spell checking occurrence to collect histogram. | |
105 IPC_MESSAGE_ROUTED2(SpellCheckHostMsg_NotifyChecked, | |
106 base::string16 /* word */, | |
107 bool /* true if checked word is misspelled */) | |
108 | |
109 #if !defined(USE_BROWSER_SPELLCHECKER) | |
110 // Asks the Spelling service to check text. When the service finishes checking | |
111 // the input text, it sends a SpellingCheckMsg_RespondSpellingService with | |
112 // text-check results. | |
113 IPC_MESSAGE_CONTROL4(SpellCheckHostMsg_CallSpellingService, | |
114 int /* route_id for response */, | |
115 int /* request identifier given by WebKit */, | |
116 base::string16 /* sentence */, | |
117 std::vector<SpellCheckMarker> /* markers */) | |
118 #endif | |
119 | |
120 #if defined(USE_BROWSER_SPELLCHECKER) | |
121 // Tells the browser to display or not display the SpellingPanel | |
122 IPC_MESSAGE_ROUTED1(SpellCheckHostMsg_ShowSpellingPanel, | |
123 bool /* if true, then show it, otherwise hide it*/) | |
124 | |
125 // Tells the browser to update the spelling panel with the given word. | |
126 IPC_MESSAGE_ROUTED1(SpellCheckHostMsg_UpdateSpellingPanelWithMisspelledWord, | |
127 base::string16 /* the word to update the panel with */) | |
128 | |
129 // TODO(groby): This needs to originate from SpellcheckProvider. | |
130 IPC_SYNC_MESSAGE_CONTROL2_1(SpellCheckHostMsg_CheckSpelling, | |
131 base::string16 /* word */, | |
132 int /* route_id */, | |
133 bool /* correct */) | |
134 | |
135 IPC_SYNC_MESSAGE_CONTROL1_1(SpellCheckHostMsg_FillSuggestionList, | |
136 base::string16 /* word */, | |
137 std::vector<base::string16> /* suggestions */) | |
138 | |
139 IPC_MESSAGE_CONTROL4(SpellCheckHostMsg_RequestTextCheck, | |
140 int /* route_id for response */, | |
141 int /* request identifier given by WebKit */, | |
142 base::string16 /* sentence */, | |
143 std::vector<SpellCheckMarker> /* markers */) | |
144 | |
145 IPC_MESSAGE_ROUTED2(SpellCheckHostMsg_ToggleSpellCheck, | |
146 bool /* enabled */, | |
147 bool /* checked */) | |
148 #endif // USE_BROWSER_SPELLCHECKER | |
OLD | NEW |