WebTextChecker.cpp [plain text]
#include "config.h"
#include "WebTextChecker.h"
#include "TextChecker.h"
#include "WKAPICast.h"
#include "WebContext.h"
#include <wtf/RefPtr.h>
namespace WebKit {
WebTextChecker* WebTextChecker::shared()
{
static WebTextChecker* textChecker = adoptRef(new WebTextChecker).leakRef();
return textChecker;
}
WebTextChecker::WebTextChecker()
{
}
void WebTextChecker::setClient(const WKTextCheckerClient* client)
{
m_client.initialize(client);
}
static void updateStateForAllWebProcesses()
{
const Vector<WebContext*>& contexts = WebContext::allContexts();
for (size_t i = 0; i < contexts.size(); ++i) {
WebProcessProxy* webProcess = contexts[i]->process();
if (!webProcess)
continue;
webProcess->updateTextCheckerState();
}
}
void WebTextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
{
TextChecker::continuousSpellCheckingEnabledStateChanged(enabled);
updateStateForAllWebProcesses();
}
void WebTextChecker::grammarCheckingEnabledStateChanged(bool enabled)
{
TextChecker::grammarCheckingEnabledStateChanged(enabled);
updateStateForAllWebProcesses();
}
void WebTextChecker::checkSpelling(const WebPageProxy* page, bool startBeforeSelection)
{
page->advanceToNextMisspelling(startBeforeSelection);
}
void WebTextChecker::changeSpellingToWord(const WebPageProxy* page, const String& text)
{
page->changeSpellingToWord(text);
}
}