#include "chrome/browser/extensions/api/page_capture/page_capture_api.h"
#include <limits>
#include <utility>
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/thread_pool.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "components/sessions/content/session_tab_helper.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/mhtml_generation_params.h"
#include "extensions/browser/extension_api_frame_id_map.h"
#include "extensions/browser/extension_util.h"
#include "extensions/common/permissions/permissions_data.h"
#include "url/origin.h"
BrowserThread;
ChildProcessSecurityPolicy;
WebContents;
PageCaptureSaveAsMHTMLFunction;
ShareableFileReference;
SaveAsMHTML;
namespace {
const char kFileTooBigError[] = …;
const char kMHTMLGenerationFailedError[] = …;
const char kTemporaryFileError[] = …;
const char kTabClosedError[] = …;
const char kTabNavigatedError[] = …;
const char kPageCaptureNotAllowed[] = …;
constexpr base::TaskTraits kCreateTemporaryFileTaskTraits = …;
void ClearFileReferenceOnIOThread(
scoped_refptr<storage::ShareableFileReference>) { … }
}
static PageCaptureSaveAsMHTMLFunction::TestDelegate* test_delegate_ = …;
PageCaptureSaveAsMHTMLFunction::PageCaptureSaveAsMHTMLFunction() { … }
PageCaptureSaveAsMHTMLFunction::~PageCaptureSaveAsMHTMLFunction() { … }
void PageCaptureSaveAsMHTMLFunction::SetTestDelegate(TestDelegate* delegate) { … }
ExtensionFunction::ResponseAction PageCaptureSaveAsMHTMLFunction::Run() { … }
bool PageCaptureSaveAsMHTMLFunction::CanCaptureCurrentPage(
WebContents& web_contents,
std::string* error) { … }
void PageCaptureSaveAsMHTMLFunction::OnResponseAck() { … }
void PageCaptureSaveAsMHTMLFunction::CreateTemporaryFile() { … }
void PageCaptureSaveAsMHTMLFunction::TemporaryFileCreatedOnIO(bool success) { … }
void PageCaptureSaveAsMHTMLFunction::TemporaryFileCreatedOnUI(bool success) { … }
void PageCaptureSaveAsMHTMLFunction::MHTMLGenerated(int64_t mhtml_file_size) { … }
void PageCaptureSaveAsMHTMLFunction::ReturnFailure(const std::string& error) { … }
void PageCaptureSaveAsMHTMLFunction::ReturnSuccess(int file_size) { … }
WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() { … }