OLD | NEW |
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 "chrome/browser/usb/usb_chooser_context.h" | 5 #include "chrome/browser/usb/usb_chooser_context.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "device/core/device_client.h" | 16 #include "device/base/device_client.h" |
17 #include "device/usb/public/interfaces/device.mojom.h" | 17 #include "device/usb/public/interfaces/device.mojom.h" |
18 #include "device/usb/usb_device.h" | 18 #include "device/usb/usb_device.h" |
19 | 19 |
20 using device::UsbDevice; | 20 using device::UsbDevice; |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 const char kDeviceNameKey[] = "name"; | 24 const char kDeviceNameKey[] = "name"; |
25 const char kGuidKey[] = "ephemeral-guid"; | 25 const char kGuidKey[] = "ephemeral-guid"; |
26 const char kProductIdKey[] = "product-id"; | 26 const char kProductIdKey[] = "product-id"; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 bool UsbChooserContext::IsValidObject(const base::DictionaryValue& object) { | 186 bool UsbChooserContext::IsValidObject(const base::DictionaryValue& object) { |
187 return object.size() == 4 && object.HasKey(kDeviceNameKey) && | 187 return object.size() == 4 && object.HasKey(kDeviceNameKey) && |
188 object.HasKey(kVendorIdKey) && object.HasKey(kProductIdKey) && | 188 object.HasKey(kVendorIdKey) && object.HasKey(kProductIdKey) && |
189 object.HasKey(kSerialNumberKey); | 189 object.HasKey(kSerialNumberKey); |
190 } | 190 } |
191 | 191 |
192 void UsbChooserContext::OnDeviceRemoved(scoped_refptr<UsbDevice> device) { | 192 void UsbChooserContext::OnDeviceRemoved(scoped_refptr<UsbDevice> device) { |
193 for (auto& map_entry : ephemeral_devices_) | 193 for (auto& map_entry : ephemeral_devices_) |
194 map_entry.second.erase(device->guid()); | 194 map_entry.second.erase(device->guid()); |
195 } | 195 } |
OLD | NEW |