#ifndef CONTENT_PUBLIC_BROWSER_DOCUMENT_SERVICE_INTERNAL_H_
#define CONTENT_PUBLIC_BROWSER_DOCUMENT_SERVICE_INTERNAL_H_
#include "base/memory/raw_ref.h"
#include "base/types/pass_key.h"
#include "content/common/content_export.h"
namespace content {
class DocumentAssociatedData;
class RenderFrameHost;
enum class DocumentServiceDestructionReason : int;
template <typename T>
class DocumentService;
namespace internal {
class CONTENT_EXPORT DocumentServiceBase {
public:
DocumentServiceBase(const DocumentServiceBase&) = delete;
DocumentServiceBase& operator=(const DocumentServiceBase&) = delete;
virtual ~DocumentServiceBase();
virtual void WillBeDestroyed(DocumentServiceDestructionReason reason) {}
virtual void ResetAndDeleteThisInternal(
base::PassKey<DocumentAssociatedData>) = 0;
template <typename T>
void InternalUnregister(base::PassKey<DocumentService<T>>) {
InternalUnregisterImpl();
}
protected:
explicit DocumentServiceBase(RenderFrameHost& render_frame_host);
RenderFrameHost& render_frame_host() const { return *render_frame_host_; }
private:
void InternalUnregisterImpl();
const raw_ref<RenderFrameHost> render_frame_host_;
};
}
}
#endif