Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4491)

Unified Diff: chrome/browser/extensions/api/document_scan/document_scan_api.h

Issue 286933006: Implement a JavaScript API for document scanning (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added entries to histograms.xml, clarified comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/document_scan/document_scan_api.h
diff --git a/chrome/browser/extensions/api/document_scan/document_scan_api.h b/chrome/browser/extensions/api/document_scan/document_scan_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..253bb9b6780889f9b244db86170078c33d97afbb
--- /dev/null
+++ b/chrome/browser/extensions/api/document_scan/document_scan_api.h
@@ -0,0 +1,66 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/extensions/api/document_scan.h"
+#include "chromeos/dbus/lorgnette_manager_client.h"
+#include "extensions/browser/api/async_api_function.h"
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
+#define CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
+
+namespace base {
+class FilePath;
+} // namespace base
+
+namespace extensions {
+
+namespace api {
+
+class DocumentScanListScannersFunction : public AsyncApiFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION("documentScan.listScanners",
+ DOCUMENT_SCAN_LISTSCANNERS)
+ DocumentScanListScannersFunction();
+
+ protected:
+ ~DocumentScanListScannersFunction();
+
+ // AsyncApiFunction:
+ virtual bool Prepare() OVERRIDE;
+ virtual void AsyncWorkStart() OVERRIDE;
+ virtual bool Respond() OVERRIDE;
+
+ private:
+ void OnScannerListReceived(
+ bool succeeded,
+ const chromeos::LorgnetteManagerClient::ScannerTable &scanners);
+};
+
+class DocumentScanScanFunction : public AsyncApiFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION("documentScan.scan",
+ DOCUMENT_SCAN_SCAN)
+ DocumentScanScanFunction();
+
+ protected:
+ ~DocumentScanScanFunction();
+
+ // AsyncApiFunction:
+ virtual bool Prepare() OVERRIDE;
+ virtual void AsyncWorkStart() OVERRIDE;
+ virtual bool Respond() OVERRIDE;
+
+ private:
+ bool GetDocumentScanFilename(base::FilePath* filename);
+ void ScanImageCallback(const base::FilePath &filename, bool succeeded);
+ void FinishScan();
+
+ scoped_ptr<document_scan::Scan::Params> params_;
+};
+
+} // namespace api
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_

Powered by Google App Engine
This is Rietveld 408576698