AlternativeTextClient.h [plain text]
#ifndef AlternativeTextClient_h
#define AlternativeTextClient_h
#include "FloatRect.h"
#include "TextChecking.h"
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
#if PLATFORM(MAC)
#define USE_DICTATION_ALTERNATIVES 1
#endif // PLATFORM(MAC)
namespace WebCore {
enum ReasonForDismissingAlternativeText {
ReasonForDismissingAlternativeTextCancelled = 0,
ReasonForDismissingAlternativeTextIgnored,
ReasonForDismissingAlternativeTextAccepted
};
enum AlternativeTextType {
AlternativeTextTypeCorrection = 0,
AlternativeTextTypeReversion,
AlternativeTextTypeSpellingSuggestions,
AlternativeTextTypeDictationAlternatives
};
enum AutocorrectionResponseType {
AutocorrectionEdited,
AutocorrectionReverted
};
class AlternativeTextClient {
public:
virtual ~AlternativeTextClient() { }
virtual void pageDestroyed() = 0;
#if USE(AUTOCORRECTION_PANEL)
virtual void showCorrectionAlternative(AlternativeTextType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacmentString, const Vector<String>& alternativeReplacementStrings) = 0;
virtual void dismissAlternative(ReasonForDismissingAlternativeText) = 0;
virtual String dismissAlternativeSoon(ReasonForDismissingAlternativeText) = 0;
virtual void recordAutocorrectionResponse(AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0;
#endif
#if USE(DICTATION_ALTERNATIVES)
virtual void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) = 0;
virtual void removeDictationAlternatives(uint64_t dictationContext) = 0;
virtual Vector<String> dictationAlternatives(uint64_t dictationContext) = 0;
#endif
};
}
#endif // AlternativeTextClient_h