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

Side by Side Diff: chrome/browser/vr/vr_tab_helper.cc

Issue 2975593002: [vr] Deny permission requests in VR mode
Patch Set: . Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/vr/vr_tab_helper.h ('k') | content/public/common/web_preferences.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/vr_shell/vr_tab_helper.h" 5 #include "chrome/browser/vr/vr_tab_helper.h"
6 6
7 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h"
8 #include "content/public/browser/render_view_host.h" 7 #include "content/public/browser/render_view_host.h"
9 #include "content/public/common/web_preferences.h" 8 #include "content/public/common/web_preferences.h"
10 #include "device/vr/android/gvr/gvr_delegate_provider.h"
11 9
12 using content::WebContents; 10 using content::WebContents;
13 using content::WebPreferences; 11 using content::WebPreferences;
14 12
15 DEFINE_WEB_CONTENTS_USER_DATA_KEY(vr_shell::VrTabHelper); 13 DEFINE_WEB_CONTENTS_USER_DATA_KEY(vr::VrTabHelper);
16 14
17 namespace vr_shell { 15 namespace vr {
18 16
19 VrTabHelper::VrTabHelper(content::WebContents* contents) 17 VrTabHelper::VrTabHelper(content::WebContents* contents)
20 : web_contents_(contents) {} 18 : web_contents_(contents) {}
21 19
22 VrTabHelper::~VrTabHelper() {} 20 VrTabHelper::~VrTabHelper() {}
23 21
24 void VrTabHelper::SetIsInVr(bool is_in_vr) { 22 void VrTabHelper::SetIsInVr(bool is_in_vr) {
25 if (is_in_vr_ == is_in_vr) 23 if (is_in_vr_ == is_in_vr)
26 return; 24 return;
27 25
28 is_in_vr_ = is_in_vr; 26 is_in_vr_ = is_in_vr;
29 27
30 WebPreferences web_prefs = 28 WebPreferences web_prefs =
31 web_contents_->GetRenderViewHost()->GetWebkitPreferences(); 29 web_contents_->GetRenderViewHost()->GetWebkitPreferences();
32 web_prefs.page_popups_suppressed = is_in_vr_; 30 web_prefs.page_popups_suppressed = is_in_vr_;
33 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs); 31 web_contents_->GetRenderViewHost()->UpdateWebkitPreferences(web_prefs);
34 } 32 }
35 33
36 /* static */ 34 /* static */
37 bool VrTabHelper::IsInVr(content::WebContents* contents) { 35 bool VrTabHelper::IsInVr(content::WebContents* contents) {
38 VrTabHelper* vr_tab_helper = VrTabHelper::FromWebContents(contents); 36 VrTabHelper* vr_tab_helper = VrTabHelper::FromWebContents(contents);
39 if (!vr_tab_helper) { 37 if (!vr_tab_helper) {
40 // This can only happen for unittests. 38 // This can only happen for unittests.
41 VrTabHelper::CreateForWebContents(contents); 39 VrTabHelper::CreateForWebContents(contents);
42 vr_tab_helper = VrTabHelper::FromWebContents(contents); 40 vr_tab_helper = VrTabHelper::FromWebContents(contents);
43 } 41 }
44 return vr_tab_helper->is_in_vr(); 42 return vr_tab_helper->is_in_vr();
45 } 43 }
46 44
47 } // namespace vr_shell 45 } // namespace vr
OLDNEW
« no previous file with comments | « chrome/browser/vr/vr_tab_helper.h ('k') | content/public/common/web_preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698