Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / extensions / common / api / printer_provider / usb_printer_manifest_handler.cc
blobe356050b7e116491badda09cbf2b7022029ed061
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "extensions/common/api/printer_provider/usb_printer_manifest_handler.h"
7 #include "extensions/common/api/printer_provider/usb_printer_manifest_data.h"
8 #include "extensions/common/extension.h"
9 #include "extensions/common/manifest_constants.h"
11 namespace extensions {
13 UsbPrinterManifestHandler::UsbPrinterManifestHandler() {
16 UsbPrinterManifestHandler::~UsbPrinterManifestHandler() {
19 bool UsbPrinterManifestHandler::Parse(Extension* extension,
20 base::string16* error) {
21 const base::Value* usb_printers = nullptr;
22 CHECK(extension->manifest()->Get(manifest_keys::kUsbPrinters, &usb_printers));
23 scoped_ptr<UsbPrinterManifestData> data =
24 UsbPrinterManifestData::FromValue(*usb_printers, error);
25 if (!data) {
26 return false;
29 extension->SetManifestData(manifest_keys::kUsbPrinters, data.release());
30 return true;
33 const std::vector<std::string> UsbPrinterManifestHandler::Keys() const {
34 return SingleKey(manifest_keys::kUsbPrinters);
37 } // namespace extensions