Chromium Code Reviews| Index: chrome/renderer/spellchecker/spellcheck_provider.h |
| diff --git a/chrome/renderer/spellchecker/spellcheck_provider.h b/chrome/renderer/spellchecker/spellcheck_provider.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e7463a78f690d97c2a99d11323ab795c44a5120e |
| --- /dev/null |
| +++ b/chrome/renderer/spellchecker/spellcheck_provider.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_H_ |
| +#define CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_H_ |
| +#pragma once |
| + |
| +#include <vector> |
| + |
| +#include "base/id_map.h" |
| +#include "chrome/renderer/render_view_observer.h" |
| + |
| +class RenderView; |
| +class SpellCheck; |
| + |
| +namespace WebKit { |
| +class WebString; |
| +class WebTextCheckingResult; |
| +class WebTextCheckingCompletion; |
| +} |
| + |
| +// This class deals with invoking browser-side spellcheck mechanism |
| +// which is done asynchronously. |
| +class SpellCheckProvider : public RenderViewObserver { |
|
Hironori Bono
2011/02/18 11:09:27
I'm a little wondering if this name describes the
|
| + public: |
| + typedef IDMap<WebKit::WebTextCheckingCompletion> WebTextCheckCompletions; |
| + |
| + SpellCheckProvider(RenderView* render_view, SpellCheck* spellcheck); |
| + virtual ~SpellCheckProvider(); |
| + |
| + void RequestTextChecking( |
| + const WebKit::WebString& text, |
| + int document_tag, |
| + WebKit::WebTextCheckingCompletion* completion); |
| + |
| + void OnSpellCheckerRespondTextCheck( |
| + int identifier, |
| + int tag, |
| + const std::vector<WebKit::WebTextCheckingResult>& results); |
| + |
| + // Check the availability of the platform spellchecker. |
| + // Makes this virtual for overriding on the unittest. |
| + virtual bool is_using_platform_spelling_engine() const; |
| + |
| + size_t pending_text_request_size() const { |
| + return text_check_completions_.size(); |
| + } |
| + |
| + // RenderViewObserver implementation. |
| + virtual bool OnMessageReceived(const IPC::Message& message); |
| + |
| + private: |
| + // Holds ongoing spellchecking operations, assigns IDs for the IPC routing. |
| + WebTextCheckCompletions text_check_completions_; |
| + // Spellcheck implementation for use. Weak reference. |
| + SpellCheck* spellcheck_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SpellCheckProvider); |
| +}; |
| + |
| +#endif // CHROME_RENDERER_SPELLCHECKER_SPELLCHECK_PROVIDER_H_ |