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

Unified Diff: chrome/browser/android/vr_shell/vr_shell.cc

Issue 2736083002: Suppress the Android keyboard when selecting VR UI input fields. (Closed)
Patch Set: Reorder class forward declarations. 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/android/vr_shell/vr_shell.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc
index ab3b67ac4529a57e6708f2c6ea1ef9543128f90a..53c7b49f986437bfa2e494c4d3335582dee9dc13 100644
--- a/chrome/browser/android/vr_shell/vr_shell.cc
+++ b/chrome/browser/android/vr_shell/vr_shell.cc
@@ -63,6 +63,20 @@ void SetIsInVR(content::WebContents* contents, bool is_in_vr) {
} // namespace
+class UiWebContentsObserver : public content::WebContentsObserver {
cjgrant 2017/03/07 20:34:47 This class could live in a separate file, but give
mthiesse 2017/03/07 20:49:24 VrShell is already an observer of the UI web conte
cjgrant 2017/03/07 21:08:46 Done. Wow, need to check eyes.
+ public:
+ explicit UiWebContentsObserver(content::WebContents* web_contents)
+ : WebContentsObserver(web_contents) {}
+
+ private:
+ void RenderViewHostChanged(content::RenderViewHost* old_host,
+ content::RenderViewHost* new_host) override {
+ new_host->GetWidget()->GetView()->SetIsInVR(true);
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(UiWebContentsObserver);
+};
+
VrShell::VrShell(JNIEnv* env,
jobject obj,
ui::WindowAndroid* content_window,
@@ -138,6 +152,8 @@ void VrShell::SwapContents(
content_input_manager_ = base::MakeUnique<VrInputManager>(main_contents_);
vr_web_contents_observer_ = base::MakeUnique<VrWebContentsObserver>(
main_contents_, html_interface_.get(), this);
+ ui_web_contents_observer_ =
+ base::MakeUnique<UiWebContentsObserver>(ui_contents_);
// TODO(billorr): Make VrMetricsHelper tab-aware and able to track multiple
// tabs. crbug.com/684661
metrics_helper_ = base::MakeUnique<VrMetricsHelper>(main_contents_);
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698