#include "components/page_image_annotation/content/renderer/content_page_annotator_driver.h"
#include <optional>
#include "base/base64.h"
#include "base/functional/bind.h"
#include "base/task/single_thread_task_runner.h"
#include "content/public/renderer/render_frame.h"
#include "crypto/sha2.h"
#include "services/image_annotation/public/mojom/image_annotation.mojom.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_node.h"
namespace page_image_annotation {
namespace {
ia_mojom;
constexpr int kDomCrawlDelayMs = …;
std::optional<PageAnnotator::ImageMetadata> ProduceMetadata(
const GURL& page_url,
const blink::WebElement element,
const uint64_t node_id) { … }
mojo::PendingRemote<ia_mojom::Annotator> RequestAnnotator(
content::RenderFrame* const render_frame) { … }
}
ContentPageAnnotatorDriver::ContentPageAnnotatorDriver(
content::RenderFrame* const render_frame)
: … { … }
ContentPageAnnotatorDriver::~ContentPageAnnotatorDriver() { … }
ContentPageAnnotatorDriver* ContentPageAnnotatorDriver::GetOrCreate(
content::RenderFrame* const render_frame) { … }
PageAnnotator& ContentPageAnnotatorDriver::GetPageAnnotator() { … }
blink::WebElement ContentPageAnnotatorDriver::GetElement(
const uint64_t node_id) { … }
std::string ContentPageAnnotatorDriver::GenerateSourceId(
const GURL& page_url,
const std::string& uri_fragment) { … }
void ContentPageAnnotatorDriver::DidDispatchDOMContentLoadedEvent() { … }
void ContentPageAnnotatorDriver::OnDestruct() { … }
void ContentPageAnnotatorDriver::FindImages(const GURL& page_url,
blink::WebElement element) { … }
void ContentPageAnnotatorDriver::FindAndTrackImages() { … }
SkBitmap ContentPageAnnotatorDriver::GetBitmapForId(const uint64_t node_id) { … }
}