[M108 Migration] Enable ScreenOrientationDelegate for EFL 83/287183/4
authorayush.k123 <ayush.k123@samsung.com>
Mon, 23 Jan 2023 10:16:57 +0000 (15:46 +0530)
committerBot Blink <blinkbot@samsung.com>
Tue, 24 Jan 2023 09:17:18 +0000 (09:17 +0000)
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 <ayush.k123@samsung.com>
content/browser/browser_main_loop.cc
content/browser/browser_main_loop.h
content/public/common/content_switches.cc
content/public/common/content_switches.h
tizen_src/chromium_impl/content/browser/screen_orientation/screen_orientation_delegate_efl.cc

index 28a7e2b..eedf4ba 100644 (file)
 #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<ScreenOrientationDelegateEfl>();
+  }
+#endif
+
   if (UsingInProcessGpu()) {
     // Make sure to limits for skia font cache are applied for in process
     // gpu setup (crbug.com/1183230).
index b2660cd..5e2ef10 100644 (file)
@@ -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<ScreenlockMonitor> screenlock_monitor_;
   // Per-process listener for online state changes.
   std::unique_ptr<BrowserOnlineStateObserver> 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<ScreenOrientationDelegate> screen_orientation_delegate_;
 #endif
 
index f42b7c2..310961b 100644 (file)
@@ -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";
index 6f44b6a..e3e3ddf 100644 (file)
@@ -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)
index 4fcddbf..a1dabf7 100644 (file)
@@ -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() {