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

Unified Diff: chrome/browser/usb/usb_chooser_context.cc

Issue 2746313002: Remove RenderFrameHost pointer from ChooserController. (Closed)
Patch Set: Fix Android build and juncai@ comment. Created 3 years, 9 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
« no previous file with comments | « chrome/browser/usb/usb_chooser_context.h ('k') | chrome/browser/usb/usb_chooser_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) &&
« no previous file with comments | « chrome/browser/usb/usb_chooser_context.h ('k') | chrome/browser/usb/usb_chooser_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698