chromium/components/optimization_guide/content/renderer/page_text_agent.h

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_OPTIMIZATION_GUIDE_CONTENT_RENDERER_PAGE_TEXT_AGENT_H_
#define COMPONENTS_OPTIMIZATION_GUIDE_CONTENT_RENDERER_PAGE_TEXT_AGENT_H_

#include <stdint.h>

#include <map>
#include <optional>
#include <string>
#include <utility>

#include "base/functional/callback.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "components/optimization_guide/content/mojom/page_text_service.mojom.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_frame_observer_tracker.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "third_party/blink/public/web/web_meaningful_layout.h"

namespace content {
class RenderFrame;
}  // namespace content

namespace optimization_guide {

// PageTextAgent is the interface between ChromeRenderFrameObserver and
// mojom::PageTextService. It currently supports requesting and getting text
// dumps during |content::RenderFrameObserver::DidMeaningfulLayout|, and
// |DidFinishLoad| for subframes.
class PageTextAgent
    : public mojom::PageTextService,
      public content::RenderFrameObserver,
      public content::RenderFrameObserverTracker<PageTextAgent> {};

}  // namespace optimization_guide

#endif  // COMPONENTS_OPTIMIZATION_GUIDE_CONTENT_RENDERER_PAGE_TEXT_AGENT_H_