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 #include "components/spellcheck/browser/spellcheck_action.h" | 5 #include "components/spellcheck/browser/spellcheck_action.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 | 9 |
10 SpellcheckAction::SpellcheckAction() : type_(TYPE_PENDING), index_(-1) {} | 10 SpellcheckAction::SpellcheckAction() : type_(TYPE_PENDING), index_(-1) {} |
(...skipping 21 matching lines...) Expand all Loading... |
32 break; | 32 break; |
33 case TYPE_PENDING_IGNORE: | 33 case TYPE_PENDING_IGNORE: |
34 type_ = TYPE_IGNORE; | 34 type_ = TYPE_IGNORE; |
35 break; | 35 break; |
36 default: | 36 default: |
37 DCHECK(IsFinal()); | 37 DCHECK(IsFinal()); |
38 break; | 38 break; |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 base::DictionaryValue* SpellcheckAction::Serialize() const { | 42 std::unique_ptr<base::DictionaryValue> SpellcheckAction::Serialize() const { |
43 base::DictionaryValue* result = new base::DictionaryValue; | 43 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue); |
44 switch (type_) { | 44 switch (type_) { |
45 case TYPE_SELECT: | 45 case TYPE_SELECT: |
46 result->SetString("actionType", "SELECT"); | 46 result->SetString("actionType", "SELECT"); |
47 result->SetInteger("actionTargetIndex", index_); | 47 result->SetInteger("actionTargetIndex", index_); |
48 break; | 48 break; |
49 case TYPE_ADD_TO_DICT: | 49 case TYPE_ADD_TO_DICT: |
50 result->SetString("actionType", "ADD_TO_DICT"); | 50 result->SetString("actionType", "ADD_TO_DICT"); |
51 break; | 51 break; |
52 case TYPE_IGNORE: | 52 case TYPE_IGNORE: |
53 result->SetString("actionType", "IGNORE"); | 53 result->SetString("actionType", "IGNORE"); |
(...skipping 11 matching lines...) Expand all Loading... |
65 case TYPE_PENDING: | 65 case TYPE_PENDING: |
66 case TYPE_PENDING_IGNORE: | 66 case TYPE_PENDING_IGNORE: |
67 result->SetString("actionType", "PENDING"); | 67 result->SetString("actionType", "PENDING"); |
68 break; | 68 break; |
69 default: | 69 default: |
70 NOTREACHED(); | 70 NOTREACHED(); |
71 break; | 71 break; |
72 } | 72 } |
73 return result; | 73 return result; |
74 } | 74 } |
OLD | NEW |