AlternativeTextUIController.h [plain text]
#ifndef AlternativeTextUIController_h
#define AlternativeTextUIController_h
#include "AlternativeTextClient.h"
#include "FloatRect.h"
#include <wtf/HashMap.h>
#include <wtf/RetainPtr.h>
#if USE(DICTATION_ALTERNATIVES)
OBJC_CLASS NSTextAlternatives;
OBJC_CLASS NSView;
namespace WebCore {
class AlternativeTextUIController {
public:
AlternativeTextUIController() { }
WEBCORE_EXPORT uint64_t addAlternatives(const RetainPtr<NSTextAlternatives>&);
WEBCORE_EXPORT void clear();
WEBCORE_EXPORT void showAlternatives(NSView*, const FloatRect& boundingBoxOfPrimaryString, uint64_t context, void(^acceptanceHandler)(NSString*));
void WEBCORE_EXPORT removeAlternatives(uint64_t context);
WEBCORE_EXPORT Vector<String> alternativesForContext(uint64_t context);
private:
void handleAcceptedAlternative(NSString* acceptedAlternative, uint64_t context, NSTextAlternatives*);
void dismissAlternatives();
class AlernativeTextContextController {
public:
AlernativeTextContextController() { }
uint64_t addAlternatives(const RetainPtr<NSTextAlternatives>&);
void clear();
NSTextAlternatives* alternativesForContext(uint64_t context);
void removeAlternativesForContext(uint64_t context);
static const uint64_t invalidContext = 0;
private:
typedef HashMap<uint64_t, RetainPtr<NSTextAlternatives>> HashMapType;
HashMapType m_alternativesObjectMap;
};
AlernativeTextContextController m_contextController;
RetainPtr<NSView> m_view;
};
}
#endif
#endif // AlternativeTextUIController_h