WebTextChecker.cpp [plain text]
#include "config.h"
#include "WebTextChecker.h"
#include "TextChecker.h"
#include "WKAPICast.h"
#include "WebPageProxy.h"
#include "WebProcessPool.h"
#include <wtf/RefPtr.h>
namespace WebKit {
WebTextChecker* WebTextChecker::singleton()
{
static WebTextChecker* textChecker = adoptRef(new WebTextChecker).leakRef();
return textChecker;
}
WebTextChecker::WebTextChecker()
{
}
void WebTextChecker::setClient(const WKTextCheckerClientBase* client)
{
m_client.initialize(client);
}
static void updateStateForAllContexts()
{
const Vector<WebProcessPool*>& contexts = WebProcessPool::allProcessPools();
for (size_t i = 0; i < contexts.size(); ++i)
contexts[i]->textCheckerStateChanged();
}
void WebTextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
{
TextChecker::continuousSpellCheckingEnabledStateChanged(enabled);
updateStateForAllContexts();
}
void WebTextChecker::grammarCheckingEnabledStateChanged(bool enabled)
{
TextChecker::grammarCheckingEnabledStateChanged(enabled);
updateStateForAllContexts();
}
void WebTextChecker::checkSpelling(WebPageProxy* page, bool startBeforeSelection)
{
page->advanceToNextMisspelling(startBeforeSelection);
}
void WebTextChecker::changeSpellingToWord(WebPageProxy* page, const String& text)
{
page->changeSpellingToWord(text);
}
}