#ifndef SERVICES_IMAGE_ANNOTATION_PUBLIC_CPP_IMAGE_PROCESSOR_H_
#define SERVICES_IMAGE_ANNOTATION_PUBLIC_CPP_IMAGE_PROCESSOR_H_
#include "base/functional/callback.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/task/sequenced_task_runner.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "services/image_annotation/public/mojom/image_annotation.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace image_annotation {
class ImageProcessor : public mojom::ImageProcessor {
public:
explicit ImageProcessor(base::RepeatingCallback<SkBitmap()> get_pixels);
ImageProcessor(const ImageProcessor&) = delete;
ImageProcessor& operator=(const ImageProcessor&) = delete;
~ImageProcessor() override;
void GetJpgImageData(GetJpgImageDataCallback callback) override;
mojo::PendingRemote<mojom::ImageProcessor> GetPendingRemote();
private:
static constexpr int kMaxPixels = 512 * 512;
static constexpr int kJpgQuality = 65;
const base::RepeatingCallback<SkBitmap()> get_pixels_;
scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
mojo::ReceiverSet<mojom::ImageProcessor> receivers_;
FRIEND_TEST_ALL_PREFIXES(ImageProcessorTest, ImageContent);
};
}
#endif