Home | History | Annotate | Download | only in common
      1 // Copyright (c) 2011 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 "ipc/ipc_message_macros.h"
      9 #include "ipc/ipc_platform_file.h"
     10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult.h"
     11 
     12 #define IPC_MESSAGE_START SpellCheckMsgStart
     13 
     14 IPC_ENUM_TRAITS(WebKit::WebTextCheckingResult::Error)
     15 
     16 IPC_STRUCT_TRAITS_BEGIN(WebKit::WebTextCheckingResult)
     17   IPC_STRUCT_TRAITS_MEMBER(error)
     18   IPC_STRUCT_TRAITS_MEMBER(position)
     19   IPC_STRUCT_TRAITS_MEMBER(length)
     20 IPC_STRUCT_TRAITS_END()
     21 
     22 
     23 // Messages sent from the browser to the renderer.
     24 
     25 IPC_MESSAGE_ROUTED0(SpellCheckMsg_ToggleSpellCheck)
     26 
     27 IPC_MESSAGE_ROUTED1(SpellCheckMsg_ToggleSpellPanel,
     28                     bool)
     29 
     30 IPC_MESSAGE_ROUTED3(SpellCheckMsg_RespondTextCheck,
     31                     int        /* request identifier given by WebKit */,
     32                     int        /* document tag */,
     33                     std::vector<WebKit::WebTextCheckingResult>)
     34 
     35 // This message tells the renderer to advance to the next misspelling. It is
     36 // sent when the user clicks the "Find Next" button on the spelling panel.
     37 IPC_MESSAGE_ROUTED0(SpellCheckMsg_AdvanceToNextMisspelling)
     38 
     39 // Passes some initialization params to the renderer's spellchecker. This can
     40 // be called directly after startup or in (async) response to a
     41 // RequestDictionary ViewHost message.
     42 IPC_MESSAGE_CONTROL4(SpellCheckMsg_Init,
     43                      IPC::PlatformFileForTransit /* bdict_file */,
     44                      std::vector<std::string> /* custom_dict_words */,
     45                      std::string /* language */,
     46                      bool /* auto spell correct */)
     47 
     48 // A word has been added to the custom dictionary; update the local custom
     49 // word list.
     50 IPC_MESSAGE_CONTROL1(SpellCheckMsg_WordAdded,
     51                      std::string /* word */)
     52 
     53 // Toggle the auto spell correct functionality.
     54 IPC_MESSAGE_CONTROL1(SpellCheckMsg_EnableAutoSpellCorrect,
     55                      bool /* enable */)
     56 
     57 
     58 // Messages sent from the renderer to the browser.
     59 
     60 // Asks the browser for a unique document tag.
     61 IPC_SYNC_MESSAGE_ROUTED0_1(SpellCheckHostMsg_GetDocumentTag,
     62                            int /* the tag */)
     63 
     64 // This message tells the spellchecker that a document, identified by an int
     65 // tag, has been closed and all of the ignored words for that document can be
     66 // forgotten.
     67 IPC_MESSAGE_ROUTED1(SpellCheckHostMsg_DocumentWithTagClosed,
     68                     int /* the tag */)
     69 
     70 // Tells the browser to display or not display the SpellingPanel
     71 IPC_MESSAGE_ROUTED1(SpellCheckHostMsg_ShowSpellingPanel,
     72                     bool /* if true, then show it, otherwise hide it*/)
     73 
     74 // Tells the browser to update the spelling panel with the given word.
     75 IPC_MESSAGE_ROUTED1(SpellCheckHostMsg_UpdateSpellingPanelWithMisspelledWord,
     76                     string16 /* the word to update the panel with */)
     77 
     78 // The renderer has tried to spell check a word, but couldn't because no
     79 // dictionary was available to load. Request that the browser find an
     80 // appropriate dictionary and return it.
     81 IPC_MESSAGE_CONTROL0(SpellCheckHostMsg_RequestDictionary)
     82 
     83 IPC_SYNC_MESSAGE_CONTROL2_1(SpellCheckHostMsg_PlatformCheckSpelling,
     84                             string16 /* word */,
     85                             int /* document tag */,
     86                             bool /* correct */)
     87 
     88 IPC_SYNC_MESSAGE_CONTROL1_1(SpellCheckHostMsg_PlatformFillSuggestionList,
     89                             string16 /* word */,
     90                             std::vector<string16> /* suggestions */)
     91 
     92 IPC_MESSAGE_CONTROL4(SpellCheckHostMsg_PlatformRequestTextCheck,
     93                      int /* route_id for response */,
     94                      int /* request identifier given by WebKit */,
     95                      int /* document tag */,
     96                      string16 /* sentence */)
     97