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 "chrome/browser/spellchecker/spellcheck_action.h" | 5 #include "chrome/browser/spellchecker/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) {} |
11 | 11 |
12 SpellcheckAction::SpellcheckAction(SpellcheckActionType type, | 12 SpellcheckAction::SpellcheckAction(SpellcheckActionType type, |
13 int index, | 13 int index, |
14 string16 value) | 14 string16 value) |
15 : type(type), index(index), value(value) {} | 15 : type(type), index(index), value(value) {} |
16 | 16 |
17 SpellcheckAction::~SpellcheckAction() {} | 17 SpellcheckAction::~SpellcheckAction() {} |
18 | 18 |
19 bool SpellcheckAction::IsFinal() const { | 19 bool SpellcheckAction::IsFinal() const { |
20 return type == TYPE_ADD_TO_DICT || | 20 return type == TYPE_ADD_TO_DICT || |
21 type == TYPE_IGNORE || | 21 type == TYPE_IGNORE || |
| 22 type == TYPE_IN_DICTIONARY || |
22 type == TYPE_MANUALLY_CORRECTED || | 23 type == TYPE_MANUALLY_CORRECTED || |
23 type == TYPE_NO_ACTION || | 24 type == TYPE_NO_ACTION || |
24 type == TYPE_SELECT; | 25 type == TYPE_SELECT; |
25 } | 26 } |
26 | 27 |
27 void SpellcheckAction::Finalize() { | 28 void SpellcheckAction::Finalize() { |
28 switch (type) { | 29 switch (type) { |
29 case TYPE_PENDING: | 30 case TYPE_PENDING: |
30 type = TYPE_NO_ACTION; | 31 type = TYPE_NO_ACTION; |
31 break; | 32 break; |
(...skipping 12 matching lines...) Expand all Loading... |
44 case TYPE_SELECT: | 45 case TYPE_SELECT: |
45 result->SetString("actionType", "SELECT"); | 46 result->SetString("actionType", "SELECT"); |
46 result->SetInteger("actionTargetIndex", index); | 47 result->SetInteger("actionTargetIndex", index); |
47 break; | 48 break; |
48 case TYPE_ADD_TO_DICT: | 49 case TYPE_ADD_TO_DICT: |
49 result->SetString("actionType", "ADD_TO_DICT"); | 50 result->SetString("actionType", "ADD_TO_DICT"); |
50 break; | 51 break; |
51 case TYPE_IGNORE: | 52 case TYPE_IGNORE: |
52 result->SetString("actionType", "IGNORE"); | 53 result->SetString("actionType", "IGNORE"); |
53 break; | 54 break; |
| 55 case TYPE_IN_DICTIONARY: |
| 56 result->SetString("actionType", "IN_DICTIONARY"); |
| 57 break; |
54 case TYPE_NO_ACTION: | 58 case TYPE_NO_ACTION: |
55 result->SetString("actionType", "NO_ACTION"); | 59 result->SetString("actionType", "NO_ACTION"); |
56 break; | 60 break; |
57 case TYPE_MANUALLY_CORRECTED: | 61 case TYPE_MANUALLY_CORRECTED: |
58 result->SetString("actionType", "MANUALLY_CORRECTED"); | 62 result->SetString("actionType", "MANUALLY_CORRECTED"); |
59 result->SetString("actionTargetValue", value); | 63 result->SetString("actionTargetValue", value); |
60 break; | 64 break; |
61 case TYPE_PENDING: | 65 case TYPE_PENDING: |
62 case TYPE_PENDING_IGNORE: | 66 case TYPE_PENDING_IGNORE: |
63 result->SetString("actionType", "PENDING"); | 67 result->SetString("actionType", "PENDING"); |
64 break; | 68 break; |
65 default: | 69 default: |
66 NOTREACHED(); | 70 NOTREACHED(); |
67 break; | 71 break; |
68 } | 72 } |
69 return result; | 73 return result; |
70 } | 74 } |
OLD | NEW |