Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_H_ | |
| 6 #define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/id_map.h" | |
| 12 #include "chrome/renderer/render_view_observer.h" | |
| 13 | |
| 14 class RenderView; | |
| 15 class SpellCheck; | |
| 16 | |
| 17 namespace WebKit { | |
| 18 class WebString; | |
| 19 class WebTextCheckingResult; | |
| 20 class WebTextCheckingCompletion; | |
| 21 } | |
| 22 | |
| 23 // This class deals with invoking browser-side spellcheck mechanism | |
| 24 // which is done asynchronously. | |
| 25 class SpellCheckProvider : public RenderViewObserver { | |
|
Hironori Bono
2011/02/18 11:09:27
I'm a little wondering if this name describes the
| |
| 26 public: | |
| 27 typedef IDMap<WebKit::WebTextCheckingCompletion> WebTextCheckCompletions; | |
| 28 | |
| 29 SpellCheckProvider(RenderView* render_view, SpellCheck* spellcheck); | |
| 30 virtual ~SpellCheckProvider(); | |
| 31 | |
| 32 void RequestTextChecking( | |
| 33 const WebKit::WebString& text, | |
| 34 int document_tag, | |
| 35 WebKit::WebTextCheckingCompletion* completion); | |
| 36 | |
| 37 void OnSpellCheckerRespondTextCheck( | |
| 38 int identifier, | |
| 39 int tag, | |
| 40 const std::vector<WebKit::WebTextCheckingResult>& results); | |
| 41 | |
| 42 // Check the availability of the platform spellchecker. | |
| 43 // Makes this virtual for overriding on the unittest. | |
| 44 virtual bool is_using_platform_spelling_engine() const; | |
| 45 | |
| 46 size_t pending_text_request_size() const { | |
| 47 return text_check_completions_.size(); | |
| 48 } | |
| 49 | |
| 50 // RenderViewObserver implementation. | |
| 51 virtual bool OnMessageReceived(const IPC::Message& message); | |
| 52 | |
| 53 private: | |
| 54 // Holds ongoing spellchecking operations, assigns IDs for the IPC routing. | |
| 55 WebTextCheckCompletions text_check_completions_; | |
| 56 // Spellcheck implementation for use. Weak reference. | |
| 57 SpellCheck* spellcheck_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(SpellCheckProvider); | |
| 60 }; | |
| 61 | |
| 62 #endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_H_ | |
| OLD | NEW |