1 // Copyright (c) 2013 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 #ifndef CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_ACTION_H_
6 #define CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_ACTION_H_
8 #include "base/strings/string16.h"
11 class DictionaryValue
;
14 // User's action on a misspelled word.
15 class SpellcheckAction
{
17 // Type of spellcheck action.
18 enum SpellcheckActionType
{
19 // User added the word to the dictionary and cannot take more actions on
22 // User took a look at the suggestions in the context menu, but did not
23 // select any suggestions. The user cannot take any more actions on the
24 // misspelling, because it has been deleted from the web page.
26 // The misspelling is in user's custom spellcheck dictionary. The user will
27 // not see spellcheck suggestions for this misspelling.
29 // The user manually corrected the word to |value|. The user cannot take
30 // more actions on this misspelling.
31 TYPE_MANUALLY_CORRECTED
,
32 // The user has taken no action on the misspelling and will not take any
33 // more actions, because the misspelled text has been removed from the web
36 // The user has taken no action on the misspelled yet, but might take an
37 // action in the future, because the misspelling is still on the web page.
39 // User took a look at the suggestions in the context menu, but did not
40 // select any suggestions. The user still can take further actions on the
43 // The user has selected the suggestion at |index| and cannot take more
44 // actions on this misspelling.
49 SpellcheckAction(SpellcheckActionType type
, int index
, base::string16 value
);
52 // Returns true if the action is final and should be sent to the feedback
53 // server. Otherwise returns false.
56 // Makes this action final and ready to be sent to the feedback server. The
57 // method is idempotent. Finalizing an action that is already final does
61 // Serializes the data in this object into a dictionary value. The caller owns
63 base::DictionaryValue
* Serialize() const;
65 void set_type(SpellcheckActionType type
) { type_
= type
; }
66 void set_index(int index
) { index_
= index
; }
67 void set_value(const base::string16
& value
) { value_
= value
; }
69 SpellcheckActionType
type() const { return type_
; }
73 SpellcheckActionType type_
;
75 // The index for the user action, if applicable.
78 // The value for the user action, if applicable.
79 base::string16 value_
;
82 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_ACTION_H_