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

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

Issue 2885033007: Disable color/date chooser in VR mode via WebPreferences (Closed)
Patch Set: added explanatory comment. Created 3 years, 7 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_tab_helper.h ('k') | content/public/common/common_param_traits_macros.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_tab_helper.cc
diff --git a/chrome/browser/android/vr_shell/vr_tab_helper.cc b/chrome/browser/android/vr_shell/vr_tab_helper.cc
index eef1ffbc6e79e53eb91c1df581f4c4e7020a3b5b..3121cd2eedb0618ccae118ae20436b73c3856b7f 100644
--- a/chrome/browser/android/vr_shell/vr_tab_helper.cc
+++ b/chrome/browser/android/vr_shell/vr_tab_helper.cc
@@ -5,17 +5,32 @@
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#include "chrome/browser/android/vr_shell/vr_shell_delegate.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/common/web_preferences.h"
#include "device/vr/android/gvr/gvr_delegate_provider.h"
+using content::WebContents;
+using content::WebPreferences;
+
DEFINE_WEB_CONTENTS_USER_DATA_KEY(vr_shell::VrTabHelper);
namespace vr_shell {
-VrTabHelper::VrTabHelper(content::WebContents* contents) {}
+VrTabHelper::VrTabHelper(content::WebContents* contents)
+ : web_contents_(contents) {}
+
VrTabHelper::~VrTabHelper() {}
void VrTabHelper::SetIsInVr(bool is_in_vr) {
+ if (is_in_vr_ == is_in_vr)
+ return;
+
is_in_vr_ = is_in_vr;
+
+ WebPreferences web_prefs =
+ web_contents_->GetRenderViewHost()->GetWebkitPreferences();
+ web_prefs.page_popups_suppressed = is_in_vr_;
+ web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs);
}
/* static */
« no previous file with comments | « chrome/browser/android/vr_shell/vr_tab_helper.h ('k') | content/public/common/common_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698