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

Side by Side Diff: extensions/common/api/printer_provider/usb_printer_manifest_data.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/common/api/printer_provider/usb_printer_manifest_data.h" 5 #include "extensions/common/api/printer_provider/usb_printer_manifest_data.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "device/usb/usb_device.h" 8 #include "device/usb/usb_device.h"
9 #include "device/usb/usb_device_filter.h" 9 #include "device/usb/usb_device_filter.h"
10 #include "extensions/common/api/extensions_manifest_types.h" 10 #include "extensions/common/api/extensions_manifest_types.h"
(...skipping 13 matching lines...) Expand all
24 const UsbPrinterManifestData* UsbPrinterManifestData::Get( 24 const UsbPrinterManifestData* UsbPrinterManifestData::Get(
25 const Extension* extension) { 25 const Extension* extension) {
26 return static_cast<UsbPrinterManifestData*>( 26 return static_cast<UsbPrinterManifestData*>(
27 extension->GetManifestData(manifest_keys::kUsbPrinters)); 27 extension->GetManifestData(manifest_keys::kUsbPrinters));
28 } 28 }
29 29
30 // static 30 // static
31 scoped_ptr<UsbPrinterManifestData> UsbPrinterManifestData::FromValue( 31 scoped_ptr<UsbPrinterManifestData> UsbPrinterManifestData::FromValue(
32 const base::Value& value, 32 const base::Value& value,
33 base::string16* error) { 33 base::string16* error) {
34 scoped_ptr<core_api::extensions_manifest_types::UsbPrinters> usb_printers = 34 scoped_ptr<api::extensions_manifest_types::UsbPrinters> usb_printers =
35 core_api::extensions_manifest_types::UsbPrinters::FromValue(value, error); 35 api::extensions_manifest_types::UsbPrinters::FromValue(value, error);
36 if (!usb_printers) { 36 if (!usb_printers) {
37 return nullptr; 37 return nullptr;
38 } 38 }
39 39
40 scoped_ptr<UsbPrinterManifestData> result(new UsbPrinterManifestData()); 40 scoped_ptr<UsbPrinterManifestData> result(new UsbPrinterManifestData());
41 for (const auto& input : usb_printers->filters) { 41 for (const auto& input : usb_printers->filters) {
42 DCHECK(input.get()); 42 DCHECK(input.get());
43 UsbDeviceFilter output; 43 UsbDeviceFilter output;
44 output.SetVendorId(input->vendor_id); 44 output.SetVendorId(input->vendor_id);
45 if (input->product_id && input->interface_class) { 45 if (input->product_id && input->interface_class) {
(...skipping 17 matching lines...) Expand all
63 } 63 }
64 return result.Pass(); 64 return result.Pass();
65 } 65 }
66 66
67 bool UsbPrinterManifestData::SupportsDevice( 67 bool UsbPrinterManifestData::SupportsDevice(
68 const scoped_refptr<device::UsbDevice>& device) const { 68 const scoped_refptr<device::UsbDevice>& device) const {
69 return UsbDeviceFilter::MatchesAny(device, filters_); 69 return UsbDeviceFilter::MatchesAny(device, filters_);
70 } 70 }
71 71
72 } // namespace extensions 72 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/api/declarative/declarative_manifest_data.h ('k') | extensions/common/api/schemas.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698