Fix crash when tapping help link on Android
This change fixes a crash introduced in r548482 when the user taps on
the help link in the WebUSB device chooser dialog. There is no Browser
object in Chrome on Android and so we must keep a pointer to the
WebContents that launched this dialog in order to open a new URL. This
is safe because the dialog will be closed if the tab is closed.
Bug: 829762
Change-Id: I236ad45868d72edba9a95300848137b557e3a718
Reviewed-on: https://chromium-review.googlesource.com/1000252
Reviewed-by: Jun Cai <[email protected]>
Commit-Queue: Reilly Grant <[email protected]>
Cr-Commit-Position: refs/heads/master@{#548985}
diff --git a/chrome/browser/usb/usb_chooser_controller.h b/chrome/browser/usb/usb_chooser_controller.h
index b52b9b57..4971574 100644
--- a/chrome/browser/usb/usb_chooser_controller.h
+++ b/chrome/browser/usb/usb_chooser_controller.h
@@ -20,6 +20,7 @@
namespace content {
class RenderFrameHost;
+class WebContents;
}
namespace device {
@@ -64,6 +65,7 @@
GURL requesting_origin_;
GURL embedding_origin_;
+ content::WebContents* const web_contents_;
base::WeakPtr<UsbChooserContext> chooser_context_;
ScopedObserver<device::UsbService, device::UsbService::Observer>
usb_service_observer_;