OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 // An object to store user feedback to a single spellcheck suggestion. | 5 // An object to store user feedback to a single spellcheck suggestion. |
6 // | 6 // |
7 // Stores the spellcheck suggestion, its uint32_t hash identifier, and user's | 7 // Stores the spellcheck suggestion, its uint32_t hash identifier, and user's |
8 // feedback. The feedback is indirect, in the sense that we record user's | 8 // feedback. The feedback is indirect, in the sense that we record user's |
9 // |action| instead of asking them how they feel about a spellcheck suggestion. | 9 // |action| instead of asking them how they feel about a spellcheck suggestion. |
10 // The object can serialize itself. | 10 // The object can serialize itself. |
(...skipping 21 matching lines...) Expand all Loading... |
32 // misspelling.action.set_type(SpellcheckAction::TYPE_SELECT); | 32 // misspelling.action.set_type(SpellcheckAction::TYPE_SELECT); |
33 // misspelling.action.set_index(0); | 33 // misspelling.action.set_index(0); |
34 // Process(SerializeMisspelling(misspelling)); | 34 // Process(SerializeMisspelling(misspelling)); |
35 struct Misspelling { | 35 struct Misspelling { |
36 Misspelling(); | 36 Misspelling(); |
37 Misspelling(const base::string16& context, | 37 Misspelling(const base::string16& context, |
38 size_t location, | 38 size_t location, |
39 size_t length, | 39 size_t length, |
40 const std::vector<base::string16>& suggestions, | 40 const std::vector<base::string16>& suggestions, |
41 uint32_t hash); | 41 uint32_t hash); |
| 42 Misspelling(const Misspelling& other); |
42 ~Misspelling(); | 43 ~Misspelling(); |
43 | 44 |
44 // A several-word text snippet that immediately surrounds the misspelling. | 45 // A several-word text snippet that immediately surrounds the misspelling. |
45 base::string16 context; | 46 base::string16 context; |
46 | 47 |
47 // The number of characters between the beginning of |context| and the first | 48 // The number of characters between the beginning of |context| and the first |
48 // misspelled character. | 49 // misspelled character. |
49 size_t location; | 50 size_t location; |
50 | 51 |
51 // The number of characters in the misspelling. | 52 // The number of characters in the misspelling. |
(...skipping 17 matching lines...) Expand all Loading... |
69 const Misspelling& misspelling); | 70 const Misspelling& misspelling); |
70 | 71 |
71 // Returns the substring of |context| that begins at |location| and contains | 72 // Returns the substring of |context| that begins at |location| and contains |
72 // |length| characters. | 73 // |length| characters. |
73 base::string16 GetMisspelledString(const Misspelling& misspelling); | 74 base::string16 GetMisspelledString(const Misspelling& misspelling); |
74 | 75 |
75 // Returns the approximate size of the misspelling when serialized. | 76 // Returns the approximate size of the misspelling when serialized. |
76 size_t ApproximateSerializedSize(const Misspelling& misspelling); | 77 size_t ApproximateSerializedSize(const Misspelling& misspelling); |
77 | 78 |
78 #endif // CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_ | 79 #endif // CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_ |
OLD | NEW |