OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_MENU_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_MENU_OBSERVER_H_ |
6 #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_MENU_OBSERVER_H_ | 6 #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_MENU_OBSERVER_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <vector> | 11 #include <vector> |
9 | 12 |
10 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
12 #include "base/prefs/pref_member.h" | 16 #include "base/prefs/pref_member.h" |
13 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
14 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
15 #include "chrome/browser/spellchecker/spelling_service_client.h" | 19 #include "chrome/browser/spellchecker/spelling_service_client.h" |
16 #include "components/renderer_context_menu/render_view_context_menu_observer.h" | 20 #include "components/renderer_context_menu/render_view_context_menu_observer.h" |
17 | 21 |
18 class RenderViewContextMenuProxy; | 22 class RenderViewContextMenuProxy; |
19 struct SpellCheckResult; | 23 struct SpellCheckResult; |
20 | 24 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // ones provided by the local spellchecker. When this flag is true, we enable | 87 // ones provided by the local spellchecker. When this flag is true, we enable |
84 // the context-menu item so users can choose it. | 88 // the context-menu item so users can choose it. |
85 bool succeeded_; | 89 bool succeeded_; |
86 | 90 |
87 // The misspelled word. When we choose the "Add to dictionary" item, we add | 91 // The misspelled word. When we choose the "Add to dictionary" item, we add |
88 // this word to the custom-word dictionary. | 92 // this word to the custom-word dictionary. |
89 base::string16 misspelled_word_; | 93 base::string16 misspelled_word_; |
90 | 94 |
91 // The hash identifier for the misspelled word. Used for collecting user | 95 // The hash identifier for the misspelled word. Used for collecting user |
92 // feedback to spellcheck suggestions. | 96 // feedback to spellcheck suggestions. |
93 uint32 misspelling_hash_; | 97 uint32_t misspelling_hash_; |
94 | 98 |
95 // The string representing the result of this call. This string is a | 99 // The string representing the result of this call. This string is a |
96 // suggestion when this call finished successfully. Otherwise it is error | 100 // suggestion when this call finished successfully. Otherwise it is error |
97 // text. Until we receive a response from the Spelling service, this string | 101 // text. Until we receive a response from the Spelling service, this string |
98 // stores the input string. (Since the Spelling service sends only misspelled | 102 // stores the input string. (Since the Spelling service sends only misspelled |
99 // words, we replace these misspelled words in the input text with the | 103 // words, we replace these misspelled words in the input text with the |
100 // suggested words to create suggestion text. | 104 // suggested words to create suggestion text. |
101 base::string16 result_; | 105 base::string16 result_; |
102 | 106 |
103 // The URLFetcher object used for sending a JSON-RPC request. | 107 // The URLFetcher object used for sending a JSON-RPC request. |
104 scoped_ptr<SpellingServiceClient> client_; | 108 scoped_ptr<SpellingServiceClient> client_; |
105 | 109 |
106 // A timer used for loading animation. | 110 // A timer used for loading animation. |
107 base::RepeatingTimer animation_timer_; | 111 base::RepeatingTimer animation_timer_; |
108 | 112 |
109 // Flag indicating whether online spelling correction service is enabled. When | 113 // Flag indicating whether online spelling correction service is enabled. When |
110 // this variable is true and we right-click a misspelled word, we send a | 114 // this variable is true and we right-click a misspelled word, we send a |
111 // JSON-RPC request to the service and retrieve suggestions. | 115 // JSON-RPC request to the service and retrieve suggestions. |
112 BooleanPrefMember integrate_spelling_service_; | 116 BooleanPrefMember integrate_spelling_service_; |
113 | 117 |
114 // Flag indicating whether automatic spelling correction is enabled. | 118 // Flag indicating whether automatic spelling correction is enabled. |
115 BooleanPrefMember autocorrect_spelling_; | 119 BooleanPrefMember autocorrect_spelling_; |
116 | 120 |
117 DISALLOW_COPY_AND_ASSIGN(SpellingMenuObserver); | 121 DISALLOW_COPY_AND_ASSIGN(SpellingMenuObserver); |
118 }; | 122 }; |
119 | 123 |
120 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_MENU_OBSERVER_H_ | 124 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_MENU_OBSERVER_H_ |
OLD | NEW |