| Index: chrome/browser/usb/usb_chooser_context.cc
|
| diff --git a/chrome/browser/usb/usb_chooser_context.cc b/chrome/browser/usb/usb_chooser_context.cc
|
| index 231853d9b712a89f90718a7cebc70adc70851a2f..af54a609c06f53f66688a56141da94fe94131595 100644
|
| --- a/chrome/browser/usb/usb_chooser_context.cc
|
| +++ b/chrome/browser/usb/usb_chooser_context.cc
|
| @@ -54,7 +54,8 @@ bool CanStorePersistentEntry(const scoped_refptr<const UsbDevice>& device) {
|
| UsbChooserContext::UsbChooserContext(Profile* profile)
|
| : ChooserContextBase(profile, CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA),
|
| is_incognito_(profile->IsOffTheRecord()),
|
| - observer_(this) {
|
| + observer_(this),
|
| + weak_factory_(this) {
|
| usb_service_ = device::DeviceClient::Get()->GetUsbService();
|
| if (usb_service_)
|
| observer_.Add(usb_service_);
|
| @@ -183,6 +184,10 @@ bool UsbChooserContext::HasDevicePermission(
|
| return false;
|
| }
|
|
|
| +base::WeakPtr<UsbChooserContext> UsbChooserContext::AsWeakPtr() {
|
| + return weak_factory_.GetWeakPtr();
|
| +}
|
| +
|
| bool UsbChooserContext::IsValidObject(const base::DictionaryValue& object) {
|
| return object.size() == 4 && object.HasKey(kDeviceNameKey) &&
|
| object.HasKey(kVendorIdKey) && object.HasKey(kProductIdKey) &&
|
|
|