diff --git a/libcef/browser/alloy/alloy_content_browser_client.cc b/libcef/browser/alloy/alloy_content_browser_client.cc index 0497e985b99bad6e12fccb1a0c742c40b760d8e1..d9c3c8245789fbbfc520fdf96743dba9d9ab8183 100644 --- a/libcef/browser/alloy/alloy_content_browser_client.cc +++ b/libcef/browser/alloy/alloy_content_browser_client.cc @@ -179,6 +179,7 @@ #include "base/files/file_util.h" #include "base/logging.h" #include "base/timer/timer.h" +#include "base/ohos/sys_info_utils.h" #include "components/autofill/content/browser/content_autofill_driver_factory.h" #include "content/public/browser/file_url_loader.h" #include "content/public/browser/shared_cors_origin_access_list.h" @@ -187,7 +188,6 @@ #include "libcef/browser/alloy/alloy_ssl_platform_key.h" #include "libcef/browser/net_service/restrict_cookie_manager.h" #include "libcef/browser/printing/ohos_print_manager.h" -#include "ohos_adapter_helper.h" #include "third_party/boringssl/src/include/openssl/evp.h" #endif @@ -2696,11 +2696,7 @@ bool AlloyContentBrowserClient::ConfigureNetworkContextParams( // this is currently not the case and this was not required pre M84. network_context_params->require_network_isolation_key = false; #if defined(OHOS_CACHE) - auto& system_properties_adapter = OHOS::NWeb::OhosAdapterHelper::GetInstance() - .GetSystemPropertiesInstance(); - OHOS::NWeb::ProductDeviceType deviceType = - system_properties_adapter.GetProductDeviceType(); - if (deviceType == OHOS::NWeb::ProductDeviceType::DEVICE_TYPE_MOBILE) { + if (base::ohos::IsMobileDevice()) { if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kForBrowser)) { // In order to make better use of cache, we use the same strategy as diff --git a/libcef/browser/net_service/cookie_manager_ohos_impl.cc b/libcef/browser/net_service/cookie_manager_ohos_impl.cc index 49b3ccd9c3823cf377d4794253207d978cdcf794..dc267eaaaf78419996c7b03a4c30a635bcfed337 100644 --- a/libcef/browser/net_service/cookie_manager_ohos_impl.cc +++ b/libcef/browser/net_service/cookie_manager_ohos_impl.cc @@ -19,6 +19,7 @@ #include "base/functional/bind.h" #include "base/logging.h" +#include "base/ohos/sys_info_utils.h" #include "base/path_service.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread_restrictions.h" @@ -31,7 +32,6 @@ #include "net/cookies/cookie_monster.h" #include "net/cookies/cookie_util.h" -#include "ohos_adapter_helper.h" #include "services/network/cookie_access_delegate_impl.h" #include "services/network/cookie_manager.h" @@ -196,7 +196,7 @@ net::CookieStore* CefCookieManagerImpl::GetCookieStore() { if (!cookie_store_) { content::CookieStoreConfig cookie_config( cookie_store_path_, /* restore_old_session_cookies= */ true, - /* persist_session_cookies= */ !is_pc_device_); + /* persist_session_cookies= */ !base::ohos::IsPcDevice()); cookie_config.client_task_runner = cookie_store_task_runner_; cookie_config.background_task_runner = cookie_store_backend_thread_.task_runner(); @@ -278,15 +278,6 @@ CefCookieManagerImpl::CefCookieManagerImpl() base::PathService::Get(base::DIR_CACHE, &cookie_store_path_); cookie_store_path_ = cookie_store_path_.Append("Cookies"); - - auto& system_properties_adapter = - OHOS::NWeb::OhosAdapterHelper::GetInstance().GetSystemPropertiesInstance(); - OHOS::NWeb::ProductDeviceType deviceType = - system_properties_adapter.GetProductDeviceType(); - is_pc_device_ = - deviceType == OHOS::NWeb::ProductDeviceType::DEVICE_TYPE_TABLET || - deviceType == OHOS::NWeb::ProductDeviceType::DEVICE_TYPE_2IN1; - LOG(DEBUG) << "cookie is_pc_device:" << is_pc_device_ << "database path: " << cookie_store_path_.MaybeAsASCII(); } void CefCookieManagerImpl::Initialize( diff --git a/libcef/browser/net_service/cookie_manager_ohos_impl.h b/libcef/browser/net_service/cookie_manager_ohos_impl.h index 8d13fdf559469f64149be75200710c71cc43ecef..00f66ccbae7f99b0137a64914fa120ed7bc4987c 100644 --- a/libcef/browser/net_service/cookie_manager_ohos_impl.h +++ b/libcef/browser/net_service/cookie_manager_ohos_impl.h @@ -170,8 +170,6 @@ class CefCookieManagerImpl : public CefCookieManager { std::queue tasks_; - bool is_pc_device_ = false; - mojo::Remote network_cookie_manager_; IMPLEMENT_REFCOUNTING(CefCookieManagerImpl); diff --git a/libcef/browser/net_service/incognito_cookie_manager_ohos_impl.cc b/libcef/browser/net_service/incognito_cookie_manager_ohos_impl.cc index ff2091639539d62054ff4d105bcd10bfa7c20195..e3020530930ae21b8ffa4d6abe4437c6b1b448b6 100644 --- a/libcef/browser/net_service/incognito_cookie_manager_ohos_impl.cc +++ b/libcef/browser/net_service/incognito_cookie_manager_ohos_impl.cc @@ -19,6 +19,7 @@ #include "base/functional/bind.h" #include "base/logging.h" +#include "base/ohos/sys_info_utils.h" #include "base/path_service.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread_restrictions.h" @@ -31,7 +32,6 @@ #include "net/cookies/cookie_monster.h" #include "net/cookies/cookie_util.h" -#include "ohos_adapter_helper.h" #include "services/network/cookie_access_delegate_impl.h" #include "services/network/cookie_manager.h" @@ -302,17 +302,6 @@ CefIncognitoCookieManagerImpl::CefIncognitoCookieManagerImpl() cookie_store_task_thread_.Start(); cookie_store_backend_thread_.Start(); cookie_store_task_runner_ = cookie_store_task_thread_.task_runner(); - - auto& system_properties_adapter = - OHOS::NWeb::OhosAdapterHelper::GetInstance(). - GetSystemPropertiesInstance(); - OHOS::NWeb::ProductDeviceType deviceType = - system_properties_adapter.GetProductDeviceType(); - is_pc_device_ = - deviceType == OHOS::NWeb::ProductDeviceType::DEVICE_TYPE_TABLET || - deviceType == OHOS::NWeb::ProductDeviceType::DEVICE_TYPE_2IN1; - LOG(DEBUG) << "cookie is_pc_device:" << is_pc_device_ << "database path: " - << cookie_store_path_.MaybeAsASCII(); } void CefIncognitoCookieManagerImpl::Initialize( diff --git a/libcef/browser/net_service/incognito_cookie_manager_ohos_impl.h b/libcef/browser/net_service/incognito_cookie_manager_ohos_impl.h index df011c2a73027f4d6f2bfb0e76719bf7f2e9350a..e2e457afb51a384d4089814e5a07052ab8f01b86 100644 --- a/libcef/browser/net_service/incognito_cookie_manager_ohos_impl.h +++ b/libcef/browser/net_service/incognito_cookie_manager_ohos_impl.h @@ -170,8 +170,6 @@ class CefIncognitoCookieManagerImpl : public CefCookieManager { std::queue tasks_; - bool is_pc_device_ = false; - mojo::Remote network_cookie_manager_; IMPLEMENT_REFCOUNTING(CefIncognitoCookieManagerImpl); diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index 97b1f82a0aab2de87eec2b5ec32d8a490c700b99..e17d2ac14e0ffb7f9c2c909df75dd01c53261516 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -60,6 +60,7 @@ #endif #if BUILDFLAG(IS_OHOS) +#include "base/ohos/sys_info_utils.h" #include "content/browser/renderer_host/render_view_host_delegate_view.h" #include "res_sched_client_adapter.h" #include "services/device/public/mojom/screen_orientation.mojom.h" @@ -260,13 +261,6 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( pinch_zoom_enabled_(content::IsPinchToZoomEnabled()), mouse_wheel_phase_handler_(this), gesture_provider_(CreateGestureProviderConfig(), this), -#if BUILDFLAG(IS_OHOS) - device_type_(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - ::switches::kOhosDeviceType)), - requires_double_tap_gesture_events_( - device_type_ == ::switches::kOhosTabletDevice || - device_type_ == ::switches::kOhosMobileDevice), -#endif weak_ptr_factory_(this) { DCHECK(render_widget_host_); DCHECK(!render_widget_host_->GetView()); @@ -370,7 +364,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( #if BUILDFLAG(IS_OHOS) gesture_provider_.SetDoubleTapSupportForPlatformEnabled( - requires_double_tap_gesture_events_); + base::ohos::IsTabletDevice() || base::ohos::IsMobileDevice()); #endif } @@ -2237,7 +2231,7 @@ void CefRenderWidgetHostViewOSR::SendGestureEvent( #if BUILDFLAG(IS_OHOS) bool CefRenderWidgetHostViewOSR::RequiresDoubleTapGestureEvents() const { - return requires_double_tap_gesture_events_; + return base::ohos::IsTabletDevice() || base::ohos::IsMobileDevice(); } #endif diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index c6268afd4e7eb9709ec4d0348dc8a8859ee56f11..b1dde74ee0b070c202d04d9641f0402fd2c7fcaa 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -581,9 +581,6 @@ class CefRenderWidgetHostViewOSR bool is_mouse_locked_ = false; - std::string device_type_; - bool requires_double_tap_gesture_events_ = false; - #if defined(OHOS_PERFORMANCE_JITTER) base::circular_deque gesture_event_queue_;