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