| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_SPELLCHECK_PROVIDER_H_ | 5 #ifndef COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_PROVIDER_H_ |
| 6 #define COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_PROVIDER_H_ | 6 #define COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "components/spellcheck/spellcheck_build_features.h" |
| 15 #include "content/public/renderer/render_view_observer.h" | 16 #include "content/public/renderer/render_view_observer.h" |
| 16 #include "content/public/renderer/render_view_observer_tracker.h" | 17 #include "content/public/renderer/render_view_observer_tracker.h" |
| 17 #include "third_party/WebKit/public/web/WebSpellCheckClient.h" | 18 #include "third_party/WebKit/public/web/WebSpellCheckClient.h" |
| 18 | 19 |
| 19 class RenderView; | 20 class RenderView; |
| 20 class SpellCheck; | 21 class SpellCheck; |
| 21 class SpellCheckMarker; | 22 class SpellCheckMarker; |
| 22 struct SpellCheckResult; | 23 struct SpellCheckResult; |
| 23 | 24 |
| 24 namespace blink { | 25 namespace blink { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const blink::WebVector<uint32_t>& markers, | 87 const blink::WebVector<uint32_t>& markers, |
| 87 const blink::WebVector<unsigned>& marker_offsets, | 88 const blink::WebVector<unsigned>& marker_offsets, |
| 88 blink::WebTextCheckingCompletion* completion) override; | 89 blink::WebTextCheckingCompletion* completion) override; |
| 89 | 90 |
| 90 void cancelAllPendingRequests() override; | 91 void cancelAllPendingRequests() override; |
| 91 void showSpellingUI(bool show) override; | 92 void showSpellingUI(bool show) override; |
| 92 bool isShowingSpellingUI() override; | 93 bool isShowingSpellingUI() override; |
| 93 void updateSpellingUIWithMisspelledWord( | 94 void updateSpellingUIWithMisspelledWord( |
| 94 const blink::WebString& word) override; | 95 const blink::WebString& word) override; |
| 95 | 96 |
| 96 #if !defined(USE_BROWSER_SPELLCHECKER) | 97 #if !BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
| 97 void OnRespondSpellingService( | 98 void OnRespondSpellingService( |
| 98 int identifier, | 99 int identifier, |
| 99 bool succeeded, | 100 bool succeeded, |
| 100 const base::string16& text, | 101 const base::string16& text, |
| 101 const std::vector<SpellCheckResult>& results); | 102 const std::vector<SpellCheckResult>& results); |
| 102 #endif | 103 #endif |
| 103 | 104 |
| 104 // Returns whether |text| has word characters, i.e. whether a spellchecker | 105 // Returns whether |text| has word characters, i.e. whether a spellchecker |
| 105 // needs to check this text. | 106 // needs to check this text. |
| 106 bool HasWordCharacters(const base::string16& text, int index) const; | 107 bool HasWordCharacters(const base::string16& text, int index) const; |
| 107 | 108 |
| 108 #if defined(USE_BROWSER_SPELLCHECKER) | 109 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) |
| 109 void OnAdvanceToNextMisspelling(); | 110 void OnAdvanceToNextMisspelling(); |
| 110 void OnRespondTextCheck( | 111 void OnRespondTextCheck( |
| 111 int identifier, | 112 int identifier, |
| 112 const base::string16& line, | 113 const base::string16& line, |
| 113 const std::vector<SpellCheckResult>& results); | 114 const std::vector<SpellCheckResult>& results); |
| 114 void OnToggleSpellPanel(bool is_currently_visible); | 115 void OnToggleSpellPanel(bool is_currently_visible); |
| 115 #endif | 116 #endif |
| 116 | 117 |
| 117 // Holds ongoing spellchecking operations, assigns IDs for the IPC routing. | 118 // Holds ongoing spellchecking operations, assigns IDs for the IPC routing. |
| 118 WebTextCheckCompletions text_check_completions_; | 119 WebTextCheckCompletions text_check_completions_; |
| 119 | 120 |
| 120 // The last text sent to the browser process to spellcheck it and its | 121 // The last text sent to the browser process to spellcheck it and its |
| 121 // spellchecking results. | 122 // spellchecking results. |
| 122 base::string16 last_request_; | 123 base::string16 last_request_; |
| 123 blink::WebVector<blink::WebTextCheckingResult> last_results_; | 124 blink::WebVector<blink::WebTextCheckingResult> last_results_; |
| 124 | 125 |
| 125 // True if the browser is showing the spelling panel for us. | 126 // True if the browser is showing the spelling panel for us. |
| 126 bool spelling_panel_visible_; | 127 bool spelling_panel_visible_; |
| 127 | 128 |
| 128 // Weak pointer to shared (per RenderView) spellcheck data. | 129 // Weak pointer to shared (per RenderView) spellcheck data. |
| 129 SpellCheck* spellcheck_; | 130 SpellCheck* spellcheck_; |
| 130 | 131 |
| 131 DISALLOW_COPY_AND_ASSIGN(SpellCheckProvider); | 132 DISALLOW_COPY_AND_ASSIGN(SpellCheckProvider); |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 #endif // COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_PROVIDER_H_ | 135 #endif // COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_PROVIDER_H_ |
| OLD | NEW |