Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / spellchecker / spellcheck_action.h
blobeb85fff006e412290ba8d9ca41c58f47e54bb069
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"
10 namespace base {
11 class DictionaryValue;
14 // User's action on a misspelled word.
15 class SpellcheckAction {
16 public:
17 // Type of spellcheck action.
18 enum SpellcheckActionType {
19 // User added the word to the dictionary and cannot take more actions on
20 // this misspelling.
21 TYPE_ADD_TO_DICT,
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.
25 TYPE_IGNORE,
26 // The misspelling is in user's custom spellcheck dictionary. The user will
27 // not see spellcheck suggestions for this misspelling.
28 TYPE_IN_DICTIONARY,
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
34 // page.
35 TYPE_NO_ACTION,
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.
38 TYPE_PENDING,
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
41 // misspelling.
42 TYPE_PENDING_IGNORE,
43 // The user has selected the suggestion at |index| and cannot take more
44 // actions on this misspelling.
45 TYPE_SELECT,
48 SpellcheckAction();
49 SpellcheckAction(SpellcheckActionType type, int index, base::string16 value);
50 ~SpellcheckAction();
52 // Returns true if the action is final and should be sent to the feedback
53 // server. Otherwise returns false.
54 bool IsFinal() const;
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
58 // nothing.
59 void Finalize();
61 // Serializes the data in this object into a dictionary value. The caller owns
62 // the result.
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_; }
71 private:
72 // User action.
73 SpellcheckActionType type_;
75 // The index for the user action, if applicable.
76 int index_;
78 // The value for the user action, if applicable.
79 base::string16 value_;
82 #endif // CHROME_BROWSER_SPELLCHECKER_SPELLCHECK_ACTION_H_