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

Unified Diff: chrome/browser/ui/android/usb_chooser_dialog_android.cc

Issue 2929843003: Disable USB chooser dialog while in VR (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/android/usb_chooser_dialog_android.cc
diff --git a/chrome/browser/ui/android/usb_chooser_dialog_android.cc b/chrome/browser/ui/android/usb_chooser_dialog_android.cc
index 0fc1f66dbb8ffd5344aea3507cece0da3c332684..39d3a6ebd41f504e71b0480216283f3d1f6bcdfb 100644
--- a/chrome/browser/ui/android/usb_chooser_dialog_android.cc
+++ b/chrome/browser/ui/android/usb_chooser_dialog_android.cc
@@ -29,10 +29,15 @@
#include "device/usb/usb_device.h"
#include "device/usb/usb_device_filter.h"
#include "device/usb/webusb_descriptors.h"
+#include "device/vr/features/features.h"
#include "jni/UsbChooserDialog_jni.h"
#include "ui/android/window_android.h"
#include "url/gurl.h"
+#if BUILDFLAG(ENABLE_VR)
+#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
+#endif // BUILDFLAG(ENABLE_VR)
+
using device::UsbDevice;
using device::UsbDeviceFilter;
@@ -59,6 +64,16 @@ UsbChooserDialogAndroid::UsbChooserDialogAndroid(
usb_service_observer_(this),
filters_(filters),
weak_factory_(this) {
+ content::WebContents* web_contents =
+ content::WebContents::FromRenderFrameHost(render_frame_host_);
+#if BUILDFLAG(ENABLE_VR)
+ if (vr_shell::VrTabHelper::IsInVr(web_contents)) {
+ DCHECK(!callback_.is_null());
+ callback_.Run(nullptr);
+ callback_.Reset(); // Reset |callback_| so that it is only run once.
+ return;
+ }
+#endif
device::UsbService* usb_service =
device::DeviceClient::Get()->GetUsbService();
if (!usb_service)
@@ -68,8 +83,6 @@ UsbChooserDialogAndroid::UsbChooserDialogAndroid(
usb_service_observer_.Add(usb_service);
// Create (and show) the UsbChooser dialog.
- content::WebContents* web_contents =
- content::WebContents::FromRenderFrameHost(render_frame_host_);
base::android::ScopedJavaLocalRef<jobject> window_android =
content::ContentViewCore::FromWebContents(web_contents)
->GetWindowAndroid()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698