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

Unified Diff: extensions/common/api/printer_provider/usb_printer_manifest_handler.cc

Issue 1123093003: Add a manifest property declaring USB printers supported by an app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix interfaceProtocol documentation. Created 5 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: extensions/common/api/printer_provider/usb_printer_manifest_handler.cc
diff --git a/extensions/common/api/printer_provider/usb_printer_manifest_handler.cc b/extensions/common/api/printer_provider/usb_printer_manifest_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e356050b7e116491badda09cbf2b7022029ed061
--- /dev/null
+++ b/extensions/common/api/printer_provider/usb_printer_manifest_handler.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 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 "extensions/common/api/printer_provider/usb_printer_manifest_handler.h"
+
+#include "extensions/common/api/printer_provider/usb_printer_manifest_data.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/manifest_constants.h"
+
+namespace extensions {
+
+UsbPrinterManifestHandler::UsbPrinterManifestHandler() {
+}
+
+UsbPrinterManifestHandler::~UsbPrinterManifestHandler() {
+}
+
+bool UsbPrinterManifestHandler::Parse(Extension* extension,
+ base::string16* error) {
+ const base::Value* usb_printers = nullptr;
+ CHECK(extension->manifest()->Get(manifest_keys::kUsbPrinters, &usb_printers));
+ scoped_ptr<UsbPrinterManifestData> data =
+ UsbPrinterManifestData::FromValue(*usb_printers, error);
+ if (!data) {
+ return false;
+ }
+
+ extension->SetManifestData(manifest_keys::kUsbPrinters, data.release());
+ return true;
+}
+
+const std::vector<std::string> UsbPrinterManifestHandler::Keys() const {
+ return SingleKey(manifest_keys::kUsbPrinters);
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698