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. |
11 | 11 |
12 #ifndef CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_ | 12 #ifndef CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_ |
13 #define CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_ | 13 #define CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_ |
14 | 14 |
15 #include <stddef.h> | 15 #include <stddef.h> |
16 #include <stdint.h> | 16 #include <stdint.h> |
17 | 17 |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "base/memory/scoped_ptr.h" | |
20 #include "base/time/time.h" | 21 #include "base/time/time.h" |
21 #include "chrome/browser/spellchecker/spellcheck_action.h" | 22 #include "chrome/browser/spellchecker/spellcheck_action.h" |
22 | 23 |
23 // Stores user feedback to a spellcheck suggestion. Sample usage: | 24 // Stores user feedback to a spellcheck suggestion. Sample usage: |
24 // Misspelling misspelling. | 25 // Misspelling misspelling. |
25 // misspelling.context = base::ASCIIToUTF16("Helllo world"); | 26 // misspelling.context = base::ASCIIToUTF16("Helllo world"); |
26 // misspelling.location = 0; | 27 // misspelling.location = 0; |
27 // misspelling.length = 6; | 28 // misspelling.length = 6; |
28 // misspelling.suggestions = | 29 // misspelling.suggestions = |
29 // std::vector<base::string16>(1, base::ASCIIToUTF16("Hello")); | 30 // std::vector<base::string16>(1, base::ASCIIToUTF16("Hello")); |
(...skipping 26 matching lines...) Expand all Loading... | |
56 // The hash that identifies the misspelling. | 57 // The hash that identifies the misspelling. |
57 uint32_t hash; | 58 uint32_t hash; |
58 | 59 |
59 // User action. | 60 // User action. |
60 SpellcheckAction action; | 61 SpellcheckAction action; |
61 | 62 |
62 // The time when the user applied the action. | 63 // The time when the user applied the action. |
63 base::Time timestamp; | 64 base::Time timestamp; |
64 }; | 65 }; |
65 | 66 |
66 // Serializes the data in this object into a dictionary value. The caller owns | 67 // Serializes the data in this object into a dictionary value. The caller owns |
please use gerrit instead
2016/02/03 23:59:10
"The caller owns the result." is not necessary, as
Kevin Bailey
2016/02/04 16:34:11
Done.
| |
67 // the result. | 68 // the result. |
68 base::DictionaryValue* SerializeMisspelling(const Misspelling& misspelling); | 69 scoped_ptr<base::DictionaryValue> SerializeMisspelling( |
70 const Misspelling& misspelling); | |
69 | 71 |
70 // Returns the substring of |context| that begins at |location| and contains | 72 // Returns the substring of |context| that begins at |location| and contains |
71 // |length| characters. | 73 // |length| characters. |
72 base::string16 GetMisspelledString(const Misspelling& misspelling); | 74 base::string16 GetMisspelledString(const Misspelling& misspelling); |
73 | 75 |
74 // Returns the approximate size of the misspelling when serialized. | 76 // Returns the approximate size of the misspelling when serialized. |
75 size_t ApproximateSerializedSize(const Misspelling& misspelling); | 77 size_t ApproximateSerializedSize(const Misspelling& misspelling); |
76 | 78 |
77 #endif // CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_ | 79 #endif // CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_ |
OLD | NEW |