Commit e9bbbdb6 authored by Ian Vollick's avatar Ian Vollick Committed by Commit Bot

[vr] VrTabHelper should not be android-specific

This code previously lived in an android-specific directory, so it was
inappropriate to include it on other platforms. Now that we've moved
platform-agnostic code to chrome/browser/vr, the tab helper can also
be relocated, removing a number of unfortunate ifdefs.

Bug: 728421
Change-Id: I2b3f5e6b7369a751ed1e947f7882b2a8dd75e38e
Reviewed-on: https://chromium-review.googlesource.com/567327Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Ian Vollick <vollick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485972}
parent 8aa67879
...@@ -1403,6 +1403,8 @@ split_static_library("browser") { ...@@ -1403,6 +1403,8 @@ split_static_library("browser") {
"usb/web_usb_histograms.h", "usb/web_usb_histograms.h",
"usb/web_usb_permission_provider.cc", "usb/web_usb_permission_provider.cc",
"usb/web_usb_permission_provider.h", "usb/web_usb_permission_provider.h",
"vr/vr_tab_helper.cc",
"vr/vr_tab_helper.h",
"web_data_service_factory.cc", "web_data_service_factory.cc",
"web_data_service_factory.h", "web_data_service_factory.h",
"webshare/share_target_pref_helper.cc", "webshare/share_target_pref_helper.cc",
...@@ -3550,10 +3552,6 @@ split_static_library("browser") { ...@@ -3550,10 +3552,6 @@ split_static_library("browser") {
if (enable_vr) { if (enable_vr) {
if (is_android) { if (is_android) {
sources += [
"android/vr_shell/vr_tab_helper.cc",
"android/vr_shell/vr_tab_helper.h",
]
deps += [ "android/vr_shell:vr_android" ] deps += [ "android/vr_shell:vr_android" ]
configs += [ "//third_party/gvr-android-sdk:libgvr_config" ] configs += [ "//third_party/gvr-android-sdk:libgvr_config" ]
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/permissions/permission_update_infobar_delegate_android.h" #include "chrome/browser/permissions/permission_update_infobar_delegate_android.h"
#include "chrome/browser/ui/android/view_android_helper.h" #include "chrome/browser/ui/android/view_android_helper.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -30,7 +31,6 @@ ...@@ -30,7 +31,6 @@
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/common/referrer.h" #include "content/public/common/referrer.h"
#include "device/vr/features/features.h"
#include "jni/DownloadController_jni.h" #include "jni/DownloadController_jni.h"
#include "net/base/filename_util.h" #include "net/base/filename_util.h"
#include "net/traffic_annotation/network_traffic_annotation.h" #include "net/traffic_annotation/network_traffic_annotation.h"
...@@ -38,10 +38,6 @@ ...@@ -38,10 +38,6 @@
#include "ui/android/window_android.h" #include "ui/android/window_android.h"
#include "ui/base/page_transition_types.h" #include "ui/base/page_transition_types.h"
#if BUILDFLAG(ENABLE_VR)
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#endif // BUILDFLAG(ENABLE_VR)
using base::android::ConvertUTF8ToJavaString; using base::android::ConvertUTF8ToJavaString;
using base::android::JavaParamRef; using base::android::JavaParamRef;
using base::android::ScopedJavaLocalRef; using base::android::ScopedJavaLocalRef;
...@@ -223,11 +219,9 @@ void DownloadController::AcquireFileAccessPermission( ...@@ -223,11 +219,9 @@ void DownloadController::AcquireFileAccessPermission(
const DownloadControllerBase::AcquireFileAccessPermissionCallback& cb) { const DownloadControllerBase::AcquireFileAccessPermissionCallback& cb) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if BUILDFLAG(ENABLE_VR)
WebContents* web_contents = web_contents_getter.Run(); WebContents* web_contents = web_contents_getter.Run();
if (vr_shell::VrTabHelper::IsInVr(web_contents)) if (vr::VrTabHelper::IsInVr(web_contents))
return; return;
#endif
if (HasFileAccessPermission()) { if (HasFileAccessPermission()) {
BrowserThread::PostTask( BrowserThread::PostTask(
......
...@@ -13,12 +13,6 @@ ...@@ -13,12 +13,6 @@
#include "chrome/browser/android/banners/app_banner_manager_android.h" #include "chrome/browser/android/banners/app_banner_manager_android.h"
#include "chrome/browser/android/feature_utilities.h" #include "chrome/browser/android/feature_utilities.h"
#include "chrome/browser/android/hung_renderer_infobar_delegate.h" #include "chrome/browser/android/hung_renderer_infobar_delegate.h"
#include "device/vr/features/features.h"
#if BUILDFLAG(ENABLE_VR)
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#endif // BUILDFLAG(ENABLE_VR)
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/file_select_helper.h" #include "chrome/browser/file_select_helper.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
...@@ -33,6 +27,7 @@ ...@@ -33,6 +27,7 @@
#include "chrome/browser/ui/find_bar/find_notification_details.h" #include "chrome/browser/ui/find_bar/find_notification_details.h"
#include "chrome/browser/ui/find_bar/find_tab_helper.h" #include "chrome/browser/ui/find_bar/find_tab_helper.h"
#include "chrome/browser/ui/tab_helpers.h" #include "chrome/browser/ui/tab_helpers.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "components/app_modal/javascript_dialog_manager.h" #include "components/app_modal/javascript_dialog_manager.h"
...@@ -126,11 +121,9 @@ void TabWebContentsDelegateAndroid::LoadingStateChanged( ...@@ -126,11 +121,9 @@ void TabWebContentsDelegateAndroid::LoadingStateChanged(
void TabWebContentsDelegateAndroid::RunFileChooser( void TabWebContentsDelegateAndroid::RunFileChooser(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
const FileChooserParams& params) { const FileChooserParams& params) {
#if BUILDFLAG(ENABLE_VR) if (vr::VrTabHelper::IsInVr(
if (vr_shell::VrTabHelper::IsInVr(
WebContents::FromRenderFrameHost(render_frame_host))) WebContents::FromRenderFrameHost(render_frame_host)))
return; return;
#endif
FileSelectHelper::RunFileChooser(render_frame_host, params); FileSelectHelper::RunFileChooser(render_frame_host, params);
} }
...@@ -138,10 +131,8 @@ std::unique_ptr<BluetoothChooser> ...@@ -138,10 +131,8 @@ std::unique_ptr<BluetoothChooser>
TabWebContentsDelegateAndroid::RunBluetoothChooser( TabWebContentsDelegateAndroid::RunBluetoothChooser(
content::RenderFrameHost* frame, content::RenderFrameHost* frame,
const BluetoothChooser::EventHandler& event_handler) { const BluetoothChooser::EventHandler& event_handler) {
#if BUILDFLAG(ENABLE_VR) if (vr::VrTabHelper::IsInVr(WebContents::FromRenderFrameHost(frame)))
if (vr_shell::VrTabHelper::IsInVr(WebContents::FromRenderFrameHost(frame)))
return nullptr; return nullptr;
#endif
return base::MakeUnique<BluetoothChooserAndroid>(frame, event_handler); return base::MakeUnique<BluetoothChooserAndroid>(frame, event_handler);
} }
...@@ -271,11 +262,9 @@ void TabWebContentsDelegateAndroid::FindMatchRectsReply( ...@@ -271,11 +262,9 @@ void TabWebContentsDelegateAndroid::FindMatchRectsReply(
content::JavaScriptDialogManager* content::JavaScriptDialogManager*
TabWebContentsDelegateAndroid::GetJavaScriptDialogManager( TabWebContentsDelegateAndroid::GetJavaScriptDialogManager(
WebContents* source) { WebContents* source) {
#if BUILDFLAG(ENABLE_VR) if (vr::VrTabHelper::IsInVr(source)) {
if (vr_shell::VrTabHelper::IsInVr(source)) {
return nullptr; return nullptr;
} }
#endif
return app_modal::JavaScriptDialogManager::GetInstance(); return app_modal::JavaScriptDialogManager::GetInstance();
} }
...@@ -283,13 +272,11 @@ void TabWebContentsDelegateAndroid::RequestMediaAccessPermission( ...@@ -283,13 +272,11 @@ void TabWebContentsDelegateAndroid::RequestMediaAccessPermission(
content::WebContents* web_contents, content::WebContents* web_contents,
const content::MediaStreamRequest& request, const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) { const content::MediaResponseCallback& callback) {
#if BUILDFLAG(ENABLE_VR) if (vr::VrTabHelper::IsInVr(web_contents)) {
if (vr_shell::VrTabHelper::IsInVr(web_contents)) {
callback.Run(content::MediaStreamDevices(), callback.Run(content::MediaStreamDevices(),
content::MEDIA_DEVICE_NOT_SUPPORTED, nullptr); content::MEDIA_DEVICE_NOT_SUPPORTED, nullptr);
return; return;
} }
#endif
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
web_contents, request, callback, nullptr); web_contents, request, callback, nullptr);
} }
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "chrome/browser/android/vr_shell/vr_input_manager.h" #include "chrome/browser/android/vr_shell/vr_input_manager.h"
#include "chrome/browser/android/vr_shell/vr_shell_delegate.h" #include "chrome/browser/android/vr_shell/vr_shell_delegate.h"
#include "chrome/browser/android/vr_shell/vr_shell_gl.h" #include "chrome/browser/android/vr_shell/vr_shell_gl.h"
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#include "chrome/browser/android/vr_shell/vr_usage_monitor.h" #include "chrome/browser/android/vr_shell/vr_usage_monitor.h"
#include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
...@@ -35,6 +34,7 @@ ...@@ -35,6 +34,7 @@
#include "chrome/browser/vr/toolbar_helper.h" #include "chrome/browser/vr/toolbar_helper.h"
#include "chrome/browser/vr/ui_interface.h" #include "chrome/browser/vr/ui_interface.h"
#include "chrome/browser/vr/ui_scene_manager.h" #include "chrome/browser/vr/ui_scene_manager.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_controller.h"
...@@ -84,7 +84,7 @@ void SetIsInVR(content::WebContents* contents, bool is_in_vr) { ...@@ -84,7 +84,7 @@ void SetIsInVR(content::WebContents* contents, bool is_in_vr) {
// VrTabHelper for details). // VrTabHelper for details).
contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr); contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr);
VrTabHelper* vr_tab_helper = VrTabHelper::FromWebContents(contents); vr::VrTabHelper* vr_tab_helper = vr::VrTabHelper::FromWebContents(contents);
DCHECK(vr_tab_helper); DCHECK(vr_tab_helper);
vr_tab_helper->SetIsInVr(is_in_vr); vr_tab_helper->SetIsInVr(is_in_vr);
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "chrome/browser/media/router/media_router.h" #include "chrome/browser/media/router/media_router.h"
#include "chrome/browser/media/router/media_router_factory.h" #include "chrome/browser/media/router/media_router_factory.h"
#include "chrome/browser/media/router/presentation_request.h" #include "chrome/browser/media/router/presentation_request.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/common/media_router/media_source.h" #include "chrome/common/media_router/media_source.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -21,10 +22,6 @@ ...@@ -21,10 +22,6 @@
#include "device/vr/features/features.h" #include "device/vr/features/features.h"
#include "jni/ChromeMediaRouterDialogController_jni.h" #include "jni/ChromeMediaRouterDialogController_jni.h"
#if BUILDFLAG(ENABLE_VR)
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#endif // BUILDFLAG(ENABLE_VR)
DEFINE_WEB_CONTENTS_USER_DATA_KEY( DEFINE_WEB_CONTENTS_USER_DATA_KEY(
media_router::MediaRouterDialogControllerAndroid); media_router::MediaRouterDialogControllerAndroid);
...@@ -148,13 +145,11 @@ MediaRouterDialogControllerAndroid::~MediaRouterDialogControllerAndroid() { ...@@ -148,13 +145,11 @@ MediaRouterDialogControllerAndroid::~MediaRouterDialogControllerAndroid() {
} }
void MediaRouterDialogControllerAndroid::CreateMediaRouterDialog() { void MediaRouterDialogControllerAndroid::CreateMediaRouterDialog() {
#if BUILDFLAG(ENABLE_VR)
// TODO(crbug.com/736568): Re-enable dialog in VR. // TODO(crbug.com/736568): Re-enable dialog in VR.
if (vr_shell::VrTabHelper::IsInVr(initiator())) { if (vr::VrTabHelper::IsInVr(initiator())) {
CancelPresentationRequest(); CancelPresentationRequest();
return; return;
} }
#endif // BUILDFLAG(ENABLE_VR)
JNIEnv* env = base::android::AttachCurrentThread(); JNIEnv* env = base::android::AttachCurrentThread();
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h" #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h"
#include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h" #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/common/channel_info.h" #include "chrome/common/channel_info.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
...@@ -88,11 +89,6 @@ ...@@ -88,11 +89,6 @@
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
#endif #endif
#include "device/vr/features/features.h"
#if BUILDFLAG(ENABLE_VR)
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#endif // BUILDFLAG(ENABLE_VR)
using password_manager::ContentPasswordManagerDriverFactory; using password_manager::ContentPasswordManagerDriverFactory;
using password_manager::PasswordManagerInternalsService; using password_manager::PasswordManagerInternalsService;
using password_manager::PasswordManagerMetricsRecorder; using password_manager::PasswordManagerMetricsRecorder;
...@@ -216,12 +212,10 @@ bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage() ...@@ -216,12 +212,10 @@ bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage()
entry->GetURL().host_piece() != chrome::kChromeUIChromeSigninHost; entry->GetURL().host_piece() != chrome::kChromeUIChromeSigninHost;
} }
#if BUILDFLAG(ENABLE_VR)
// The password manager is disabled while VR (virtual reality) is being used, // The password manager is disabled while VR (virtual reality) is being used,
// as the use of conventional UI elements might harm the user experience in // as the use of conventional UI elements might harm the user experience in
// VR. // VR.
is_enabled = is_enabled && !vr_shell::VrTabHelper::IsInVr(web_contents()); is_enabled = is_enabled && !vr::VrTabHelper::IsInVr(web_contents());
#endif // BUILDFLAG(ENABLE_VR)
if (log_manager_->IsLoggingActive()) { if (log_manager_->IsLoggingActive()) {
password_manager::BrowserSavePasswordProgressLogger logger( password_manager::BrowserSavePasswordProgressLogger logger(
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/storage/durable_storage_permission_context.h" #include "chrome/browser/storage/durable_storage_permission_context.h"
#include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/common/features.h" #include "chrome/common/features.h"
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -34,10 +35,6 @@ ...@@ -34,10 +35,6 @@
#include "device/vr/features/features.h" #include "device/vr/features/features.h"
#include "ppapi/features/features.h" #include "ppapi/features/features.h"
#if BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID)
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#endif // BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID)
#if BUILDFLAG(ENABLE_PLUGINS) #if BUILDFLAG(ENABLE_PLUGINS)
#include "chrome/browser/plugins/flash_permission_context.h" #include "chrome/browser/plugins/flash_permission_context.h"
#endif #endif
...@@ -329,13 +326,11 @@ int PermissionManager::RequestPermissions( ...@@ -329,13 +326,11 @@ int PermissionManager::RequestPermissions(
content::WebContents* web_contents = content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host); content::WebContents::FromRenderFrameHost(render_frame_host);
#if BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID) if (vr::VrTabHelper::IsInVr(web_contents)) {
if (vr_shell::VrTabHelper::IsInVr(web_contents)) {
callback.Run( callback.Run(
std::vector<ContentSetting>(permissions.size(), CONTENT_SETTING_BLOCK)); std::vector<ContentSetting>(permissions.size(), CONTENT_SETTING_BLOCK));
return kNoPendingOperation; return kNoPendingOperation;
} }
#endif // BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID)
GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "chrome/browser/permissions/permission_request_manager.h" #include "chrome/browser/permissions/permission_request_manager.h"
#include "chrome/browser/permissions/permission_result.h" #include "chrome/browser/permissions/permission_result.h"
#include "chrome/browser/ui/permission_bubble/mock_permission_prompt_factory.h" #include "chrome/browser/ui/permission_bubble/mock_permission_prompt_factory.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
...@@ -19,18 +20,12 @@ ...@@ -19,18 +20,12 @@
#include "device/vr/features/features.h" #include "device/vr/features/features.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID)
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#endif // BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID)
using blink::mojom::PermissionStatus; using blink::mojom::PermissionStatus;
using content::PermissionType; using content::PermissionType;
namespace { namespace {
#if BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID)
int kNoPendingOperation = -1; int kNoPendingOperation = -1;
#endif // BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID)
class PermissionManagerTestingProfile final : public TestingProfile { class PermissionManagerTestingProfile final : public TestingProfile {
public: public:
...@@ -406,10 +401,9 @@ TEST_F(PermissionManagerTest, SubscribeMIDIPermission) { ...@@ -406,10 +401,9 @@ TEST_F(PermissionManagerTest, SubscribeMIDIPermission) {
GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id); GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id);
} }
#if BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID)
TEST_F(PermissionManagerTest, SuppressPermissionRequests) { TEST_F(PermissionManagerTest, SuppressPermissionRequests) {
content::WebContents* contents = web_contents(); content::WebContents* contents = web_contents();
vr_shell::VrTabHelper::CreateForWebContents(contents); vr::VrTabHelper::CreateForWebContents(contents);
NavigateAndCommit(url()); NavigateAndCommit(url());
SetPermission(CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_ALLOW); SetPermission(CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_ALLOW);
...@@ -420,8 +414,7 @@ TEST_F(PermissionManagerTest, SuppressPermissionRequests) { ...@@ -420,8 +414,7 @@ TEST_F(PermissionManagerTest, SuppressPermissionRequests) {
EXPECT_TRUE(callback_called()); EXPECT_TRUE(callback_called());
EXPECT_EQ(PermissionStatus::GRANTED, callback_result()); EXPECT_EQ(PermissionStatus::GRANTED, callback_result());
vr_shell::VrTabHelper* vr_tab_helper = vr::VrTabHelper* vr_tab_helper = vr::VrTabHelper::FromWebContents(contents);
vr_shell::VrTabHelper::FromWebContents(contents);
vr_tab_helper->SetIsInVr(true); vr_tab_helper->SetIsInVr(true);
EXPECT_EQ( EXPECT_EQ(
kNoPendingOperation, kNoPendingOperation,
...@@ -440,7 +433,6 @@ TEST_F(PermissionManagerTest, SuppressPermissionRequests) { ...@@ -440,7 +433,6 @@ TEST_F(PermissionManagerTest, SuppressPermissionRequests) {
EXPECT_TRUE(callback_called()); EXPECT_TRUE(callback_called());
EXPECT_EQ(PermissionStatus::GRANTED, callback_result()); EXPECT_EQ(PermissionStatus::GRANTED, callback_result());
} }
#endif // BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID)
TEST_F(PermissionManagerTest, PermissionIgnoredCleanup) { TEST_F(PermissionManagerTest, PermissionIgnoredCleanup) {
content::WebContents* contents = web_contents(); content::WebContents* contents = web_contents();
......
...@@ -9,14 +9,9 @@ ...@@ -9,14 +9,9 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "device/vr/features/features.h"
#if BUILDFLAG(ENABLE_VR)
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#endif // BUILDFLAG(ENABLE_VR)
#include "chrome/browser/ui/android/chrome_http_auth_handler.h" #include "chrome/browser/ui/android/chrome_http_auth_handler.h"
#include "chrome/browser/ui/android/view_android_helper.h" #include "chrome/browser/ui/android/view_android_helper.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "net/base/auth.h" #include "net/base/auth.h"
...@@ -56,12 +51,10 @@ class LoginHandlerAndroid : public LoginHandler { ...@@ -56,12 +51,10 @@ class LoginHandlerAndroid : public LoginHandler {
ViewAndroidHelper* view_helper = ViewAndroidHelper::FromWebContents( ViewAndroidHelper* view_helper = ViewAndroidHelper::FromWebContents(
web_contents); web_contents);
#if BUILDFLAG(ENABLE_VR) if (vr::VrTabHelper::IsInVr(web_contents)) {
if (vr_shell::VrTabHelper::IsInVr(web_contents)) {
CancelAuth(); CancelAuth();
return; return;
} }
#endif
// Notify WindowAndroid that HTTP authentication is required. // Notify WindowAndroid that HTTP authentication is required.
if (view_helper->GetViewAndroid() && if (view_helper->GetViewAndroid() &&
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "chrome/browser/ssl/ssl_client_certificate_selector.h" #include "chrome/browser/ssl/ssl_client_certificate_selector.h"
#include "chrome/browser/ui/android/view_android_helper.h" #include "chrome/browser/ui/android/view_android_helper.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/client_certificate_delegate.h"
#include "device/vr/features/features.h"
#include "jni/SSLClientCertificateRequest_jni.h" #include "jni/SSLClientCertificateRequest_jni.h"
#include "net/base/host_port_pair.h" #include "net/base/host_port_pair.h"
#include "net/cert/cert_database.h" #include "net/cert/cert_database.h"
...@@ -30,10 +30,6 @@ ...@@ -30,10 +30,6 @@
#include "ui/android/view_android.h" #include "ui/android/view_android.h"
#include "ui/android/window_android.h" #include "ui/android/window_android.h"
#if BUILDFLAG(ENABLE_VR)
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#endif // BUILDFLAG(ENABLE_VR)
using base::android::JavaParamRef; using base::android::JavaParamRef;
using base::android::ScopedJavaLocalRef; using base::android::ScopedJavaLocalRef;
...@@ -193,12 +189,11 @@ void ShowSSLClientCertificateSelector( ...@@ -193,12 +189,11 @@ void ShowSSLClientCertificateSelector(
net::SSLCertRequestInfo* cert_request_info, net::SSLCertRequestInfo* cert_request_info,
net::ClientCertIdentityList unused_client_certs, net::ClientCertIdentityList unused_client_certs,
std::unique_ptr<content::ClientCertificateDelegate> delegate) { std::unique_ptr<content::ClientCertificateDelegate> delegate) {
#if BUILDFLAG(ENABLE_VR) if (vr::VrTabHelper::IsInVr(contents)) {
if (vr_shell::VrTabHelper::IsInVr(contents)) {
delegate->ContinueWithCertificate(nullptr, nullptr); delegate->ContinueWithCertificate(nullptr, nullptr);
return; return;
} }
#endif // BUILDFLAG(ENABLE_VR)
ui::WindowAndroid* window = ViewAndroidHelper::FromWebContents(contents) ui::WindowAndroid* window = ViewAndroidHelper::FromWebContents(contents)
->GetViewAndroid()->GetWindowAndroid(); ->GetViewAndroid()->GetWindowAndroid();
DCHECK(window); DCHECK(window);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "chrome/browser/usb/usb_chooser_context.h" #include "chrome/browser/usb/usb_chooser_context.h"
#include "chrome/browser/usb/usb_chooser_context_factory.h" #include "chrome/browser/usb/usb_chooser_context_factory.h"
#include "chrome/browser/usb/web_usb_histograms.h" #include "chrome/browser/usb/web_usb_histograms.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "components/security_state/core/security_state.h" #include "components/security_state/core/security_state.h"
#include "components/url_formatter/elide_url.h" #include "components/url_formatter/elide_url.h"
...@@ -34,10 +35,6 @@ ...@@ -34,10 +35,6 @@
#include "ui/android/window_android.h" #include "ui/android/window_android.h"
#include "url/gurl.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::UsbDevice;
namespace { namespace {
...@@ -65,14 +62,13 @@ UsbChooserDialogAndroid::UsbChooserDialogAndroid( ...@@ -65,14 +62,13 @@ UsbChooserDialogAndroid::UsbChooserDialogAndroid(
weak_factory_(this) { weak_factory_(this) {
content::WebContents* web_contents = content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host_); content::WebContents::FromRenderFrameHost(render_frame_host_);
#if BUILDFLAG(ENABLE_VR) if (vr::VrTabHelper::IsInVr(web_contents)) {
if (vr_shell::VrTabHelper::IsInVr(web_contents)) {
DCHECK(!callback_.is_null()); DCHECK(!callback_.is_null());
callback_.Run(nullptr); callback_.Run(nullptr);
callback_.Reset(); // Reset |callback_| so that it is only run once. callback_.Reset(); // Reset |callback_| so that it is only run once.
return; return;
} }
#endif
device::UsbService* usb_service = device::UsbService* usb_service =
device::DeviceClient::Get()->GetUsbService(); device::DeviceClient::Get()->GetUsbService();
if (!usb_service) if (!usb_service)
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper.h" #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
#include "chrome/browser/ui/tab_dialogs.h" #include "chrome/browser/ui/tab_dialogs.h"
#include "chrome/browser/vr/vr_tab_helper.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/features.h" #include "chrome/common/features.h"
#include "components/autofill/content/browser/content_autofill_driver_factory.h" #include "components/autofill/content/browser/content_autofill_driver_factory.h"
...@@ -81,12 +82,6 @@ ...@@ -81,12 +82,6 @@
#include "chrome/browser/android/offline_pages/recent_tab_helper.h" #include "chrome/browser/android/offline_pages/recent_tab_helper.h"
#include "chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.h" #include "chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.h"
#include "chrome/browser/android/voice_search_tab_helper.h" #include "chrome/browser/android/voice_search_tab_helper.h"
#include "device/vr/features/features.h" // nogncheck
#if BUILDFLAG(ENABLE_VR)
#include "chrome/browser/android/vr_shell/vr_tab_helper.h"
#endif // BUILDFLAG(ENABLE_VR)
#include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h"
#include "chrome/browser/ui/android/context_menu_helper.h" #include "chrome/browser/ui/android/context_menu_helper.h"
#include "chrome/browser/ui/android/view_android_helper.h" #include "chrome/browser/ui/android/view_android_helper.h"
...@@ -228,6 +223,7 @@ void TabHelpers::AttachTabHelpers( ...@@ -228,6 +223,7 @@ void TabHelpers::AttachTabHelpers(
// TODO(vabr): Remove TabSpecificContentSettings from here once their function // TODO(vabr): Remove TabSpecificContentSettings from here once their function
// is taken over by ChromeContentSettingsClient. http://crbug.com/387075 // is taken over by ChromeContentSettingsClient. http://crbug.com/387075
TabSpecificContentSettings::CreateForWebContents(web_contents); TabSpecificContentSettings::CreateForWebContents(web_contents);
vr::VrTabHelper::CreateForWebContents(web_contents);
// NO! Do not just add your tab helper here. This is a large alphabetized // NO! Do not just add your tab helper here. This is a large alphabetized
// block; please insert your tab helper above in alphabetical order. // block; please insert your tab helper above in alphabetical order.
...@@ -246,11 +242,6 @@ void TabHelpers::AttachTabHelpers( ...@@ -246,11 +242,6 @@ void TabHelpers::AttachTabHelpers(
SingleTabModeTabHelper::CreateForWebContents(web_contents); SingleTabModeTabHelper::CreateForWebContents(web_contents);
ViewAndroidHelper::CreateForWebContents(web_contents); ViewAndroidHelper::CreateForWebContents(web_contents);
VoiceSearchTabHelper::CreateForWebContents(web_contents); VoiceSearchTabHelper::CreateForWebContents(web_contents);
#if BUILDFLAG(ENABLE_VR)
vr_shell::VrTabHelper::CreateForWebContents(web_contents);
#endif
#else #else
BookmarkTabHelper::CreateForWebContents(web_contents); BookmarkTabHelper::CreateForWebContents(web_contents);
extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
......
...@@ -2,19 +2,17 @@ ...@@ -2,19 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/android/vr_shell/vr_tab_helper.h" #include "chrome/browser/vr/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/browser/render_view_host.h"
#include "content/public/common/web_preferences.h" #include "content/public/common/web_preferences.h"
#include "device/vr/android/gvr/gvr_delegate_provider.h"
using content::WebContents; using content::WebContents;
using content::WebPreferences; using content::WebPreferences;
DEFINE_WEB_CONTENTS_USER_DATA_KEY(vr_shell::VrTabHelper); DEFINE_WEB_CONTENTS_USER_DATA_KEY(vr::VrTabHelper);
namespace vr_shell { namespace vr {
VrTabHelper::VrTabHelper(content::WebContents* contents) VrTabHelper::VrTabHelper(content::WebContents* contents)
: web_contents_(contents) {} : web_contents_(contents) {}
...@@ -44,4 +42,4 @@ bool VrTabHelper::IsInVr(content::WebContents* contents) { ...@@ -44,4 +42,4 @@ bool VrTabHelper::IsInVr(content::WebContents* contents) {
return vr_tab_helper->is_in_vr(); return vr_tab_helper->is_in_vr();
} }
} // namespace vr_shell } // namespace vr
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_TAB_HELPER_H_ #ifndef CHROME_BROWSER_VR_VR_TAB_HELPER_H_
#define CHROME_BROWSER_ANDROID_VR_SHELL_VR_TAB_HELPER_H_ #define CHROME_BROWSER_VR_VR_TAB_HELPER_H_
#include "base/macros.h" #include "base/macros.h"
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
namespace vr_shell { namespace vr {
class VrTabHelper : public content::WebContentsUserData<VrTabHelper> { class VrTabHelper : public content::WebContentsUserData<VrTabHelper> {
public: public:
...@@ -33,6 +33,6 @@ class VrTabHelper : public content::WebContentsUserData<VrTabHelper> { ...@@ -33,6 +33,6 @@ class VrTabHelper : public content::WebContentsUserData<VrTabHelper> {
DISALLOW_COPY_AND_ASSIGN(VrTabHelper); DISALLOW_COPY_AND_ASSIGN(VrTabHelper);
}; };
} // namespace vr_shell } // namespace vr
#endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_TAB_HELPER_H_ #endif // CHROME_BROWSER_VR_VR_TAB_HELPER_H_
...@@ -179,6 +179,7 @@ WebPreferences::WebPreferences() ...@@ -179,6 +179,7 @@ WebPreferences::WebPreferences()
animation_policy(IMAGE_ANIMATION_POLICY_ALLOWED), animation_policy(IMAGE_ANIMATION_POLICY_ALLOWED),
user_gesture_required_for_presentation(true), user_gesture_required_for_presentation(true),
text_track_margin_percentage(0.0f), text_track_margin_percentage(0.0f),
page_popups_suppressed(false),
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
text_autosizing_enabled(true), text_autosizing_enabled(true),
font_scale_factor(1.0f), font_scale_factor(1.0f),
...@@ -205,7 +206,6 @@ WebPreferences::WebPreferences() ...@@ -205,7 +206,6 @@ WebPreferences::WebPreferences()
video_rotate_to_fullscreen_enabled(false), video_rotate_to_fullscreen_enabled(false),
video_fullscreen_detection_enabled(false), video_fullscreen_detection_enabled(false),
embedded_media_experience_enabled(false), embedded_media_experience_enabled(false),
page_popups_suppressed(false),
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
default_minimum_page_scale_factor(0.25f), default_minimum_page_scale_factor(0.25f),
......
...@@ -215,6 +215,8 @@ struct CONTENT_EXPORT WebPreferences { ...@@ -215,6 +215,8 @@ struct CONTENT_EXPORT WebPreferences {
// Cues will not be placed in this margin area. // Cues will not be placed in this margin area.
float text_track_margin_percentage; float text_track_margin_percentage;
bool page_popups_suppressed;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
bool text_autosizing_enabled; bool text_autosizing_enabled;
float font_scale_factor; float font_scale_factor;
...@@ -251,7 +253,6 @@ struct CONTENT_EXPORT WebPreferences { ...@@ -251,7 +253,6 @@ struct CONTENT_EXPORT WebPreferences {
// If enabled, video fullscreen detection will be enabled. // If enabled, video fullscreen detection will be enabled.
bool video_fullscreen_detection_enabled; bool video_fullscreen_detection_enabled;
bool embedded_media_experience_enabled; bool embedded_media_experience_enabled;
bool page_popups_suppressed;
#else // defined(OS_ANDROID) #else // defined(OS_ANDROID)
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment