#include "content/browser/renderer_host/page_factory.h"
#include <memory>
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_factory.h"
#include "content/browser/site_instance_group.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
namespace content {
PageFactory* PageFactory::factory_ = nullptr;
std::unique_ptr<PageImpl> PageFactory::Create(RenderFrameHostImpl& rfh,
PageDelegate& delegate) {
if (factory_) {
return factory_->CreatePage(rfh, delegate);
}
return std::make_unique<PageImpl>(rfh, delegate);
}
void PageFactory::RegisterFactory(PageFactory* factory) {
DCHECK(!factory_) << "Can't register two factories at once.";
factory_ = factory;
}
void PageFactory::UnregisterFactory() {
DCHECK(factory_) << "No factory to unregister.";
factory_ = nullptr;
}
}