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 #ifndef COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECK_ACTION_H_ | 5 #ifndef COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECK_ACTION_H_ |
6 #define COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECK_ACTION_H_ | 6 #define COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECK_ACTION_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
9 | 11 |
10 namespace base { | 12 namespace base { |
11 class DictionaryValue; | 13 class DictionaryValue; |
12 } | 14 } |
13 | 15 |
14 // User's action on a misspelled word. | 16 // User's action on a misspelled word. |
15 class SpellcheckAction { | 17 class SpellcheckAction { |
16 public: | 18 public: |
17 // Type of spellcheck action. | 19 // Type of spellcheck action. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 53 |
52 // Returns true if the action is final and should be sent to the feedback | 54 // Returns true if the action is final and should be sent to the feedback |
53 // server. Otherwise returns false. | 55 // server. Otherwise returns false. |
54 bool IsFinal() const; | 56 bool IsFinal() const; |
55 | 57 |
56 // Makes this action final and ready to be sent to the feedback server. The | 58 // 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 | 59 // method is idempotent. Finalizing an action that is already final does |
58 // nothing. | 60 // nothing. |
59 void Finalize(); | 61 void Finalize(); |
60 | 62 |
61 // Serializes the data in this object into a dictionary value. The caller owns | 63 // Serializes the data in this object into a dictionary value. |
62 // the result. | 64 std::unique_ptr<base::DictionaryValue> Serialize() const; |
63 base::DictionaryValue* Serialize() const; | |
64 | 65 |
65 void set_type(SpellcheckActionType type) { type_ = type; } | 66 void set_type(SpellcheckActionType type) { type_ = type; } |
66 void set_index(int index) { index_ = index; } | 67 void set_index(int index) { index_ = index; } |
67 void set_value(const base::string16& value) { value_ = value; } | 68 void set_value(const base::string16& value) { value_ = value; } |
68 | 69 |
69 SpellcheckActionType type() const { return type_; } | 70 SpellcheckActionType type() const { return type_; } |
70 | 71 |
71 private: | 72 private: |
72 // User action. | 73 // User action. |
73 SpellcheckActionType type_; | 74 SpellcheckActionType type_; |
74 | 75 |
75 // The index for the user action, if applicable. | 76 // The index for the user action, if applicable. |
76 int index_; | 77 int index_; |
77 | 78 |
78 // The value for the user action, if applicable. | 79 // The value for the user action, if applicable. |
79 base::string16 value_; | 80 base::string16 value_; |
80 }; | 81 }; |
81 | 82 |
82 #endif // COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECK_ACTION_H_ | 83 #endif // COMPONENTS_SPELLCHECK_BROWSER_SPELLCHECK_ACTION_H_ |
OLD | NEW |