OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_PANEL_H | 5 #ifndef COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_PANEL_H |
6 #define COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_PANEL_H | 6 #define COMPONENTS_SPELLCHECK_RENDERER_SPELLCHECK_PANEL_H |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/spellcheck/spellcheck_build_features.h" | 9 #include "components/spellcheck/spellcheck_build_features.h" |
10 #include "content/public/renderer/render_view_observer.h" | 10 #include "content/public/renderer/render_view_observer.h" |
11 #include "content/public/renderer/render_view_observer_tracker.h" | 11 #include "content/public/renderer/render_view_observer_tracker.h" |
12 #include "third_party/WebKit/public/web/WebSpellCheckClient.h" | 12 #include "third_party/WebKit/public/web/WebSpellCheckClient.h" |
13 | 13 |
14 // TODO(xiaochengh): Only Mac has spelling panel. Remove the #if checks in this | 14 #if !BUILDFLAG(HAS_SPELLCHECK_PANEL) |
15 // class, which seem unnecessary, and make sure that this class is compiled and | 15 #error "This file shouldn't be compiled without spellcheck panel." |
16 // used only on Mac. | 16 #endif |
| 17 |
17 class SpellCheckPanel | 18 class SpellCheckPanel |
18 : public content::RenderViewObserver, | 19 : public content::RenderViewObserver, |
19 public content::RenderViewObserverTracker<SpellCheckPanel>, | 20 public content::RenderViewObserverTracker<SpellCheckPanel>, |
20 public blink::WebSpellCheckClient { | 21 public blink::WebSpellCheckClient { |
21 public: | 22 public: |
22 explicit SpellCheckPanel(content::RenderView* render_view); | 23 explicit SpellCheckPanel(content::RenderView* render_view); |
23 ~SpellCheckPanel() override; | 24 ~SpellCheckPanel() override; |
24 | 25 |
25 // RenderViewObserver implementation. | 26 // RenderViewObserver implementation. |
26 bool OnMessageReceived(const IPC::Message& message) override; | 27 bool OnMessageReceived(const IPC::Message& message) override; |
27 | 28 |
28 private: | 29 private: |
29 // RenderViewObserver implementation. | 30 // RenderViewObserver implementation. |
30 void OnDestruct() override; | 31 void OnDestruct() override; |
31 | 32 |
32 // blink::WebSpellCheckClient implementation. | 33 // blink::WebSpellCheckClient implementation. |
33 void ShowSpellingUI(bool show) override; | 34 void ShowSpellingUI(bool show) override; |
34 bool IsShowingSpellingUI() override; | 35 bool IsShowingSpellingUI() override; |
35 void UpdateSpellingUIWithMisspelledWord( | 36 void UpdateSpellingUIWithMisspelledWord( |
36 const blink::WebString& word) override; | 37 const blink::WebString& word) override; |
37 | 38 |
38 #if BUILDFLAG(USE_BROWSER_SPELLCHECKER) | |
39 void OnAdvanceToNextMisspelling(); | 39 void OnAdvanceToNextMisspelling(); |
40 void OnToggleSpellPanel(bool is_currently_visible); | 40 void OnToggleSpellPanel(bool is_currently_visible); |
41 #endif | |
42 | 41 |
43 // True if the browser is showing the spelling panel for us. | 42 // True if the browser is showing the spelling panel for us. |
44 bool spelling_panel_visible_; | 43 bool spelling_panel_visible_; |
45 | 44 |
46 DISALLOW_COPY_AND_ASSIGN(SpellCheckPanel); | 45 DISALLOW_COPY_AND_ASSIGN(SpellCheckPanel); |
47 }; | 46 }; |
48 | 47 |
49 #endif | 48 #endif |
OLD | NEW |