#ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PAGE_FORM_ANALYSER_LOGGER_H_
#define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PAGE_FORM_ANALYSER_LOGGER_H_
#include <string>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "third_party/blink/public/web/web_console_message.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_node.h"
namespace autofill {
using ConsoleLevel = blink::mojom::ConsoleMessageLevel;
class PageFormAnalyserLogger {
public:
static const ConsoleLevel kError = blink::mojom::ConsoleMessageLevel::kError;
static const ConsoleLevel kWarning =
blink::mojom::ConsoleMessageLevel::kWarning;
static const ConsoleLevel kVerbose =
blink::mojom::ConsoleMessageLevel::kVerbose;
explicit PageFormAnalyserLogger(blink::WebLocalFrame* frame);
~PageFormAnalyserLogger();
virtual void Send(std::string message,
ConsoleLevel level,
blink::WebNode node);
virtual void Send(std::string message,
ConsoleLevel level,
std::vector<blink::WebNode> nodes);
virtual void Flush();
private:
raw_ptr<blink::WebLocalFrame> frame_;
struct LogEntry;
std::map<ConsoleLevel, std::vector<LogEntry>> node_buffer_;
};
}
#endif