chromium/chrome/browser/extensions/api/image_writer_private/operation.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/browser/extensions/api/image_writer_private/operation.h"

#include <string_view>
#include <utility>

#include "base/containers/heap_array.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/api/image_writer_private/error_constants.h"
#include "chrome/browser/extensions/api/image_writer_private/extraction_properties.h"
#include "chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.h"
#include "chrome/browser/extensions/api/image_writer_private/operation_manager.h"
#include "chrome/browser/extensions/api/image_writer_private/tar_extractor.h"
#include "chrome/browser/extensions/api/image_writer_private/xz_extractor.h"
#include "chrome/browser/extensions/api/image_writer_private/zip_extractor.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"

namespace extensions {
namespace image_writer {

namespace {

const int kMD5BufferSize =;

// Returns true if the file at |image_path| is an archived image.
bool IsArchive(const base::FilePath& image_path) {}

// Extracts the archive at |image_path| using to |temp_dir_path| using a proper
// extractor.
void ExtractArchive(ExtractionProperties properties) {}

}  // namespace

Operation::Operation(base::WeakPtr<OperationManager> manager,
                     const ExtensionId& extension_id,
                     const std::string& device_path,
                     const base::FilePath& download_folder)
    :{}

Operation::~Operation() {}

void Operation::Cancel() {}

void Operation::Abort() {}

int Operation::GetProgress() {}

image_writer_api::Stage Operation::GetStage() {}

void Operation::PostTask(base::OnceClosure task) {}

void Operation::Start() {}

void Operation::OnExtractOpenComplete(const base::FilePath& image_path) {}

void Operation::Extract(base::OnceClosure continuation) {}

void Operation::Finish() {}

void Operation::Error(const std::string& error_message) {}

void Operation::SetProgress(int progress) {}

void Operation::SetStage(image_writer_api::Stage stage) {}

bool Operation::IsCancelled() {}

void Operation::AddCleanUpFunction(base::OnceClosure callback) {}

void Operation::CompleteAndContinue(base::OnceClosure continuation) {}

#if !BUILDFLAG(IS_CHROMEOS_ASH)
void Operation::StartUtilityClient() {}

void Operation::StopUtilityClient() {}

void Operation::WriteImageProgress(int64_t total_bytes, int64_t curr_bytes) {}
#endif

void Operation::GetMD5SumOfFile(
    const base::FilePath& file_path,
    int64_t file_size,
    int progress_offset,
    int progress_scale,
    base::OnceCallback<void(const std::string&)> callback) {}

bool Operation::IsRunningInCorrectSequence() const {}

void Operation::MD5Chunk(
    base::File file,
    int64_t bytes_processed,
    int64_t bytes_total,
    int progress_offset,
    int progress_scale,
    base::OnceCallback<void(const std::string&)> callback) {}

void Operation::OnExtractFailure(const std::string& error) {}

void Operation::OnExtractProgress(int64_t total_bytes, int64_t progress_bytes) {}

void Operation::CleanUp() {}

}  // namespace image_writer
}  // namespace extensions