#ifndef IOS_WEB_ANNOTATIONS_ANNOTATIONS_JAVA_SCRIPT_FEATURE_H_
#define IOS_WEB_ANNOTATIONS_ANNOTATIONS_JAVA_SCRIPT_FEATURE_H_
#import <optional>
#import <string>
#import "base/no_destructor.h"
#import "base/values.h"
#import "ios/web/public/js_messaging/java_script_feature.h"
namespace web {
* Handles JS communication for the annotations feature.
*/
class AnnotationsJavaScriptFeature : public JavaScriptFeature {
public:
static AnnotationsJavaScriptFeature* GetInstance();
virtual void ExtractText(WebState* web_state,
int maximum_text_length,
int seq_id);
virtual void DecorateAnnotations(WebState* web_state,
base::Value& annotations,
int seq_id);
virtual void RemoveDecorations(WebState* web_state);
virtual void RemoveDecorationsWithType(WebState* web_state,
const std::string& type);
virtual void RemoveHighlight(WebState* web_state);
protected:
void ScriptMessageReceived(WebState* web_state,
const ScriptMessage& script_message) override;
std::optional<std::string> GetScriptMessageHandlerName() const override;
AnnotationsJavaScriptFeature();
~AnnotationsJavaScriptFeature() override;
private:
friend class base::NoDestructor<AnnotationsJavaScriptFeature>;
AnnotationsJavaScriptFeature(const AnnotationsJavaScriptFeature&) = delete;
AnnotationsJavaScriptFeature& operator=(const AnnotationsJavaScriptFeature&) =
delete;
};
}
#endif