#ifndef COMPONENTS_COMMERCE_CONTENT_BROWSER_WEB_CONTENTS_WRAPPER_H_
#define COMPONENTS_COMMERCE_CONTENT_BROWSER_WEB_CONTENTS_WRAPPER_H_
#include <string>
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "components/commerce/core/web_wrapper.h"
#include "content/public/browser/web_contents.h"
class GURL;
namespace base {
class Value;
}
namespace content {
class RenderFrameHost;
}
namespace commerce {
class WebContentsWrapper : public WebWrapper {
public:
explicit WebContentsWrapper(content::WebContents* web_contents,
int32_t js_world_id);
WebContentsWrapper(const WebContentsWrapper&) = delete;
WebContentsWrapper operator=(const WebContentsWrapper&) = delete;
~WebContentsWrapper() override;
const GURL& GetLastCommittedURL() const override;
const std::u16string& GetTitle() override;
bool IsFirstLoadForNavigationFinished() override;
void SetIsFirstLoadForNavigationFinished(bool finished);
bool IsOffTheRecord() override;
void RunJavascript(
const std::u16string& script,
base::OnceCallback<void(const base::Value)> callback) override;
ukm::SourceId GetPageUkmSourceId() override;
void ClearWebContentsPointer();
content::RenderFrameHost* GetPrimaryMainFrame();
private:
raw_ptr<content::WebContents> web_contents_;
int32_t js_world_id_;
bool is_first_load_for_nav_finished_{false};
};
}
#endif