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