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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // A callback function called when the Spelling service finishes checking a | 53 // A callback function called when the Spelling service finishes checking a |
54 // misspelled word. | 54 // misspelled word. |
55 void OnTextCheckComplete( | 55 void OnTextCheckComplete( |
56 SpellingServiceClient::ServiceType type, | 56 SpellingServiceClient::ServiceType type, |
57 bool success, | 57 bool success, |
58 const base::string16& text, | 58 const base::string16& text, |
59 const std::vector<SpellCheckResult>& results); | 59 const std::vector<SpellCheckResult>& results); |
60 | 60 |
61 private: | 61 private: |
62 // The callback function for base::RepeatingTimer<SpellingMenuClient>. This | 62 // The callback function for base::RepeatingTimer. This function updates the |
63 // function updates the "loading..." animation in the context-menu item. | 63 // "loading..." animation in the context-menu item. |
64 void OnAnimationTimerExpired(); | 64 void OnAnimationTimerExpired(); |
65 | 65 |
66 // The interface to add a context-menu item and update it. This class uses | 66 // The interface to add a context-menu item and update it. This class uses |
67 // this interface to avoid accesing context-menu items directly. | 67 // this interface to avoid accesing context-menu items directly. |
68 RenderViewContextMenuProxy* proxy_; | 68 RenderViewContextMenuProxy* proxy_; |
69 | 69 |
70 // Suggested words from the local spellchecker. If the spelling service | 70 // Suggested words from the local spellchecker. If the spelling service |
71 // returns a word in this list, we hide the context-menu item to prevent | 71 // returns a word in this list, we hide the context-menu item to prevent |
72 // showing the same word twice. | 72 // showing the same word twice. |
73 std::vector<base::string16> suggestions_; | 73 std::vector<base::string16> suggestions_; |
(...skipping 23 matching lines...) Expand all Loading... |
97 // text. Until we receive a response from the Spelling service, this string | 97 // text. Until we receive a response from the Spelling service, this string |
98 // stores the input string. (Since the Spelling service sends only misspelled | 98 // stores the input string. (Since the Spelling service sends only misspelled |
99 // words, we replace these misspelled words in the input text with the | 99 // words, we replace these misspelled words in the input text with the |
100 // suggested words to create suggestion text. | 100 // suggested words to create suggestion text. |
101 base::string16 result_; | 101 base::string16 result_; |
102 | 102 |
103 // The URLFetcher object used for sending a JSON-RPC request. | 103 // The URLFetcher object used for sending a JSON-RPC request. |
104 scoped_ptr<SpellingServiceClient> client_; | 104 scoped_ptr<SpellingServiceClient> client_; |
105 | 105 |
106 // A timer used for loading animation. | 106 // A timer used for loading animation. |
107 base::RepeatingTimer<SpellingMenuObserver> animation_timer_; | 107 base::RepeatingTimer animation_timer_; |
108 | 108 |
109 // Flag indicating whether online spelling correction service is enabled. When | 109 // 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 | 110 // this variable is true and we right-click a misspelled word, we send a |
111 // JSON-RPC request to the service and retrieve suggestions. | 111 // JSON-RPC request to the service and retrieve suggestions. |
112 BooleanPrefMember integrate_spelling_service_; | 112 BooleanPrefMember integrate_spelling_service_; |
113 | 113 |
114 // Flag indicating whether automatic spelling correction is enabled. | 114 // Flag indicating whether automatic spelling correction is enabled. |
115 BooleanPrefMember autocorrect_spelling_; | 115 BooleanPrefMember autocorrect_spelling_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(SpellingMenuObserver); | 117 DISALLOW_COPY_AND_ASSIGN(SpellingMenuObserver); |
118 }; | 118 }; |
119 | 119 |
120 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_MENU_OBSERVER_H_ | 120 #endif // CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_MENU_OBSERVER_H_ |
OLD | NEW |