#include "chrome/browser/extensions/api/image_writer_private/write_from_url_operation.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "chrome/browser/extensions/api/image_writer_private/error_constants.h"
#include "chrome/browser/extensions/api/image_writer_private/operation_manager.h"
#include "content/public/browser/browser_thread.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
namespace extensions {
namespace image_writer {
BrowserThread;
WriteFromUrlOperation::WriteFromUrlOperation(
base::WeakPtr<OperationManager> manager,
const ExtensionId& extension_id,
mojo::PendingRemote<network::mojom::URLLoaderFactory> factory_remote,
GURL url,
const std::string& hash,
const std::string& device_path,
const base::FilePath& download_folder)
: … { … }
WriteFromUrlOperation::~WriteFromUrlOperation() = default;
void WriteFromUrlOperation::StartImpl() { … }
void WriteFromUrlOperation::GetDownloadTarget(base::OnceClosure continuation) { … }
void WriteFromUrlOperation::Download(base::OnceClosure continuation) { … }
void WriteFromUrlOperation::DestroySimpleURLLoader() { … }
void WriteFromUrlOperation::OnResponseStarted(
const GURL& final_url,
const network::mojom::URLResponseHead& response_head) { … }
void WriteFromUrlOperation::OnDataDownloaded(uint64_t current) { … }
void WriteFromUrlOperation::OnSimpleLoaderComplete(base::FilePath file_path) { … }
void WriteFromUrlOperation::VerifyDownload(base::OnceClosure continuation) { … }
void WriteFromUrlOperation::VerifyDownloadCompare(
base::OnceClosure continuation,
const std::string& download_hash) { … }
void WriteFromUrlOperation::VerifyDownloadComplete(
base::OnceClosure continuation) { … }
}
}