#ifndef CONTENT_RENDERER_DOCUMENT_STATE_H_
#define CONTENT_RENDERER_DOCUMENT_STATE_H_
#include <memory>
#include "content/common/content_export.h"
#include "content/renderer/navigation_state.h"
#include "net/http/http_response_info.h"
#include "third_party/blink/public/web/web_document_loader.h"
#include "url/gurl.h"
namespace content {
class CONTENT_EXPORT DocumentState
: public blink::WebDocumentLoader::ExtraData {
public:
DocumentState();
~DocumentState() override;
static DocumentState* FromDocumentLoader(
blink::WebDocumentLoader* document_loader) {
return static_cast<DocumentState*>(document_loader->GetExtraData());
}
std::unique_ptr<blink::WebDocumentLoader::ExtraData> Clone() override;
void set_was_load_data_with_base_url_request(bool value) {
was_load_data_with_base_url_request_ = value;
}
bool was_load_data_with_base_url_request() const {
return was_load_data_with_base_url_request_;
}
const GURL& data_url() const { return data_url_; }
void set_data_url(const GURL& data_url) { data_url_ = data_url; }
bool is_overriding_user_agent() const { return is_overriding_user_agent_; }
void set_is_overriding_user_agent(bool state) {
is_overriding_user_agent_ = state;
}
int request_id() const { return request_id_; }
void set_request_id(int request_id) { request_id_ = request_id; }
NavigationState* navigation_state() { return navigation_state_.get(); }
void set_navigation_state(std::unique_ptr<NavigationState> navigation_state);
std::unique_ptr<NavigationState> TakeNavigationState() {
return std::move(navigation_state_);
}
#if BUILDFLAG(ARKWEB_USERAGENT)
bool must_reset_scroll_and_scale_state() {
return must_reset_scroll_and_scale_state_;
}
void set_must_reset_scroll_and_scale_state(bool state) {
must_reset_scroll_and_scale_state_ = state;
}
#endif
private:
bool was_load_data_with_base_url_request_ = false;
GURL data_url_;
bool is_overriding_user_agent_ = false;
int request_id_ = -1;
std::unique_ptr<NavigationState> navigation_state_;
#if BUILDFLAG(ARKWEB_USERAGENT)
bool must_reset_scroll_and_scale_state_{false};
#endif
};
}
#endif