1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
#include <optional>
#include "chrome/common/extensions/api/document_scan.h"
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_function_histogram_value.h"
namespace extensions {
class DocumentScanScanFunction : public ExtensionFunction {
public:
DocumentScanScanFunction();
DocumentScanScanFunction(const DocumentScanScanFunction&) = delete;
DocumentScanScanFunction& operator=(const DocumentScanScanFunction&) = delete;
protected:
~DocumentScanScanFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnScanCompleted(
std::optional<api::document_scan::ScanResults> scan_result,
std::optional<std::string> error);
DECLARE_EXTENSION_FUNCTION("documentScan.scan", DOCUMENTSCAN_SCAN)
};
class DocumentScanGetScannerListFunction : public ExtensionFunction {
public:
DocumentScanGetScannerListFunction();
DocumentScanGetScannerListFunction(
const DocumentScanGetScannerListFunction&) = delete;
DocumentScanGetScannerListFunction& operator=(
const DocumentScanGetScannerListFunction&) = delete;
protected:
~DocumentScanGetScannerListFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnScannerListReceived(
api::document_scan::GetScannerListResponse response);
DECLARE_EXTENSION_FUNCTION("documentScan.getScannerList",
DOCUMENTSCAN_GETSCANNERLIST)
};
class DocumentScanOpenScannerFunction : public ExtensionFunction {
public:
DocumentScanOpenScannerFunction();
DocumentScanOpenScannerFunction(const DocumentScanOpenScannerFunction&) =
delete;
DocumentScanOpenScannerFunction& operator=(
const DocumentScanOpenScannerFunction&) = delete;
protected:
~DocumentScanOpenScannerFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnResponseReceived(api::document_scan::OpenScannerResponse response);
DECLARE_EXTENSION_FUNCTION("documentScan.openScanner",
DOCUMENTSCAN_OPENSCANNER)
};
class DocumentScanGetOptionGroupsFunction : public ExtensionFunction {
public:
DocumentScanGetOptionGroupsFunction();
DocumentScanGetOptionGroupsFunction(
const DocumentScanGetOptionGroupsFunction&) = delete;
DocumentScanGetOptionGroupsFunction& operator=(
const DocumentScanGetOptionGroupsFunction&) = delete;
protected:
~DocumentScanGetOptionGroupsFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnResponseReceived(api::document_scan::GetOptionGroupsResponse response);
DECLARE_EXTENSION_FUNCTION("documentScan.getOptionGroups",
DOCUMENTSCAN_GETOPTIONGROUPS)
};
class DocumentScanCloseScannerFunction : public ExtensionFunction {
public:
DocumentScanCloseScannerFunction();
DocumentScanCloseScannerFunction(const DocumentScanCloseScannerFunction&) =
delete;
DocumentScanCloseScannerFunction& operator=(
const DocumentScanCloseScannerFunction&) = delete;
protected:
~DocumentScanCloseScannerFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnResponseReceived(api::document_scan::CloseScannerResponse response);
DECLARE_EXTENSION_FUNCTION("documentScan.closeScanner",
DOCUMENTSCAN_CLOSESCANNER)
};
class DocumentScanSetOptionsFunction : public ExtensionFunction {
public:
DocumentScanSetOptionsFunction();
DocumentScanSetOptionsFunction(const DocumentScanSetOptionsFunction&) =
delete;
DocumentScanSetOptionsFunction& operator=(
const DocumentScanSetOptionsFunction&) = delete;
protected:
~DocumentScanSetOptionsFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnResponseReceived(api::document_scan::SetOptionsResponse response);
DECLARE_EXTENSION_FUNCTION("documentScan.setOptions", DOCUMENTSCAN_SETOPTIONS)
};
class DocumentScanStartScanFunction : public ExtensionFunction {
public:
DocumentScanStartScanFunction();
DocumentScanStartScanFunction(const DocumentScanStartScanFunction&) = delete;
DocumentScanStartScanFunction& operator=(
const DocumentScanStartScanFunction&) = delete;
protected:
~DocumentScanStartScanFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnResponseReceived(api::document_scan::StartScanResponse response);
DECLARE_EXTENSION_FUNCTION("documentScan.startScan", DOCUMENTSCAN_STARTSCAN)
};
class DocumentScanCancelScanFunction : public ExtensionFunction {
public:
DocumentScanCancelScanFunction();
DocumentScanCancelScanFunction(const DocumentScanCancelScanFunction&) =
delete;
DocumentScanCancelScanFunction& operator=(
const DocumentScanCancelScanFunction&) = delete;
protected:
~DocumentScanCancelScanFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnResponseReceived(api::document_scan::CancelScanResponse response);
DECLARE_EXTENSION_FUNCTION("documentScan.cancelScan", DOCUMENTSCAN_CANCELSCAN)
};
class DocumentScanReadScanDataFunction : public ExtensionFunction {
public:
DocumentScanReadScanDataFunction();
DocumentScanReadScanDataFunction(const DocumentScanReadScanDataFunction&) =
delete;
DocumentScanReadScanDataFunction& operator=(
const DocumentScanReadScanDataFunction&) = delete;
protected:
~DocumentScanReadScanDataFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnResponseReceived(api::document_scan::ReadScanDataResponse response);
DECLARE_EXTENSION_FUNCTION("documentScan.readScanData",
DOCUMENTSCAN_READSCANDATA)
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
|