From ec2996083e51a9e3874fe71eaae59e2b2a7ab4c3 Mon Sep 17 00:00:00 2001 From: "ayush.k123" Date: Mon, 23 Jan 2023 15:46:57 +0530 Subject: [PATCH] [M108 Migration] Enable ScreenOrientationDelegate for EFL ScreenOrientationDelegate is needed for fixing tct-screenorientation-w3c-tests failures on M108. Reference: https://review.tizen.org/gerrit/c/274262/ Change-Id: I08d37b9c5c40a551971a79df6b0938300d38d25e Signed-off-by: Ayush Kumar --- content/browser/browser_main_loop.cc | 14 ++++++++++++++ content/browser/browser_main_loop.h | 6 +++--- content/public/common/content_switches.cc | 5 +++++ content/public/common/content_switches.h | 4 ++++ .../screen_orientation/screen_orientation_delegate_efl.cc | 8 +++----- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 28a7e2b..eedf4ba 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -242,6 +242,10 @@ #include "mojo/public/cpp/bindings/lib/test_random_mojo_delays.h" #endif +#if BUILDFLAG(IS_EFL) +#include "content/browser/screen_orientation/screen_orientation_delegate_efl.h" +#endif + // One of the linux specific headers defines this as a macro. #ifdef DestroyAll #undef DestroyAll @@ -713,6 +717,16 @@ void BrowserMainLoop::PostCreateMainMessageLoop() { base::trace_event::CPUFreqMonitor::GetInstance()); #endif +#if BUILDFLAG(IS_EFL) + if (!parsed_command_line_.HasSwitch( + switches::kDisableScreenOrientationLock)) { + TRACE_EVENT0("startup", + "BrowserMainLoop::Subsystem:ScreenOrientationProvider"); + screen_orientation_delegate_ = + std::make_unique(); + } +#endif + if (UsingInProcessGpu()) { // Make sure to limits for skia font cache are applied for in process // gpu setup (crbug.com/1183230). diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h index b2660cd..5e2ef10 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h @@ -102,7 +102,7 @@ namespace responsiveness { class Watcher; } // namespace responsiveness -#if BUILDFLAG(IS_ANDROID) +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_EFL) class ScreenOrientationDelegate; #endif @@ -326,8 +326,8 @@ class CONTENT_EXPORT BrowserMainLoop { std::unique_ptr screenlock_monitor_; // Per-process listener for online state changes. std::unique_ptr online_state_observer_; -#if BUILDFLAG(IS_ANDROID) - // Android implementation of ScreenOrientationDelegate +#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_EFL) + // Android/EFL implementation of ScreenOrientationDelegate std::unique_ptr screen_orientation_delegate_; #endif diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index f42b7c2..310961b 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -985,6 +985,11 @@ const char kRendererWaitForJavaDebugger[] = "renderer-wait-for-java-debugger"; const char kDisableOoprDebugCrashDump[] = "disable-oopr-debug-crash-dump"; #endif +#if BUILDFLAG(IS_EFL) +// Disable the locking feature of the screen orientation API. +const char kDisableScreenOrientationLock[] = "disable-screen-orientation-lock"; +#endif + // Enable the aggressive flushing of DOM Storage to minimize data loss. const char kEnableAggressiveDOMStorageFlushing[] = "enable-aggressive-domstorage-flushing"; diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 6f44b6a..e3e3ddf 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -267,6 +267,10 @@ CONTENT_EXPORT extern const char kRemoteDebuggingSocketName[]; CONTENT_EXPORT extern const char kRendererWaitForJavaDebugger[]; #endif +#if BUILDFLAG(IS_EFL) +CONTENT_EXPORT extern const char kDisableScreenOrientationLock[]; +#endif + // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete. #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) diff --git a/tizen_src/chromium_impl/content/browser/screen_orientation/screen_orientation_delegate_efl.cc b/tizen_src/chromium_impl/content/browser/screen_orientation/screen_orientation_delegate_efl.cc index 4fcddbf..a1dabf7 100644 --- a/tizen_src/chromium_impl/content/browser/screen_orientation/screen_orientation_delegate_efl.cc +++ b/tizen_src/chromium_impl/content/browser/screen_orientation/screen_orientation_delegate_efl.cc @@ -5,18 +5,16 @@ #include "content/browser/screen_orientation/screen_orientation_delegate_efl.h" -#include "chromium_impl/content/browser/web_contents/web_contents_impl_efl.h" +#include "content/browser/web_contents/web_contents_impl_efl.h" +#include "content/browser/screen_orientation/screen_orientation_provider.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" #include "ewk/efl_integration/web_contents_efl_delegate_ewk.h" namespace content { -ScreenOrientationDelegate* CreateScreenOrientationDelegateEfl() { - return new ScreenOrientationDelegateEfl(); -} - ScreenOrientationDelegateEfl::ScreenOrientationDelegateEfl() { + ScreenOrientationProvider::SetDelegate(this); } ScreenOrientationDelegateEfl::~ScreenOrientationDelegateEfl() { -- 2.7.4