#include "components/dom_distiller/core/distiller.h"
#include <map>
#include <memory>
#include <utility>
#include <vector>
#include "base/auto_reset.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "components/dom_distiller/core/distiller_page.h"
#include "components/dom_distiller/core/distiller_url_fetcher.h"
#include "components/dom_distiller/core/proto/distilled_article.pb.h"
#include "components/dom_distiller/core/proto/distilled_page.pb.h"
namespace {
const size_t kMaxPagesInArticle = …;
}
namespace dom_distiller {
DistillerFactoryImpl::DistillerFactoryImpl(
std::unique_ptr<DistillerURLFetcherFactory> distiller_url_fetcher_factory,
const dom_distiller::proto::DomDistillerOptions& dom_distiller_options)
: … { … }
DistillerFactoryImpl::~DistillerFactoryImpl() { … }
std::unique_ptr<Distiller> DistillerFactoryImpl::CreateDistillerForUrl(
const GURL& unused) { … }
DistillerImpl::DistilledPageData::DistilledPageData() { … }
DistillerImpl::DistilledPageData::~DistilledPageData() { … }
DistillerImpl::DistillerImpl(
const DistillerURLFetcherFactory& distiller_url_fetcher_factory,
const dom_distiller::proto::DomDistillerOptions& dom_distiller_options)
: … { … }
DistillerImpl::~DistillerImpl() { … }
bool DistillerImpl::DoesFetchImages() { … }
void DistillerImpl::SetMaxNumPagesInArticle(size_t max_num_pages) { … }
bool DistillerImpl::AreAllPagesFinished() const { … }
size_t DistillerImpl::TotalPageCount() const { … }
void DistillerImpl::AddToDistillationQueue(int page_num, const GURL& url) { … }
bool DistillerImpl::IsPageNumberInUse(int page_num) const { … }
DistillerImpl::DistilledPageData* DistillerImpl::GetPageAtIndex(
size_t index) const { … }
void DistillerImpl::DistillPage(const GURL& url,
std::unique_ptr<DistillerPage> distiller_page,
DistillationFinishedCallback finished_cb,
const DistillationUpdateCallback& update_cb) { … }
void DistillerImpl::DistillNextPage() { … }
void DistillerImpl::OnPageDistillationFinished(
int page_num,
const GURL& page_url,
std::unique_ptr<proto::DomDistillerResult> distiller_result,
bool distillation_successful) { … }
void DistillerImpl::MaybeFetchImage(int page_num,
const std::string& image_id,
const std::string& image_url) { … }
void DistillerImpl::OnFetchImageDone(int page_num,
DistillerURLFetcher* url_fetcher,
const std::string& id,
const std::string& original_url,
const std::string& response) { … }
void DistillerImpl::AddPageIfDone(int page_num) { … }
const ArticleDistillationUpdate DistillerImpl::CreateDistillationUpdate()
const { … }
void DistillerImpl::RunDistillerCallbackIfDone() { … }
}