| 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" | 11 #include "components/spellcheck/common/spellcheck_marker.h" |
| 12 #include "components/spellcheck/common/spellcheck_result.h" | 12 #include "components/spellcheck/common/spellcheck_result.h" |
| 13 #include "components/spellcheck/spellcheck_build_features.h" |
| 13 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
| 14 #include "ipc/ipc_platform_file.h" | 15 #include "ipc/ipc_platform_file.h" |
| 15 | 16 |
| 16 #if !defined(ENABLE_SPELLCHECK) | 17 #if !BUILDFLAG(ENABLE_SPELLCHECK) |
| 17 #error "Spellcheck should be enabled" | 18 #error "Spellcheck should be enabled" |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 #define IPC_MESSAGE_START SpellCheckMsgStart | 21 #define IPC_MESSAGE_START SpellCheckMsgStart |
| 21 | 22 |
| 22 IPC_ENUM_TRAITS(SpellCheckResult::Decoration) | 23 IPC_ENUM_TRAITS(SpellCheckResult::Decoration) |
| 23 | 24 |
| 24 IPC_STRUCT_TRAITS_BEGIN(SpellCheckResult) | 25 IPC_STRUCT_TRAITS_BEGIN(SpellCheckResult) |
| 25 IPC_STRUCT_TRAITS_MEMBER(decoration) | 26 IPC_STRUCT_TRAITS_MEMBER(decoration) |
| 26 IPC_STRUCT_TRAITS_MEMBER(location) | 27 IPC_STRUCT_TRAITS_MEMBER(location) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 59 |
| 59 // Request a list of all document markers in the renderer for spelling service | 60 // Request a list of all document markers in the renderer for spelling service |
| 60 // feedback. | 61 // feedback. |
| 61 IPC_MESSAGE_CONTROL0(SpellCheckMsg_RequestDocumentMarkers) | 62 IPC_MESSAGE_CONTROL0(SpellCheckMsg_RequestDocumentMarkers) |
| 62 | 63 |
| 63 // Send a list of document markers in the renderer to the spelling service | 64 // Send a list of document markers in the renderer to the spelling service |
| 64 // feedback sender. | 65 // feedback sender. |
| 65 IPC_MESSAGE_CONTROL1(SpellCheckHostMsg_RespondDocumentMarkers, | 66 IPC_MESSAGE_CONTROL1(SpellCheckHostMsg_RespondDocumentMarkers, |
| 66 std::vector<uint32_t> /* document marker identifiers */) | 67 std::vector<uint32_t> /* document marker identifiers */) |
| 67 | 68 |
| 68 #if !defined(USE_BROWSER_SPELLCHECKER) | 69 #if !BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
| 69 // Sends text-check results from the Spelling service when the service finishes | 70 // Sends text-check results from the Spelling service when the service finishes |
| 70 // checking text received by a SpellCheckHostMsg_CallSpellingService message. | 71 // checking text received by a SpellCheckHostMsg_CallSpellingService message. |
| 71 // If the service is not available, the 4th parameter should be false and the | 72 // If the service is not available, the 4th parameter should be false and the |
| 72 // 5th parameter should contain the requested sentence. | 73 // 5th parameter should contain the requested sentence. |
| 73 IPC_MESSAGE_ROUTED4(SpellCheckMsg_RespondSpellingService, | 74 IPC_MESSAGE_ROUTED4(SpellCheckMsg_RespondSpellingService, |
| 74 int /* request identifier given by WebKit */, | 75 int /* request identifier given by WebKit */, |
| 75 bool /* succeeded calling service */, | 76 bool /* succeeded calling service */, |
| 76 base::string16 /* sentence */, | 77 base::string16 /* sentence */, |
| 77 std::vector<SpellCheckResult>) | 78 std::vector<SpellCheckResult>) |
| 78 #endif | 79 #endif |
| 79 | 80 |
| 80 #if defined(USE_BROWSER_SPELLCHECKER) | 81 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
| 81 // This message tells the renderer to advance to the next misspelling. It is | 82 // This message tells the renderer to advance to the next misspelling. It is |
| 82 // sent when the user clicks the "Find Next" button on the spelling panel. | 83 // sent when the user clicks the "Find Next" button on the spelling panel. |
| 83 IPC_MESSAGE_ROUTED0(SpellCheckMsg_AdvanceToNextMisspelling) | 84 IPC_MESSAGE_ROUTED0(SpellCheckMsg_AdvanceToNextMisspelling) |
| 84 | 85 |
| 85 // Sends when NSSpellChecker finishes checking text received by a preceding | 86 // Sends when NSSpellChecker finishes checking text received by a preceding |
| 86 // SpellCheckHostMsg_RequestTextCheck message. | 87 // SpellCheckHostMsg_RequestTextCheck message. |
| 87 IPC_MESSAGE_ROUTED3(SpellCheckMsg_RespondTextCheck, | 88 IPC_MESSAGE_ROUTED3(SpellCheckMsg_RespondTextCheck, |
| 88 int /* request identifier given by WebKit */, | 89 int /* request identifier given by WebKit */, |
| 89 base::string16 /* sentence */, | 90 base::string16 /* sentence */, |
| 90 std::vector<SpellCheckResult>) | 91 std::vector<SpellCheckResult>) |
| 91 | 92 |
| 92 IPC_MESSAGE_ROUTED1(SpellCheckMsg_ToggleSpellPanel, bool) | 93 IPC_MESSAGE_ROUTED1(SpellCheckMsg_ToggleSpellPanel, bool) |
| 93 #endif | 94 #endif |
| 94 | 95 |
| 95 // Messages sent from the renderer to the browser. | 96 // Messages sent from the renderer to the browser. |
| 96 | 97 |
| 97 // The renderer has tried to spell check a word, but couldn't because no | 98 // The renderer has tried to spell check a word, but couldn't because no |
| 98 // dictionary was available to load. Request that the browser find an | 99 // dictionary was available to load. Request that the browser find an |
| 99 // appropriate dictionary and return it. | 100 // appropriate dictionary and return it. |
| 100 IPC_MESSAGE_CONTROL0(SpellCheckHostMsg_RequestDictionary) | 101 IPC_MESSAGE_CONTROL0(SpellCheckHostMsg_RequestDictionary) |
| 101 | 102 |
| 102 // Tracks spell checking occurrence to collect histogram. | 103 // Tracks spell checking occurrence to collect histogram. |
| 103 IPC_MESSAGE_ROUTED2(SpellCheckHostMsg_NotifyChecked, | 104 IPC_MESSAGE_ROUTED2(SpellCheckHostMsg_NotifyChecked, |
| 104 base::string16 /* word */, | 105 base::string16 /* word */, |
| 105 bool /* true if checked word is misspelled */) | 106 bool /* true if checked word is misspelled */) |
| 106 | 107 |
| 107 #if !defined(USE_BROWSER_SPELLCHECKER) | 108 #if !BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
| 108 // Asks the Spelling service to check text. When the service finishes checking | 109 // Asks the Spelling service to check text. When the service finishes checking |
| 109 // the input text, it sends a SpellingCheckMsg_RespondSpellingService with | 110 // the input text, it sends a SpellingCheckMsg_RespondSpellingService with |
| 110 // text-check results. | 111 // text-check results. |
| 111 IPC_MESSAGE_CONTROL4(SpellCheckHostMsg_CallSpellingService, | 112 IPC_MESSAGE_CONTROL4(SpellCheckHostMsg_CallSpellingService, |
| 112 int /* route_id for response */, | 113 int /* route_id for response */, |
| 113 int /* request identifier given by WebKit */, | 114 int /* request identifier given by WebKit */, |
| 114 base::string16 /* sentence */, | 115 base::string16 /* sentence */, |
| 115 std::vector<SpellCheckMarker> /* markers */) | 116 std::vector<SpellCheckMarker> /* markers */) |
| 116 #endif | 117 #endif |
| 117 | 118 |
| 118 #if defined(USE_BROWSER_SPELLCHECKER) | 119 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
| 119 // Tells the browser to display or not display the SpellingPanel | 120 // Tells the browser to display or not display the SpellingPanel |
| 120 IPC_MESSAGE_ROUTED1(SpellCheckHostMsg_ShowSpellingPanel, | 121 IPC_MESSAGE_ROUTED1(SpellCheckHostMsg_ShowSpellingPanel, |
| 121 bool /* if true, then show it, otherwise hide it*/) | 122 bool /* if true, then show it, otherwise hide it*/) |
| 122 | 123 |
| 123 // Tells the browser to update the spelling panel with the given word. | 124 // Tells the browser to update the spelling panel with the given word. |
| 124 IPC_MESSAGE_ROUTED1(SpellCheckHostMsg_UpdateSpellingPanelWithMisspelledWord, | 125 IPC_MESSAGE_ROUTED1(SpellCheckHostMsg_UpdateSpellingPanelWithMisspelledWord, |
| 125 base::string16 /* the word to update the panel with */) | 126 base::string16 /* the word to update the panel with */) |
| 126 | 127 |
| 127 // TODO(groby): This needs to originate from SpellcheckProvider. | 128 // TODO(groby): This needs to originate from SpellcheckProvider. |
| 128 IPC_SYNC_MESSAGE_CONTROL2_1(SpellCheckHostMsg_CheckSpelling, | 129 IPC_SYNC_MESSAGE_CONTROL2_1(SpellCheckHostMsg_CheckSpelling, |
| 129 base::string16 /* word */, | 130 base::string16 /* word */, |
| 130 int /* route_id */, | 131 int /* route_id */, |
| 131 bool /* correct */) | 132 bool /* correct */) |
| 132 | 133 |
| 133 IPC_SYNC_MESSAGE_CONTROL1_1(SpellCheckHostMsg_FillSuggestionList, | 134 IPC_SYNC_MESSAGE_CONTROL1_1(SpellCheckHostMsg_FillSuggestionList, |
| 134 base::string16 /* word */, | 135 base::string16 /* word */, |
| 135 std::vector<base::string16> /* suggestions */) | 136 std::vector<base::string16> /* suggestions */) |
| 136 | 137 |
| 137 IPC_MESSAGE_CONTROL4(SpellCheckHostMsg_RequestTextCheck, | 138 IPC_MESSAGE_CONTROL4(SpellCheckHostMsg_RequestTextCheck, |
| 138 int /* route_id for response */, | 139 int /* route_id for response */, |
| 139 int /* request identifier given by WebKit */, | 140 int /* request identifier given by WebKit */, |
| 140 base::string16 /* sentence */, | 141 base::string16 /* sentence */, |
| 141 std::vector<SpellCheckMarker> /* markers */) | 142 std::vector<SpellCheckMarker> /* markers */) |
| 142 | 143 |
| 143 IPC_MESSAGE_ROUTED2(SpellCheckHostMsg_ToggleSpellCheck, | 144 IPC_MESSAGE_ROUTED2(SpellCheckHostMsg_ToggleSpellCheck, |
| 144 bool /* enabled */, | 145 bool /* enabled */, |
| 145 bool /* checked */) | 146 bool /* checked */) |
| 146 #endif // USE_BROWSER_SPELLCHECKER | 147 #endif // USE_BROWSER_SPELLCHECKER |
| OLD | NEW |