1diff --git a/.gitattributes b/.gitattributes 2index 621f7d35b0..7708cf565b 100644 3--- a/.gitattributes 4+++ b/.gitattributes 5@@ -1,49 +1,16 @@ 6-src/native_client/toolchain/.tars/package_archives/toolchain.tar.bz2/04a77d2e2d6e814a6a5efd66de14142bb4c37c61.tar.bz2 filter=lfs diff=lfs merge=lfs -text 7 src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ filter=lfs diff=lfs merge=lfs -text 8 src/third_party/jdk/current/lib/src.zip filter=lfs diff=lfs merge=lfs -text 9-src/third_party/instrumented_libraries/binaries/msan-chained-origins-trusty.tgz filter=lfs diff=lfs merge=lfs -text 10-src/third_party/node/linux/node-linux-x64/bin/node filter=lfs diff=lfs merge=lfs -text 11-.cipd/pkgs/215/iC6RDM5EH3GEAzR-1shW_Mg0FeeNE5shq1okkFfuuNQC/lib/android-all-10-robolectric-5803371.jar filter=lfs diff=lfs merge=lfs -text 12 src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang filter=lfs diff=lfs merge=lfs -text 13 src/third_party/jdk/extras/java_8/jre/lib/rt.jar filter=lfs diff=lfs merge=lfs -text 14-src/third_party/swiftshader/tests/regres/testlists/vk-master-NOT_SUPPORTED.txt filter=lfs diff=lfs merge=lfs -text 15-.cipd/pkgs/134/87169fbc701d244c311e6aa8843591a7f1710bc0/lib/libart-compiler.so filter=lfs diff=lfs merge=lfs -text 16 src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-cl filter=lfs diff=lfs merge=lfs -text 17 src/third_party/llvm-build/Release+Asserts/bin/clang filter=lfs diff=lfs merge=lfs -text 18-.cipd/pkgs/199/no8ss5nRg6uYDM08HboypuIQuix7bS1kVqRGyWmwP-YC/android_system.jar filter=lfs diff=lfs merge=lfs -text 19 src/third_party/android_ndk/prebuilt/linux-x86_64/bin/gdb-orig filter=lfs diff=lfs merge=lfs -text 20 src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/lib64/libclang.so.11git filter=lfs diff=lfs merge=lfs -text 21-src/third_party/angle/third_party/VK-GL-CTS/src/android/cts/master/vk-master.txt filter=lfs diff=lfs merge=lfs -text 22-src/third_party/angle/third_party/VK-GL-CTS/src/external/vulkancts/mustpass/master/vk-default.txt filter=lfs diff=lfs merge=lfs -text 23-.cipd/pkgs/215/iC6RDM5EH3GEAzR-1shW_Mg0FeeNE5shq1okkFfuuNQC/lib/android-all-5.0.2_r3-robolectric-r0.jar filter=lfs diff=lfs merge=lfs -text 24-.cipd/pkgs/134/87169fbc701d244c311e6aa8843591a7f1710bc0/lib/libart.so filter=lfs diff=lfs merge=lfs -text 25 src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/lib64/liblldb.so filter=lfs diff=lfs merge=lfs -text 26 src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/lib64/liblldb.so.11git filter=lfs diff=lfs merge=lfs -text 27-src/third_party/android_build_tools/aapt2/aapt2 filter=lfs diff=lfs merge=lfs -text 28-src/third_party/swiftshader/tests/regres/testlists/vk-master.txt filter=lfs diff=lfs merge=lfs -text 29-src/third_party/depot_tools/.cipd_bin/compiler_proxy filter=lfs diff=lfs merge=lfs -text 30-src/chrome/test/data/xr/webvr_info/samples/media/textures/vr_bench_man.mp4 filter=lfs diff=lfs merge=lfs -text 31-.cipd/pkgs/215/iC6RDM5EH3GEAzR-1shW_Mg0FeeNE5shq1okkFfuuNQC/lib/android-all-8.1.0-robolectric-4611349.jar filter=lfs diff=lfs merge=lfs -text 32 src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/lib64/libclang_cxx.so.11git filter=lfs diff=lfs merge=lfs -text 33 src/third_party/jdk/current/lib/modules filter=lfs diff=lfs merge=lfs -text 34-.cipd/pkgs/215/iC6RDM5EH3GEAzR-1shW_Mg0FeeNE5shq1okkFfuuNQC/lib/android-all-9-robolectric-4913185-2.jar filter=lfs diff=lfs merge=lfs -text 35-.cipd/pkgs/215/iC6RDM5EH3GEAzR-1shW_Mg0FeeNE5shq1okkFfuuNQC/lib/android-all-8.0.0_r4-robolectric-r1.jar filter=lfs diff=lfs merge=lfs -text 36-.cipd/pkgs/134/87169fbc701d244c311e6aa8843591a7f1710bc0/lib/libartd-compiler.so filter=lfs diff=lfs merge=lfs -text 37 src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/lib/python3.8/site-packages/lldb/_lldb.so filter=lfs diff=lfs merge=lfs -text 38 src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/lib64/libLLVM-11git.so filter=lfs diff=lfs merge=lfs -text 39 src/third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/lib64/liblldb.so.11.0.5git filter=lfs diff=lfs merge=lfs -text 40 src/third_party/android_sdk/public/emulator/lib64/qt/lib/libQt5WebEngineCoreAndroidEmu.so.5 filter=lfs diff=lfs merge=lfs -text 41-src/third_party/instrumented_libraries/binaries/msan-no-origins-trusty.tgz filter=lfs diff=lfs merge=lfs -text 42-src/third_party/catapult/tracing/test_data/theverge_trace.json filter=lfs diff=lfs merge=lfs -text 43-.cipd/pkgs/215/iC6RDM5EH3GEAzR-1shW_Mg0FeeNE5shq1okkFfuuNQC/lib/android-all-7.1.0_r7-robolectric-r1.jar filter=lfs diff=lfs merge=lfs -text 44-src/ohos_ndk/toolchains/llvm/bin/lld filter=lfs diff=lfs merge=lfs -text 45-src/ohos_ndk/toolchains/llvm/bin/clang-check filter=lfs diff=lfs merge=lfs -text 46-src/ohos_ndk/toolchains/llvm/lib/libLLVM-10.so filter=lfs diff=lfs merge=lfs -text 47-src/ohos_ndk/toolchains/llvm/lib/libLTO.so.10 filter=lfs diff=lfs merge=lfs -text 48-src/ohos_ndk/toolchains/llvm/lib/libclang.so.10 filter=lfs diff=lfs merge=lfs -text 49-src/ohos_ndk/toolchains/llvm/lib/liblldb.so.10.0.1 filter=lfs diff=lfs merge=lfs -text 50-src/ohos_ndk/toolchains/llvm/lib/libclang-cpp.so.10 filter=lfs diff=lfs merge=lfs -text 51-src/ohos_ndk/toolchains/llvm/bin/clang-10 filter=lfs diff=lfs merge=lfs -text 52-src/ohos_ndk_aosp/toolchains/clang-r353983c/bin/clang-9 filter=lfs diff=lfs merge=lfs -text 53-src/ohos_ndk_aosp/toolchains/clang-r353983c/lib64/libclang_cxx.so.9svn filter=lfs diff=lfs merge=lfs -text 54-src/ohos_ndk_aosp/toolchains/clang-r353983c/lib64/libclang.so.9svn filter=lfs diff=lfs merge=lfs -text 55diff --git a/build.sh b/build.sh 56index 688aef5277..26544c1d10 100755 57--- a/build.sh 58+++ b/build.sh 59@@ -35,11 +35,11 @@ buildargs=" 60 enable_one_click_signin=true 61 enable_message_center=true 62 enable_offline_pages=false 63- use_musl=false 64+ use_musl=true 65 safe_browsing_mode=0 66 use_custom_libcxx=false 67 use_sysroot=false 68- product_name=\"wgr\" 69+ product_name=\"rk3568\" 70 " 71 #Add build args end 72 73diff --git a/build_all.sh b/build_all.sh 74index 17ad944046..ac141cb056 100755 75--- a/build_all.sh 76+++ b/build_all.sh 77@@ -5,7 +5,7 @@ basedir=`pwd` 78 echo "basedir = $basedir" 79 nweb_base=$basedir/openharmony/third_party/webview_chromium 80 harmony_base=$basedir/openharmony 81-ohos_nweb_path=$harmony_base/foundation/web/webview 82+ohos_nweb_path=$harmony_base/base/web/webview 83 84 archieve_nweb_base=$basedir/binary/webview 85 archieve_harmony_base=$basedir/binary/harmony 86diff --git a/gen_ohos_ndk.sh b/gen_ohos_ndk.sh 87index f9d215b7f8..a12c94d9ef 100755 88--- a/gen_ohos_ndk.sh 89+++ b/gen_ohos_ndk.sh 90@@ -66,6 +66,9 @@ declare -A src_ohos_includes=( 91 ["location_request_config"]="base/location/location_common/common/include/" 92 ["system_ability"]="foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include/" 93 ["accesstoken"]="base/security/access_token/interfaces/innerkits/accesstoken/include/" 94+ ["aafwk"]="foundation/aafwk/standard/interfaces/innerkits/" 95+ ["json"]="third_party/json/include/" 96+ ["appexecfwk"]="foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include" 97 ) 98 99 src_ohos_libs=( 100@@ -80,6 +83,12 @@ src_ohos_libs=( 101 liblocator_sdk.z.so 102 liblbsservice_common.z.so 103 libaccesstoken_sdk.z.so 104+ libapp_manager.z.so 105+ libbase.z.so 106+ libwant.z.so 107+ libappexecfwk_common.z.so 108+ libappexecfwk_base.z.so 109+ libsamgr_proxy.z.so 110 ) 111 112 target_includes_dir="includes" 113diff --git a/src/build/config/ohos/BUILD.gn b/src/build/config/ohos/BUILD.gn 114index 534f0020d7..881d941065 100644 115--- a/src/build/config/ohos/BUILD.gn 116+++ b/src/build/config/ohos/BUILD.gn 117@@ -131,12 +131,12 @@ config("runtime_library") { 118 } 119 if (use_musl) { 120 ldflags += [ 121- "-L" + rebase_path("$ohos_sysroot/usr/lib/arm-linux-ohosmusl", root_build_dir), 122- "-L" + rebase_path("$ohos_toolchain_root/lib/arm-linux-ohosmusl/c++", root_build_dir), 123- "-L" + rebase_path("$ohos_toolchain_root/lib/clang/10.0.1/lib/arm-linux-ohosmusl", root_build_dir), 124+ "-L" + rebase_path("$ohos_sysroot/usr/lib/arm-linux-ohos", root_build_dir), 125+ "-L" + rebase_path("$ohos_toolchain_root/lib/arm-linux-ohos/c++", root_build_dir), 126+ "-L" + rebase_path("$ohos_toolchain_root/lib/clang/10.0.1/lib/arm-linux-ohos", root_build_dir), 127 ] 128- ldflags += [ "-Wl,--dynamic-linker,/system/bin/ld-musl-arm.so.1" ] 129- libclang_rt_file = "$ohos_toolchain_root/lib/clang/10.0.1/lib/arm-linux-ohosmusl/libclang_rt.builtins.a" 130+ ldflags += [ "-Wl,--dynamic-linker,/lib/ld-musl-arm.so.1" ] 131+ libclang_rt_file = "$ohos_toolchain_root/lib/clang/10.0.1/lib/arm-linux-ohos/libclang_rt.builtins.a" 132 133 libs += [ 134 rebase_path(libclang_rt_file), 135diff --git a/src/build/config/ohos/config.gni b/src/build/config/ohos/config.gni 136index ac4d39c78b..a84cfa12d6 100644 137--- a/src/build/config/ohos/config.gni 138+++ b/src/build/config/ohos/config.gni 139@@ -13,7 +13,7 @@ if (is_ohos) { 140 } 141 142 declare_args() { 143- build_chromium_with_ohos_src = false 144+ build_chromium_with_ohos_src = true 145 } 146 147 declare_args() { 148@@ -46,7 +46,7 @@ if (is_ohos) { 149 ohos_build_root = "//../../.." 150 if (use_musl) { 151 ohos_toolchain_root = "$ohos_ndk_root/clang/ohos/linux-x86_64/llvm" 152- ohos_sysroot = "$ohos_build_root/out/ohos-arm-release/obj/third_party/musl" 153+ ohos_sysroot = "$ohos_build_root/out/rk3568/obj/third_party/musl" 154 } else { 155 ohos_toolchain_root = "$ohos_ndk_root/clang/host/linux-x86/clang-r353983c" 156 ohos_sysroot = "$ohos_ndk_root/aosp_prebuilt_libs/asdk_libs/ndk/platforms/current/arch-arm" 157@@ -61,6 +61,7 @@ if (is_ohos) { 158 "$ohos_build_root/drivers/peripheral/display/interfaces/include", 159 "$ohos_build_root/foundation/graphic/standard/utils/buffer_handle/export", 160 "$ohos_build_root/foundation/multimedia/media_standard/interfaces/innerkits/native/media/include", 161+ "$ohos_build_root/foundation/multimedia/media_standard/interfaces/inner_api/native", 162 "$ohos_build_root/drivers/peripheral/base", 163 "$ohos_build_root/foundation/graphic/standard/interfaces/innerkits/surface", 164 "$ohos_build_root/foundation/communication/ipc/interfaces/innerkits/ipc_core/include", 165@@ -85,10 +86,18 @@ if (is_ohos) { 166 "$ohos_build_root/third_party/jsoncpp/include", 167 "$ohos_build_root/third_party/json/include", 168 "$ohos_build_root/base/security/access_token/interfaces/innerkits/accesstoken/include/", 169+ "$ohos_build_root/foundation/aafwk/standard/interfaces/innerkits/uri/include" 170 ] 171- ohos_libs_dir = [ 172- "$ohos_build_root/out/ohos-arm-release/packages/phone/system/lib", 173- ] 174+ 175+ if (use_musl) { 176+ ohos_libs_dir = [ 177+ "$ohos_build_root/out/rk3568/packages/phone/system/lib", 178+ ] 179+ } else { 180+ ohos_libs_dir = [ 181+ "$ohos_build_root/out/ohos-arm-release/packages/phone/system/lib", 182+ ] 183+ } 184 } else { 185 if (use_musl) { 186 ohos_build_root = "//ohos_ndk" 187@@ -124,6 +133,12 @@ if (is_ohos) { 188 "$ohos_build_root/includes/location_request_config", 189 "$ohos_build_root/includes/system_ability", 190 "$ohos_build_root/includes/accesstoken", 191+ "$ohos_build_root/includes/aafwk/want/include/ohos/aafwk/content", 192+ "$ohos_build_root/includes/aafwk/uri/include", 193+ "$ohos_build_root/includes/aafwk/app_manager/include", 194+ "$ohos_build_root/includes/aafwk/base/include", 195+ "$ohos_build_root/includes/json", 196+ "$ohos_build_root/includes/appexecfwk", 197 ] 198 ohos_libs_dir = [ 199 "$ohos_build_root/libs", 200diff --git a/src/cef/include/capi/cef_browser_capi.h b/src/cef/include/capi/cef_browser_capi.h 201index 4da347b328..08a853a713 100644 202--- a/src/cef/include/capi/cef_browser_capi.h 203+++ b/src/cef/include/capi/cef_browser_capi.h 204@@ -33,7 +33,7 @@ 205 // by hand. See the translator.README.txt file in the tools directory for 206 // more information. 207 // 208-// $hash=c67f05b1e5dfb20ca1895cd289fa391fc2f8d21b$ 209+// $hash=e434c8f59b8c8cbfa6c41550f4b53940c57d68f7$ 210 // 211 212 #ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ 213@@ -104,6 +104,11 @@ typedef struct _cef_browser_t { 214 int(CEF_CALLBACK* can_go_back_or_forward)(struct _cef_browser_t* self, 215 int num_steps); 216 217+ /// 218+ // DeleteHistory 219+ /// 220+ void(CEF_CALLBACK* delete_history)(struct _cef_browser_t* self); 221+ 222 /// 223 // Returns true (1) if the browser is currently loading. 224 /// 225@@ -1049,6 +1054,17 @@ typedef struct _cef_browser_host_t { 226 /// 227 void(CEF_CALLBACK* set_native_window)(struct _cef_browser_host_t* self, 228 cef_native_window_t window); 229+ 230+ /// 231+ // Set web debugging access 232+ /// 233+ void(CEF_CALLBACK* set_web_debugging_access)(struct _cef_browser_host_t* self, 234+ int isEnableDebug); 235+ 236+ /// 237+ // Get web debugging access 238+ /// 239+ int(CEF_CALLBACK* get_web_debugging_access)(struct _cef_browser_host_t* self); 240 } cef_browser_host_t; 241 242 /// 243diff --git a/src/cef/include/capi/cef_dialog_handler_capi.h b/src/cef/include/capi/cef_dialog_handler_capi.h 244index 51563dbdc0..0071832626 100644 245--- a/src/cef/include/capi/cef_dialog_handler_capi.h 246+++ b/src/cef/include/capi/cef_dialog_handler_capi.h 247@@ -33,7 +33,7 @@ 248 // by hand. See the translator.README.txt file in the tools directory for 249 // more information. 250 // 251-// $hash=0f56154217707d141912dc8a298279df8df04311$ 252+// $hash=abdbb4a150fc310df31ec08d1618e1e557dfe3e2$ 253 // 254 255 #ifndef CEF_INCLUDE_CAPI_CEF_DIALOG_HANDLER_CAPI_H_ 256@@ -106,6 +106,7 @@ typedef struct _cef_dialog_handler_t { 257 const cef_string_t* default_file_path, 258 cef_string_list_t accept_filters, 259 int selected_accept_filter, 260+ int capture, 261 struct _cef_file_dialog_callback_t* callback); 262 } cef_dialog_handler_t; 263 264diff --git a/src/cef/include/capi/cef_load_handler_capi.h b/src/cef/include/capi/cef_load_handler_capi.h 265index 13871a2b69..5441c2a61c 100644 266--- a/src/cef/include/capi/cef_load_handler_capi.h 267+++ b/src/cef/include/capi/cef_load_handler_capi.h 268@@ -33,7 +33,7 @@ 269 // by hand. See the translator.README.txt file in the tools directory for 270 // more information. 271 // 272-// $hash=4e59a8c7cda2f13ee54599773755637ec846fe84$ 273+// $hash=01d2eb08fb2b56fd87c80e441d4b6c7f7d082bb6$ 274 // 275 276 #ifndef CEF_INCLUDE_CAPI_CEF_LOAD_HANDLER_CAPI_H_ 277@@ -138,6 +138,16 @@ typedef struct _cef_load_handler_t { 278 int is_main_frame, 279 int has_user_gesture, 280 struct _cef_response_t* response); 281+ 282+ /// 283+ // OnRefreshAccessedHistory 284+ /// 285+ void(CEF_CALLBACK* on_refresh_accessed_history)( 286+ struct _cef_load_handler_t* self, 287+ struct _cef_browser_t* browser, 288+ struct _cef_frame_t* frame, 289+ const cef_string_t* url, 290+ int isReload); 291 } cef_load_handler_t; 292 293 #ifdef __cplusplus 294diff --git a/src/cef/include/cef_api_hash.h b/src/cef/include/cef_api_hash.h 295index f3f3a84157..26cd4c0945 100755 296--- a/src/cef/include/cef_api_hash.h 297+++ b/src/cef/include/cef_api_hash.h 298@@ -42,15 +42,15 @@ 299 // way that may cause binary incompatibility with other builds. The universal 300 // hash value will change if any platform is affected whereas the platform hash 301 // values will change only if that particular platform is affected. 302-#define CEF_API_HASH_UNIVERSAL "1f76ea4de1ba7ea76c979c9e1b8979dd9635627c" 303+#define CEF_API_HASH_UNIVERSAL "e71457f3fd884ff5c35e8be2ad91e649d7b00e45" 304 #if defined(OS_WIN) 305-#define CEF_API_HASH_PLATFORM "8495446ce9aab5825a73927de2d283a4c476cb78" 306+#define CEF_API_HASH_PLATFORM "b950292957927fcf6a52690fb196331a3a44ce67" 307 #elif defined(OS_MAC) 308-#define CEF_API_HASH_PLATFORM "f29274b57821fd5052c5e2b438189ad9f9343aeb" 309+#define CEF_API_HASH_PLATFORM "3b5736924b75007ae90ee5bc9979b829c564581d" 310 #elif defined(OS_LINUX) 311-#define CEF_API_HASH_PLATFORM "441fb55700b31842dfc6e31f9757ef63c0359623" 312+#define CEF_API_HASH_PLATFORM "3ed0e1dedda07cfe679f709fb96d40ca92900395" 313 #elif defined(OS_OHOS) 314-#define CEF_API_HASH_PLATFORM "441fb55700b31842dfc6e31f9757ef63c0359623" 315+#define CEF_API_HASH_PLATFORM "3ed0e1dedda07cfe679f709fb96d40ca92900395" 316 #endif 317 318 #ifdef __cplusplus 319diff --git a/src/cef/include/cef_browser.h b/src/cef/include/cef_browser.h 320index 7e977e4297..43a571f43d 100755 321--- a/src/cef/include/cef_browser.h 322+++ b/src/cef/include/cef_browser.h 323@@ -100,6 +100,12 @@ class CefBrowser : public virtual CefBaseRefCounted { 324 /*--cef()--*/ 325 virtual bool CanGoBackOrForward(int num_steps) = 0; 326 327+ /// 328+ // DeleteHistory 329+ /// 330+ /*--cef()--*/ 331+ virtual void DeleteHistory() = 0; 332+ 333 /// 334 // Returns true if the browser is currently loading. 335 /// 336@@ -1078,6 +1084,18 @@ class CefBrowserHost : public virtual CefBaseRefCounted { 337 /// 338 /*--cef()--*/ 339 virtual void SetNativeWindow(cef_native_window_t window) = 0; 340+ 341+ /// 342+ // Set web debugging access 343+ /// 344+ /*--cef()--*/ 345+ virtual void SetWebDebuggingAccess(bool isEnableDebug) = 0; 346+ 347+ /// 348+ // Get web debugging access 349+ /// 350+ /*--cef()--*/ 351+ virtual bool GetWebDebuggingAccess() = 0; 352 }; 353 354 /// 355diff --git a/src/cef/include/cef_dialog_handler.h b/src/cef/include/cef_dialog_handler.h 356index 3ce02e6c13..5b77305af9 100644 357--- a/src/cef/include/cef_dialog_handler.h 358+++ b/src/cef/include/cef_dialog_handler.h 359@@ -98,6 +98,7 @@ class CefDialogHandler : public virtual CefBaseRefCounted { 360 const CefString& default_file_path, 361 const std::vector<CefString>& accept_filters, 362 int selected_accept_filter, 363+ bool capture, 364 CefRefPtr<CefFileDialogCallback> callback) { 365 return false; 366 } 367diff --git a/src/cef/include/cef_load_handler.h b/src/cef/include/cef_load_handler.h 368old mode 100644 369new mode 100755 370index 3389aa306b..412e3b981f 371--- a/src/cef/include/cef_load_handler.h 372+++ b/src/cef/include/cef_load_handler.h 373@@ -131,6 +131,15 @@ class CefLoadHandler : public virtual CefBaseRefCounted { 374 bool is_main_frame, 375 bool has_user_gesture, 376 CefRefPtr<CefResponse> response) {} 377+ 378+ /// 379+ // OnRefreshAccessedHistory 380+ /// 381+ /*--cef()--*/ 382+ virtual void OnRefreshAccessedHistory(CefRefPtr<CefBrowser> browser, 383+ CefRefPtr<CefFrame> frame, 384+ const CefString& url, 385+ bool isReload) {} 386 }; 387 388 #endif // CEF_INCLUDE_CEF_LOAD_HANDLER_H_ 389diff --git a/src/cef/include/internal/cef_types.h b/src/cef/include/internal/cef_types.h 390old mode 100644 391new mode 100755 392index c5c6171674..1c5fb3b85c 393--- a/src/cef/include/internal/cef_types.h 394+++ b/src/cef/include/internal/cef_types.h 395@@ -703,13 +703,13 @@ typedef struct _cef_browser_settings_t { 396 cef_state_t loads_images_automatically; 397 bool javascript_can_open_windows_automatically; 398 int text_size_percent; 399- int mixed_content_mode; 400 cef_state_t allow_running_insecure_content; 401 cef_state_t strict_mixed_content_checking; 402 cef_state_t allow_mixed_content_upgrades; 403 bool geolocation_enabled; 404 bool supports_double_tap_zoom; 405 bool supports_multi_touch_zoom; 406+ cef_state_t initialize_at_minimum_page_scale; 407 /* ohos webview end */ 408 } cef_browser_settings_t; 409 410diff --git a/src/cef/include/internal/cef_types_wrappers.h b/src/cef/include/internal/cef_types_wrappers.h 411old mode 100644 412new mode 100755 413index 49429490a9..e4c0d643bc 414--- a/src/cef/include/internal/cef_types_wrappers.h 415+++ b/src/cef/include/internal/cef_types_wrappers.h 416@@ -732,13 +732,13 @@ struct CefBrowserSettingsTraits { 417 src->javascript_can_open_windows_automatically; 418 target->loads_images_automatically = src->loads_images_automatically; 419 target->text_size_percent = src->text_size_percent; 420- target->mixed_content_mode = src->mixed_content_mode; 421 target->allow_running_insecure_content = src->allow_running_insecure_content; 422 target->strict_mixed_content_checking = src->strict_mixed_content_checking; 423 target->allow_mixed_content_upgrades = src->allow_mixed_content_upgrades; 424 target->geolocation_enabled = src->geolocation_enabled; 425 target->supports_double_tap_zoom = src->supports_double_tap_zoom; 426 target->supports_multi_touch_zoom = src->supports_multi_touch_zoom; 427+ target->initialize_at_minimum_page_scale = src->initialize_at_minimum_page_scale; 428 /* ohos webview end */ 429 } 430 }; 431diff --git a/src/cef/libcef/browser/alloy/alloy_browser_main.cc b/src/cef/libcef/browser/alloy/alloy_browser_main.cc 432index 433272c61c..60c2b83aea 100644 433--- a/src/cef/libcef/browser/alloy/alloy_browser_main.cc 434+++ b/src/cef/libcef/browser/alloy/alloy_browser_main.cc 435@@ -194,10 +194,6 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() { 436 // Create the global RequestContext. 437 global_request_context_ = 438 CefRequestContextImpl::CreateGlobalRequestContext(settings); 439- auto browser_context = 440- global_request_context_->GetBrowserContext()->AsBrowserContext(); 441- 442- CefDevToolsManagerDelegate::StartHttpHandler(browser_context); 443 444 #if defined(OS_WIN) 445 // Windows parental controls calls can be slow, so we do an early init here 446diff --git a/src/cef/libcef/browser/alloy/alloy_content_browser_client.cc b/src/cef/libcef/browser/alloy/alloy_content_browser_client.cc 447index a936b5659e..4530987a86 100755 448--- a/src/cef/libcef/browser/alloy/alloy_content_browser_client.cc 449+++ b/src/cef/libcef/browser/alloy/alloy_content_browser_client.cc 450@@ -1229,6 +1229,8 @@ void AlloyContentBrowserClient::ConfigureNetworkContextParams( 451 } 452 network_context_params->persist_session_cookies = cef_context->ShouldPersistSessionCookies(); 453 network_context_params->restore_old_session_cookies = cef_context->ShouldRestoreOldSessionCookies(); 454+ network_context_params->http_cache_enabled = true; 455+ network_context_params->http_cache_path = cache_path; 456 } 457 if (!SystemNetworkContextManager::GetInstance()) { 458 // This must match the value expected in 459diff --git a/src/cef/libcef/browser/browser_contents_delegate.cc b/src/cef/libcef/browser/browser_contents_delegate.cc 460old mode 100644 461new mode 100755 462index fca6d1e95f..6273fb3a88 463--- a/src/cef/libcef/browser/browser_contents_delegate.cc 464+++ b/src/cef/libcef/browser/browser_contents_delegate.cc 465@@ -406,6 +406,11 @@ void CefBrowserContentsDelegate::DidFinishNavigation( 466 if (is_main_frame) { 467 OnAddressChange(url); 468 } 469+ 470+ bool isReload = PageTransitionCoreTypeIs(navigation_handle->GetPageTransition(), 471+ ui::PageTransition::PAGE_TRANSITION_RELOAD); 472+ LOG(INFO) << "load type = " << PageTransitionStripQualifier(navigation_handle->GetPageTransition()); 473+ OnRefreshAccessedHistory(frame.get(), url, isReload); 474 } else { 475 // The navigation failed with an error. This may happen before commit 476 // (e.g. network error) or after commit (e.g. response filter error). 477@@ -663,3 +668,19 @@ void CefBrowserContentsDelegate::InitIconHelper() { 478 } 479 } 480 } 481+ 482+void CefBrowserContentsDelegate::OnRefreshAccessedHistory(CefRefPtr<CefFrame> frame, const GURL& url, bool isReload) { 483+ CefRefPtr<CefClient> cefClient = client(); 484+ if (!cefClient.get()) { 485+ LOG(ERROR) << "cef client is null"; 486+ return; 487+ } 488+ 489+ auto handler = cefClient->GetLoadHandler(); 490+ if (!handler.get()) { 491+ LOG(ERROR) << "cef client handler is null"; 492+ return; 493+ } 494+ 495+ handler->OnRefreshAccessedHistory(browser(), frame, url.spec(), isReload); 496+} 497diff --git a/src/cef/libcef/browser/browser_contents_delegate.h b/src/cef/libcef/browser/browser_contents_delegate.h 498old mode 100644 499new mode 100755 500index 991010f4f7..ab6a9ae07a 501--- a/src/cef/libcef/browser/browser_contents_delegate.h 502+++ b/src/cef/libcef/browser/browser_contents_delegate.h 503@@ -176,6 +176,8 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate, 504 505 void OnStateChanged(State state_changed); 506 507+ void OnRefreshAccessedHistory(CefRefPtr<CefFrame> frame, const GURL& url, bool isReload); 508+ 509 scoped_refptr<CefBrowserInfo> browser_info_; 510 511 bool is_loading_ = false; 512diff --git a/src/cef/libcef/browser/browser_host_base.cc b/src/cef/libcef/browser/browser_host_base.cc 513index 152bbb89d5..249d40e4f1 100755 514--- a/src/cef/libcef/browser/browser_host_base.cc 515+++ b/src/cef/libcef/browser/browser_host_base.cc 516@@ -10,6 +10,7 @@ 517 #include "libcef/browser/browser_info_manager.h" 518 #include "libcef/browser/browser_platform_delegate.h" 519 #include "libcef/browser/context.h" 520+#include "libcef/browser/devtools/devtools_manager_delegate.h" 521 #include "libcef/browser/image_impl.h" 522 #include "libcef/browser/navigation_entry_impl.h" 523 #include "libcef/browser/permission/alloy_access_request.h" 524@@ -465,7 +466,6 @@ void CefBrowserHostBase::UpdateBrowserSettings( 525 settings_.loads_images_automatically = 526 browser_settings.loads_images_automatically; 527 settings_.text_size_percent = browser_settings.text_size_percent; 528- settings_.mixed_content_mode = browser_settings.mixed_content_mode; 529 settings_.allow_running_insecure_content = 530 browser_settings.allow_running_insecure_content; 531 settings_.strict_mixed_content_checking = 532@@ -477,6 +477,8 @@ void CefBrowserHostBase::UpdateBrowserSettings( 533 browser_settings.supports_double_tap_zoom; 534 settings_.supports_multi_touch_zoom = 535 browser_settings.supports_multi_touch_zoom; 536+ settings_.initialize_at_minimum_page_scale = 537+ browser_settings.initialize_at_minimum_page_scale; 538 } 539 540 void CefBrowserHostBase::SetWebPreferences( 541@@ -682,15 +684,27 @@ void CefBrowserHostBase::GoForward() { 542 543 bool CefBrowserHostBase::CanGoBackOrForward(int num_steps) { 544 auto wc = GetWebContents(); 545- LOG(INFO) << "CanGoBackOrForward"; 546 if (wc != nullptr) { 547- LOG(INFO) << "CanGoBackOrForward:" 548- << wc->GetController().CanGoToOffset(num_steps); 549 return wc->GetController().CanGoToOffset(num_steps); 550 } 551 return false; 552 } 553 554+void CefBrowserHostBase::DeleteHistory() { 555+ auto callback = base::BindOnce(&CefBrowserHostBase::DeleteHistory, this); 556+ if (!CEF_CURRENTLY_ON_UIT()) { 557+ CEF_POST_TASK(CEF_UIT, std::move(callback)); 558+ return; 559+ } 560+ auto wc = GetWebContents(); 561+ if (wc && wc->GetController().CanPruneAllButLastCommitted()) { 562+ wc->GetController().PruneAllButLastCommitted(); 563+ base::AutoLock lock_scope(state_lock_); 564+ can_go_forward_ = false; 565+ can_go_back_ = false; 566+ } 567+} 568+ 569 bool CefBrowserHostBase::IsLoading() { 570 base::AutoLock lock_scope(state_lock_); 571 return is_loading_; 572@@ -1300,4 +1314,24 @@ void CefBrowserHostBase::SetNativeWindow(cef_native_window_t window) 573 cef_accelerated_widget_t CefBrowserHostBase::GetAcceleratedWidget() 574 { 575 return widget_; 576-} 577\ No newline at end of file 578+} 579+ 580+void CefBrowserHostBase::SetWebDebuggingAccess(bool isEnableDebug) { 581+ base::AutoLock lock_scope(state_lock_); 582+ if (is_web_debugging_access_ == isEnableDebug) { 583+ LOG(ERROR) << "set web debugging access failed, already is " << isEnableDebug; 584+ return; 585+ } 586+ 587+ if (isEnableDebug) { 588+ CefDevToolsManagerDelegate::StartHttpHandler(GetBrowserContext()); 589+ } else { 590+ CefDevToolsManagerDelegate::StopHttpHandler(); 591+ } 592+ is_web_debugging_access_ = isEnableDebug; 593+} 594+ 595+bool CefBrowserHostBase::GetWebDebuggingAccess() { 596+ base::AutoLock lock_scope(state_lock_); 597+ return is_web_debugging_access_; 598+} 599diff --git a/src/cef/libcef/browser/browser_host_base.h b/src/cef/libcef/browser/browser_host_base.h 600index 6931c1f2f6..e85729d5a8 100755 601--- a/src/cef/libcef/browser/browser_host_base.h 602+++ b/src/cef/libcef/browser/browser_host_base.h 603@@ -219,6 +219,7 @@ class CefBrowserHostBase : public CefBrowserHost, 604 bool CanGoForward() override; 605 void GoForward() override; 606 bool CanGoBackOrForward(int num_steps) override; 607+ void DeleteHistory() override; 608 bool IsLoading() override; 609 void Reload() override; 610 void ReloadIgnoreCache() override; 611@@ -354,6 +355,9 @@ class CefBrowserHostBase : public CefBrowserHost, 612 void SetNativeWindow(cef_native_window_t window) override; 613 cef_accelerated_widget_t GetAcceleratedWidget(); 614 615+ void SetWebDebuggingAccess(bool isEnableDebug) override; 616+ bool GetWebDebuggingAccess() override; 617+ 618 protected: 619 bool EnsureDevToolsManager(); 620 void InitializeDevToolsRegistrationOnUIThread( 621@@ -407,6 +411,7 @@ class CefBrowserHostBase : public CefBrowserHost, 622 DISALLOW_COPY_AND_ASSIGN(CefBrowserHostBase); 623 624 cef_accelerated_widget_t widget_; 625+ bool is_web_debugging_access_ = false; 626 }; 627 628 #endif // CEF_LIBCEF_BROWSER_BROWSER_HOST_BASE_H_ 629diff --git a/src/cef/libcef/browser/devtools/devtools_manager_delegate.cc b/src/cef/libcef/browser/devtools/devtools_manager_delegate.cc 630index f53323d81d..3d52d457f2 100644 631--- a/src/cef/libcef/browser/devtools/devtools_manager_delegate.cc 632+++ b/src/cef/libcef/browser/devtools/devtools_manager_delegate.cc 633@@ -102,8 +102,15 @@ void CefDevToolsManagerDelegate::StartHttpHandler( 634 CreateSocketFactory(); 635 if (!socket_factory) 636 return; 637- content::DevToolsAgentHost::StartRemoteDebuggingServer( 638+ 639+ LOG(INFO) << "start remote debugging server"; 640+ if (browser_context == nullptr) { 641+ content::DevToolsAgentHost::StartRemoteDebuggingServer( 642+ std::move(socket_factory), base::FilePath(), base::FilePath()); 643+ } else { 644+ content::DevToolsAgentHost::StartRemoteDebuggingServer( 645 std::move(socket_factory), browser_context->GetPath(), base::FilePath()); 646+ } 647 648 const base::CommandLine& command_line = 649 *base::CommandLine::ForCurrentProcess(); 650@@ -116,6 +123,7 @@ void CefDevToolsManagerDelegate::StartHttpHandler( 651 // static 652 void CefDevToolsManagerDelegate::StopHttpHandler() { 653 // This is a no-op if the server was never started. 654+ LOG(INFO) << "stop remote debugging server"; 655 content::DevToolsAgentHost::StopRemoteDebuggingServer(); 656 } 657 658diff --git a/src/cef/libcef/browser/file_dialog_manager.cc b/src/cef/libcef/browser/file_dialog_manager.cc 659old mode 100644 660new mode 100755 661index 4d139eb51a..bb81426a02 662--- a/src/cef/libcef/browser/file_dialog_manager.cc 663+++ b/src/cef/libcef/browser/file_dialog_manager.cc 664@@ -204,7 +204,6 @@ void CefFileDialogManager::RunFileChooser( 665 scoped_refptr<content::FileSelectListener> listener, 666 const blink::mojom::FileChooserParams& params) { 667 CEF_REQUIRE_UIT(); 668- 669 CefFileDialogRunner::FileChooserParams cef_params; 670 static_cast<blink::mojom::FileChooserParams&>(cef_params) = params; 671 672@@ -286,7 +285,8 @@ void CefFileDialogManager::RunFileChooserInternal( 673 handled = handler->OnFileDialog( 674 browser_, static_cast<cef_file_dialog_mode_t>(mode), params.title, 675 params.default_file_name.value(), accept_filters, 676- params.selected_accept_filter, callbackImpl.get()); 677+ params.selected_accept_filter, params.use_media_capture, 678+ callbackImpl.get()); 679 if (!handled) { 680 // May return nullptr if the client has already executed the callback. 681 callback = callbackImpl->Disconnect(); 682diff --git a/src/cef/libcef/browser/net_service/cookie_helper.cc b/src/cef/libcef/browser/net_service/cookie_helper.cc 683index 0f0af971f7..6b2adf40cc 100644 684--- a/src/cef/libcef/browser/net_service/cookie_helper.cc 685+++ b/src/cef/libcef/browser/net_service/cookie_helper.cc 686@@ -192,7 +192,7 @@ void LoadCookies(content::BrowserContext* browser_context, 687 688 if ((request.load_flags & net::LOAD_DO_NOT_SEND_COOKIES) || 689 request.credentials_mode == network::mojom::CredentialsMode::kOmit || 690- request.url.IsAboutBlank() || !request.SendsCookies()) { 691+ request.url.IsAboutBlank()) { 692 // Continue immediately without loading cookies. 693 std::move(done_callback).Run(0, {}); 694 return; 695@@ -213,8 +213,7 @@ void SaveCookies(content::BrowserContext* browser_context, 696 697 if (request.credentials_mode == network::mojom::CredentialsMode::kOmit || 698 request.url.IsAboutBlank() || !headers || 699- !headers->HasHeader(net_service::kHTTPSetCookieHeaderName) || 700- !request.SavesCookies()) { 701+ !headers->HasHeader(net_service::kHTTPSetCookieHeaderName)) { 702 // Continue immediately without saving cookies. 703 std::move(done_callback).Run(0, {}); 704 return; 705diff --git a/src/cef/libcef/browser/net_service/cookie_manager_impl.cc b/src/cef/libcef/browser/net_service/cookie_manager_impl.cc 706old mode 100644 707new mode 100755 708index 67c7419dd7..38c4c9833a 709--- a/src/cef/libcef/browser/net_service/cookie_manager_impl.cc 710+++ b/src/cef/libcef/browser/net_service/cookie_manager_impl.cc 711@@ -20,7 +20,7 @@ namespace { 712 713 // Do not keep a reference to the object returned by this method. 714 CefBrowserContext* GetBrowserContext(const CefBrowserContext::Getter& getter) { 715- CEF_REQUIRE_UIT(); 716+ // CEF_REQUIRE_UIT(); 717 DCHECK(!getter.is_null()); 718 719 // Will return nullptr if the BrowserContext has been destroyed. 720@@ -29,10 +29,10 @@ CefBrowserContext* GetBrowserContext(const CefBrowserContext::Getter& getter) { 721 722 // Do not keep a reference to the object returned by this method. 723 CookieManager* GetCookieManager(CefBrowserContext* browser_context) { 724- CEF_REQUIRE_UIT(); 725+ // CEF_REQUIRE_UIT(); 726 return content::BrowserContext::GetDefaultStoragePartition( 727 browser_context->AsBrowserContext()) 728- ->GetCookieManagerForBrowserProcess(); 729+ ->GetCookieManagerForOhos(); 730 } 731 732 // Always execute the callback asynchronously. 733@@ -43,34 +43,10 @@ void RunAsyncCompletionOnUIThread(CefRefPtr<CefCompletionCallback> callback) { 734 base::Bind(&CefCompletionCallback::OnComplete, callback.get())); 735 } 736 737-// Always execute the callback asynchronously. 738-void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback, 739- net::CookieAccessResult access_result) { 740- if (!callback.get()) { 741- return; 742- } 743- const bool is_include = access_result.status.IsInclude(); 744- if (!is_include) { 745- LOG(WARNING) << "SetCookie failed with reason: " 746- << access_result.status.GetDebugString(); 747- } 748- CEF_POST_TASK(CEF_UIT, base::Bind(&CefSetCookieCallback::OnComplete, 749- callback.get(), is_include)); 750-} 751- 752-// Always execute the callback asynchronously. 753-void DeleteCookiesCallbackImpl(CefRefPtr<CefDeleteCookiesCallback> callback, 754- uint32_t num_deleted) { 755- if (!callback.get()) 756- return; 757- CEF_POST_TASK(CEF_UIT, base::Bind(&CefDeleteCookiesCallback::OnComplete, 758- callback.get(), num_deleted)); 759-} 760- 761 void ExecuteVisitor(CefRefPtr<CefCookieVisitor> visitor, 762 const CefBrowserContext::Getter& browser_context_getter, 763 const std::vector<net::CanonicalCookie>& cookies) { 764- CEF_REQUIRE_UIT(); 765+ // CEF_REQUIRE_UIT(); 766 767 auto browser_context = GetBrowserContext(browser_context_getter); 768 if (!browser_context) 769@@ -103,30 +79,13 @@ void ExecuteVisitor(CefRefPtr<CefCookieVisitor> visitor, 770 std::string cookie_line = net::CanonicalCookie::BuildCookieLine(cookies); 771 visitor->SetCookieLine(CefString(cookie_line)); 772 } 773- 774-// Always execute the callback asynchronously. 775-void GetAllCookiesCallbackImpl( 776- CefRefPtr<CefCookieVisitor> visitor, 777- const CefBrowserContext::Getter& browser_context_getter, 778- const net::CookieList& cookies) { 779- CEF_POST_TASK(CEF_UIT, base::Bind(&ExecuteVisitor, visitor, 780- browser_context_getter, cookies)); 781-} 782- 783-void GetCookiesCallbackImpl( 784- CefRefPtr<CefCookieVisitor> visitor, 785- const CefBrowserContext::Getter& browser_context_getter, 786- const net::CookieAccessResultList& include_cookies, 787- const net::CookieAccessResultList&) { 788- net::CookieList cookies; 789- for (const auto& status : include_cookies) { 790- cookies.push_back(status.cookie); 791- } 792- GetAllCookiesCallbackImpl(visitor, browser_context_getter, cookies); 793-} 794 } // namespace 795 796-CefCookieManagerImpl::CefCookieManagerImpl() {} 797+CefCookieManagerImpl::CefCookieManagerImpl() : 798+ cookie_thread{"CookieThread"} { 799+ cookie_thread.Start(); 800+ cookie_store_task_runner_ = cookie_thread.task_runner(); 801+} 802 803 void CefCookieManagerImpl::Initialize( 804 CefBrowserContext::Getter browser_context_getter, 805@@ -215,7 +174,6 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url, 806 if (!gurl.is_valid()) { 807 return false; 808 } 809- 810 if (!ValidContext()) { 811 StoreOrTriggerInitCallback(base::BindOnce( 812 base::IgnoreResult(&CefCookieManagerImpl::SetCookieInternal), this, 813@@ -292,7 +250,9 @@ bool CefCookieManagerImpl::VisitAllCookiesInternal( 814 return false; 815 816 GetCookieManager(browser_context) 817- ->GetAllCookies(base::Bind(&GetAllCookiesCallbackImpl, visitor, 818+ ->GetAllCookies(base::Bind(&CefCookieManagerImpl::GetAllCookiesCallbackImpl, 819+ base::Unretained(this), 820+ visitor, 821 browser_context_getter_)); 822 return true; 823 } 824@@ -317,7 +277,9 @@ bool CefCookieManagerImpl::VisitUrlCookiesInternal( 825 826 GetCookieManager(browser_context) 827 ->GetCookieList(url, options, 828- base::Bind(&GetCookiesCallbackImpl, visitor, 829+ base::Bind(&CefCookieManagerImpl::GetCookiesCallbackImpl, 830+ base::Unretained(this), 831+ visitor, 832 browser_context_getter_)); 833 return true; 834 } 835@@ -367,9 +329,12 @@ bool CefCookieManagerImpl::SetCookieInternal( 836 auto browser_context = GetBrowserContext(browser_context_getter_); 837 if (!browser_context) 838 return false; 839+ 840 GetCookieManager(browser_context) 841 ->SetCanonicalCookie(*canonical_cookie, url, options, 842- base::Bind(SetCookieCallbackImpl, callback)); 843+ base::Bind(&CefCookieManagerImpl::SetCookieCallbackImpl, 844+ base::Unretained(this), 845+ callback)); 846 return true; 847 } 848 849@@ -406,7 +371,9 @@ bool CefCookieManagerImpl::DeleteCookiesInternal( 850 851 GetCookieManager(browser_context) 852 ->DeleteCookies(std::move(deletion_filter), 853- base::Bind(DeleteCookiesCallbackImpl, callback)); 854+ base::Bind(&CefCookieManagerImpl::DeleteCookiesCallbackImpl, 855+ base::Unretained(this), 856+ callback)); 857 return true; 858 } 859 860@@ -419,15 +386,18 @@ bool CefCookieManagerImpl::FlushStoreInternal( 861 return false; 862 863 GetCookieManager(browser_context) 864- ->FlushCookieStore(base::Bind(RunAsyncCompletionOnUIThread, callback)); 865+ ->FlushCookieStore(base::Bind( 866+ &CefCookieManagerImpl::RunAsyncCompletionOnTaskRunner, 867+ base::Unretained(this), 868+ callback)); 869 return true; 870 } 871 872 void CefCookieManagerImpl::StoreOrTriggerInitCallback( 873 base::OnceClosure callback) { 874- if (!CEF_CURRENTLY_ON_UIT()) { 875- CEF_POST_TASK( 876- CEF_UIT, 877+ if (!cookie_store_task_runner_->RunsTasksInCurrentSequence()) { 878+ cookie_store_task_runner_->PostTask( 879+ FROM_HERE, 880 base::BindOnce(&CefCookieManagerImpl::StoreOrTriggerInitCallback, this, 881 std::move(callback))); 882 return; 883@@ -441,7 +411,7 @@ void CefCookieManagerImpl::StoreOrTriggerInitCallback( 884 } 885 886 bool CefCookieManagerImpl::ValidContext() const { 887- return CEF_CURRENTLY_ON_UIT() && initialized_; 888+ return cookie_store_task_runner_->RunsTasksInCurrentSequence() && initialized_; 889 } 890 891 // CefCookieManager methods ---------------------------------------------------- 892@@ -459,3 +429,65 @@ bool CefCookieManager::CreateCefCookie(const CefString& url, 893 return net_service::MakeCefCookie(GURL(url.ToString()), value.ToString(), 894 cef_cookie); 895 } 896+ 897+// Always execute the set callback on cookie_store_task_runner_. 898+void CefCookieManagerImpl::SetCookieCallbackImpl( 899+ CefRefPtr<CefSetCookieCallback> callback, 900+ net::CookieAccessResult access_result) { 901+ if (!callback.get()) { 902+ return; 903+ } 904+ const bool is_include = access_result.status.IsInclude(); 905+ if (!is_include) { 906+ LOG(WARNING) << "SetCookie failed with reason: " 907+ << access_result.status.GetDebugString(); 908+ } 909+ 910+ cookie_store_task_runner_->PostTask( 911+ FROM_HERE, 912+ base::Bind(&CefSetCookieCallback::OnComplete, 913+ callback.get(), is_include)); 914+} 915+ 916+void CefCookieManagerImpl::RunAsyncCompletionOnTaskRunner( 917+ CefRefPtr<CefCompletionCallback> callback) { 918+ if (!callback.get()) 919+ return; 920+ cookie_store_task_runner_->PostTask( 921+ FROM_HERE, 922+ base::Bind(&CefCompletionCallback::OnComplete, 923+ callback.get())); 924+} 925+ 926+void CefCookieManagerImpl::GetAllCookiesCallbackImpl( 927+ CefRefPtr<CefCookieVisitor> visitor, 928+ const CefBrowserContext::Getter& browser_context_getter, 929+ const net::CookieList& cookies) { 930+ cookie_store_task_runner_->PostTask( 931+ FROM_HERE, 932+ base::Bind(&ExecuteVisitor, visitor, 933+ browser_context_getter, cookies)); 934+} 935+ 936+void CefCookieManagerImpl::GetCookiesCallbackImpl( 937+ CefRefPtr<CefCookieVisitor> visitor, 938+ const CefBrowserContext::Getter& browser_context_getter, 939+ const net::CookieAccessResultList& include_cookies, 940+ const net::CookieAccessResultList&) { 941+ net::CookieList cookies; 942+ for (const auto& status : include_cookies) { 943+ cookies.push_back(status.cookie); 944+ } 945+ GetAllCookiesCallbackImpl(visitor, browser_context_getter, cookies); 946+} 947+ 948+void CefCookieManagerImpl::DeleteCookiesCallbackImpl( 949+ CefRefPtr<CefDeleteCookiesCallback> callback, 950+ uint32_t num_deleted) { 951+ if (!callback.get()) 952+ return; 953+ cookie_store_task_runner_->PostTask( 954+ FROM_HERE, 955+ base::Bind(&CefDeleteCookiesCallback::OnComplete, 956+ callback.get(), num_deleted)); 957+} 958\ No newline at end of file 959diff --git a/src/cef/libcef/browser/net_service/cookie_manager_impl.h b/src/cef/libcef/browser/net_service/cookie_manager_impl.h 960old mode 100644 961new mode 100755 962index 860ec7b90c..55c544dbdc 963--- a/src/cef/libcef/browser/net_service/cookie_manager_impl.h 964+++ b/src/cef/libcef/browser/net_service/cookie_manager_impl.h 965@@ -12,6 +12,7 @@ 966 #include "libcef/browser/thread_util.h" 967 968 #include "base/files/file_path.h" 969+#include "base/threading/thread.h" 970 971 // Implementation of the CefCookieManager interface. May be created on any 972 // thread. 973@@ -58,6 +59,18 @@ class CefCookieManagerImpl : public CefCookieManager { 974 CefRefPtr<CefDeleteCookiesCallback> callback); 975 bool FlushStoreInternal(CefRefPtr<CefCompletionCallback> callback); 976 977+ void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback, 978+ net::CookieAccessResult access_result); 979+ void GetCookiesCallbackImpl(CefRefPtr<CefCookieVisitor> visitor, 980+ const CefBrowserContext::Getter& browser_context_getter, 981+ const net::CookieAccessResultList& include_cookies, 982+ const net::CookieAccessResultList&); 983+ void GetAllCookiesCallbackImpl(CefRefPtr<CefCookieVisitor> visitor, 984+ const CefBrowserContext::Getter& browser_context_getter, 985+ const net::CookieList& cookies); 986+ void DeleteCookiesCallbackImpl(CefRefPtr<CefDeleteCookiesCallback> callback, 987+ uint32_t num_deleted); 988+ void RunAsyncCompletionOnTaskRunner(CefRefPtr<CefCompletionCallback> callback); 989 // If the context is fully initialized execute |callback|, otherwise 990 // store it until the context is fully initialized. 991 void StoreOrTriggerInitCallback(base::OnceClosure callback); 992@@ -71,6 +84,8 @@ class CefCookieManagerImpl : public CefCookieManager { 993 std::atomic<bool> accept_cookies_ = true; 994 std::atomic<bool> allow_file_scheme_cookies_ = false; 995 std::vector<base::OnceClosure> init_callbacks_; 996+ base::Thread cookie_thread; 997+ scoped_refptr<base::SingleThreadTaskRunner> cookie_store_task_runner_; 998 999 IMPLEMENT_REFCOUNTING(CefCookieManagerImpl); 1000 DISALLOW_COPY_AND_ASSIGN(CefCookieManagerImpl); 1001diff --git a/src/cef/libcef/browser/net_service/net_helpers.cc b/src/cef/libcef/browser/net_service/net_helpers.cc 1002index 8cb3a1afe3..056525bb27 100644 1003--- a/src/cef/libcef/browser/net_service/net_helpers.cc 1004+++ b/src/cef/libcef/browser/net_service/net_helpers.cc 1005@@ -30,6 +30,7 @@ int UpdateCacheLoadFlags(int load_flags, int cache_control_flags) { 1006 bool NetHelpers::allow_content_access = false; 1007 bool NetHelpers::allow_file_access = false; 1008 bool NetHelpers::is_network_blocked = false; 1009+int NetHelpers::cache_mode = 0; 1010 1011 bool NetHelpers::ShouldBlockContentUrls() { 1012 return !allow_content_access; 1013@@ -87,7 +88,11 @@ int UpdateLoadFlags(int load_flags) { 1014 net::LOAD_ONLY_FROM_CACHE | net::LOAD_SKIP_CACHE_VALIDATION); 1015 } 1016 1017- return load_flags; 1018+ if (!NetHelpers::cache_mode) { 1019+ return load_flags; 1020+ } 1021+ 1022+ return UpdateCacheLoadFlags(load_flags, NetHelpers::cache_mode); 1023 } 1024 1025 } // namespace net_service 1026diff --git a/src/cef/libcef/browser/net_service/net_helpers.h b/src/cef/libcef/browser/net_service/net_helpers.h 1027index 67ff956861..c9ca95e737 100644 1028--- a/src/cef/libcef/browser/net_service/net_helpers.h 1029+++ b/src/cef/libcef/browser/net_service/net_helpers.h 1030@@ -19,6 +19,7 @@ class NETHELPERS_EXPORT NetHelpers { 1031 static bool allow_content_access; 1032 static bool allow_file_access; 1033 static bool is_network_blocked; 1034+ static int cache_mode; 1035 }; 1036 1037 bool IsSpecialFileUrl(const GURL& url); 1038diff --git a/src/cef/libcef/browser/osr/browser_platform_delegate_osr.cc b/src/cef/libcef/browser/osr/browser_platform_delegate_osr.cc 1039index c298893749..93abbbee00 100755 1040--- a/src/cef/libcef/browser/osr/browser_platform_delegate_osr.cc 1041+++ b/src/cef/libcef/browser/osr/browser_platform_delegate_osr.cc 1042@@ -160,7 +160,10 @@ void CefBrowserPlatformDelegateOsr::SendTouchEvent(const CefTouchEvent& event) { 1043 if (!view) 1044 return; 1045 view->SendTouchEvent(event); 1046- SendTouchEventToRender(event); 1047+ 1048+ if (event.type == CEF_TET_PRESSED) { 1049+ SendTouchEventToRender(event); 1050+ } 1051 } 1052 1053 void CefBrowserPlatformDelegateOsr::SendFocusEvent(bool setFocus) { 1054diff --git a/src/cef/libcef/browser/prefs/renderer_prefs.cc b/src/cef/libcef/browser/prefs/renderer_prefs.cc 1055old mode 100644 1056new mode 100755 1057index 7ed5929a4e..5eb7b4c927 1058--- a/src/cef/libcef/browser/prefs/renderer_prefs.cc 1059+++ b/src/cef/libcef/browser/prefs/renderer_prefs.cc 1060@@ -371,6 +371,7 @@ void SetCefPrefs(const CefBrowserSettings& cef, 1061 SET_STATE(cef.strict_mixed_content_checking, 1062 web.strict_mixed_content_checking); 1063 SET_STATE(cef.allow_mixed_content_upgrades, web.allow_mixed_content_upgrades); 1064+ SET_STATE(cef.initialize_at_minimum_page_scale, web.initialize_at_minimum_page_scale); 1065 /* ohos webview end */ 1066 } 1067 1068diff --git a/src/cef/libcef/renderer/browser_impl.cc b/src/cef/libcef/renderer/browser_impl.cc 1069index 80a4444232..b32efcfab2 100644 1070--- a/src/cef/libcef/renderer/browser_impl.cc 1071+++ b/src/cef/libcef/renderer/browser_impl.cc 1072@@ -83,6 +83,10 @@ bool CefBrowserImpl::CanGoBackOrForward(int num_steps) { 1073 return blink_glue::CanGoBackOrForward(GetWebView(), num_steps); 1074 } 1075 1076+void CefBrowserImpl::DeleteHistory() { 1077+ CEF_REQUIRE_RT_RETURN_VOID(); 1078+} 1079+ 1080 bool CefBrowserImpl::IsLoading() { 1081 CEF_REQUIRE_RT_RETURN(false); 1082 1083diff --git a/src/cef/libcef/renderer/browser_impl.h b/src/cef/libcef/renderer/browser_impl.h 1084index 0f6711a91d..b3d5b51b99 100644 1085--- a/src/cef/libcef/renderer/browser_impl.h 1086+++ b/src/cef/libcef/renderer/browser_impl.h 1087@@ -50,6 +50,7 @@ class CefBrowserImpl : public CefBrowser, public blink::WebViewObserver { 1088 bool CanGoForward() override; 1089 void GoForward() override; 1090 bool CanGoBackOrForward(int num_steps) override; 1091+ void DeleteHistory() override; 1092 bool IsLoading() override; 1093 void Reload() override; 1094 void ReloadIgnoreCache() override; 1095diff --git a/src/cef/libcef_dll/cpptoc/browser_cpptoc.cc b/src/cef/libcef_dll/cpptoc/browser_cpptoc.cc 1096index 3105dcd17b..915e95b93c 100644 1097--- a/src/cef/libcef_dll/cpptoc/browser_cpptoc.cc 1098+++ b/src/cef/libcef_dll/cpptoc/browser_cpptoc.cc 1099@@ -9,7 +9,7 @@ 1100 // implementations. See the translator.README.txt file in the tools directory 1101 // for more information. 1102 // 1103-// $hash=37305a392b6fceed48564b7a7d5f0d2811c537f4$ 1104+// $hash=a0db7b8177fbabe225af5a0e2db3fc5bc23ddec4$ 1105 // 1106 1107 #include "libcef_dll/cpptoc/browser_cpptoc.h" 1108@@ -117,6 +117,19 @@ int CEF_CALLBACK browser_can_go_back_or_forward(struct _cef_browser_t* self, 1109 return _retval; 1110 } 1111 1112+void CEF_CALLBACK browser_delete_history(struct _cef_browser_t* self) { 1113+ shutdown_checker::AssertNotShutdown(); 1114+ 1115+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 1116+ 1117+ DCHECK(self); 1118+ if (!self) 1119+ return; 1120+ 1121+ // Execute 1122+ CefBrowserCppToC::Get(self)->DeleteHistory(); 1123+} 1124+ 1125 int CEF_CALLBACK browser_is_loading(struct _cef_browser_t* self) { 1126 shutdown_checker::AssertNotShutdown(); 1127 1128@@ -439,6 +452,7 @@ CefBrowserCppToC::CefBrowserCppToC() { 1129 GetStruct()->can_go_forward = browser_can_go_forward; 1130 GetStruct()->go_forward = browser_go_forward; 1131 GetStruct()->can_go_back_or_forward = browser_can_go_back_or_forward; 1132+ GetStruct()->delete_history = browser_delete_history; 1133 GetStruct()->is_loading = browser_is_loading; 1134 GetStruct()->reload = browser_reload; 1135 GetStruct()->reload_ignore_cache = browser_reload_ignore_cache; 1136diff --git a/src/cef/libcef_dll/cpptoc/browser_host_cpptoc.cc b/src/cef/libcef_dll/cpptoc/browser_host_cpptoc.cc 1137index 8a7a69f3cd..7959765ed4 100644 1138--- a/src/cef/libcef_dll/cpptoc/browser_host_cpptoc.cc 1139+++ b/src/cef/libcef_dll/cpptoc/browser_host_cpptoc.cc 1140@@ -9,7 +9,7 @@ 1141 // implementations. See the translator.README.txt file in the tools directory 1142 // for more information. 1143 // 1144-// $hash=895ebf37281c0926ef4cc9262fe90e940d8b7ab4$ 1145+// $hash=ff0c3692d8878d45dd92ab0da41ccfb481762e26$ 1146 // 1147 1148 #include "libcef_dll/cpptoc/browser_host_cpptoc.h" 1149@@ -1635,6 +1635,39 @@ browser_host_set_native_window(struct _cef_browser_host_t* self, 1150 CefBrowserHostCppToC::Get(self)->SetNativeWindow(window); 1151 } 1152 1153+void CEF_CALLBACK 1154+browser_host_set_web_debugging_access(struct _cef_browser_host_t* self, 1155+ int isEnableDebug) { 1156+ shutdown_checker::AssertNotShutdown(); 1157+ 1158+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 1159+ 1160+ DCHECK(self); 1161+ if (!self) 1162+ return; 1163+ 1164+ // Execute 1165+ CefBrowserHostCppToC::Get(self)->SetWebDebuggingAccess(isEnableDebug ? true 1166+ : false); 1167+} 1168+ 1169+int CEF_CALLBACK 1170+browser_host_get_web_debugging_access(struct _cef_browser_host_t* self) { 1171+ shutdown_checker::AssertNotShutdown(); 1172+ 1173+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 1174+ 1175+ DCHECK(self); 1176+ if (!self) 1177+ return 0; 1178+ 1179+ // Execute 1180+ bool _retval = CefBrowserHostCppToC::Get(self)->GetWebDebuggingAccess(); 1181+ 1182+ // Return type: bool 1183+ return _retval; 1184+} 1185+ 1186 } // namespace 1187 1188 // CONSTRUCTOR - Do not edit by hand. 1189@@ -1728,6 +1761,8 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() { 1190 GetStruct()->is_audio_muted = browser_host_is_audio_muted; 1191 GetStruct()->execute_java_script = browser_host_execute_java_script; 1192 GetStruct()->set_native_window = browser_host_set_native_window; 1193+ GetStruct()->set_web_debugging_access = browser_host_set_web_debugging_access; 1194+ GetStruct()->get_web_debugging_access = browser_host_get_web_debugging_access; 1195 } 1196 1197 // DESTRUCTOR - Do not edit by hand. 1198diff --git a/src/cef/libcef_dll/cpptoc/dialog_handler_cpptoc.cc b/src/cef/libcef_dll/cpptoc/dialog_handler_cpptoc.cc 1199index 6dcffbb174..e66a9617d4 100644 1200--- a/src/cef/libcef_dll/cpptoc/dialog_handler_cpptoc.cc 1201+++ b/src/cef/libcef_dll/cpptoc/dialog_handler_cpptoc.cc 1202@@ -9,7 +9,7 @@ 1203 // implementations. See the translator.README.txt file in the tools directory 1204 // for more information. 1205 // 1206-// $hash=639576c610ca3898809cdee6d19c45253e9ea4d2$ 1207+// $hash=2f925fbe5bb419b6adf14c4b508c7330ec8dd84a$ 1208 // 1209 1210 #include "libcef_dll/cpptoc/dialog_handler_cpptoc.h" 1211@@ -30,6 +30,7 @@ dialog_handler_on_file_dialog(struct _cef_dialog_handler_t* self, 1212 const cef_string_t* default_file_path, 1213 cef_string_list_t accept_filters, 1214 int selected_accept_filter, 1215+ int capture, 1216 cef_file_dialog_callback_t* callback) { 1217 shutdown_checker::AssertNotShutdown(); 1218 1219@@ -60,7 +61,7 @@ dialog_handler_on_file_dialog(struct _cef_dialog_handler_t* self, 1220 bool _retval = CefDialogHandlerCppToC::Get(self)->OnFileDialog( 1221 CefBrowserCToCpp::Wrap(browser), mode, CefString(title), 1222 CefString(default_file_path), accept_filtersList, selected_accept_filter, 1223- CefFileDialogCallbackCToCpp::Wrap(callback)); 1224+ capture ? true : false, CefFileDialogCallbackCToCpp::Wrap(callback)); 1225 1226 // Return type: bool 1227 return _retval; 1228diff --git a/src/cef/libcef_dll/cpptoc/load_handler_cpptoc.cc b/src/cef/libcef_dll/cpptoc/load_handler_cpptoc.cc 1229index ced6a1faaf..0de3515a46 100644 1230--- a/src/cef/libcef_dll/cpptoc/load_handler_cpptoc.cc 1231+++ b/src/cef/libcef_dll/cpptoc/load_handler_cpptoc.cc 1232@@ -9,7 +9,7 @@ 1233 // implementations. See the translator.README.txt file in the tools directory 1234 // for more information. 1235 // 1236-// $hash=b9eb6961bd51d881bd4b0aff6e1c2ad16de8bc93$ 1237+// $hash=e34f727a8cb722c5ee52932d82790d4252a43dbc$ 1238 // 1239 1240 #include "libcef_dll/cpptoc/load_handler_cpptoc.h" 1241@@ -189,6 +189,38 @@ void CEF_CALLBACK load_handler_on_http_error(struct _cef_load_handler_t* self, 1242 has_user_gesture ? true : false, CefResponseCToCpp::Wrap(response)); 1243 } 1244 1245+void CEF_CALLBACK 1246+load_handler_on_refresh_accessed_history(struct _cef_load_handler_t* self, 1247+ cef_browser_t* browser, 1248+ cef_frame_t* frame, 1249+ const cef_string_t* url, 1250+ int isReload) { 1251+ shutdown_checker::AssertNotShutdown(); 1252+ 1253+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 1254+ 1255+ DCHECK(self); 1256+ if (!self) 1257+ return; 1258+ // Verify param: browser; type: refptr_diff 1259+ DCHECK(browser); 1260+ if (!browser) 1261+ return; 1262+ // Verify param: frame; type: refptr_diff 1263+ DCHECK(frame); 1264+ if (!frame) 1265+ return; 1266+ // Verify param: url; type: string_byref_const 1267+ DCHECK(url); 1268+ if (!url) 1269+ return; 1270+ 1271+ // Execute 1272+ CefLoadHandlerCppToC::Get(self)->OnRefreshAccessedHistory( 1273+ CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), 1274+ CefString(url), isReload ? true : false); 1275+} 1276+ 1277 } // namespace 1278 1279 // CONSTRUCTOR - Do not edit by hand. 1280@@ -201,6 +233,8 @@ CefLoadHandlerCppToC::CefLoadHandlerCppToC() { 1281 GetStruct()->on_load_error_with_request = 1282 load_handler_on_load_error_with_request; 1283 GetStruct()->on_http_error = load_handler_on_http_error; 1284+ GetStruct()->on_refresh_accessed_history = 1285+ load_handler_on_refresh_accessed_history; 1286 } 1287 1288 // DESTRUCTOR - Do not edit by hand. 1289diff --git a/src/cef/libcef_dll/ctocpp/browser_ctocpp.cc b/src/cef/libcef_dll/ctocpp/browser_ctocpp.cc 1290index ab518cb458..51faa16e1d 100644 1291--- a/src/cef/libcef_dll/ctocpp/browser_ctocpp.cc 1292+++ b/src/cef/libcef_dll/ctocpp/browser_ctocpp.cc 1293@@ -9,7 +9,7 @@ 1294 // implementations. See the translator.README.txt file in the tools directory 1295 // for more information. 1296 // 1297-// $hash=669b83a0500ef99c8537d8f00fe746c28e09b31a$ 1298+// $hash=1d64c15697f6087a6931b74f296a37907fbc8dec$ 1299 // 1300 1301 #include "libcef_dll/ctocpp/browser_ctocpp.h" 1302@@ -114,6 +114,19 @@ bool CefBrowserCToCpp::CanGoBackOrForward(int num_steps) { 1303 return _retval ? true : false; 1304 } 1305 1306+NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::DeleteHistory() { 1307+ shutdown_checker::AssertNotShutdown(); 1308+ 1309+ cef_browser_t* _struct = GetStruct(); 1310+ if (CEF_MEMBER_MISSING(_struct, delete_history)) 1311+ return; 1312+ 1313+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 1314+ 1315+ // Execute 1316+ _struct->delete_history(_struct); 1317+} 1318+ 1319 NO_SANITIZE("cfi-icall") bool CefBrowserCToCpp::IsLoading() { 1320 shutdown_checker::AssertNotShutdown(); 1321 1322diff --git a/src/cef/libcef_dll/ctocpp/browser_ctocpp.h b/src/cef/libcef_dll/ctocpp/browser_ctocpp.h 1323index c8ac3665f4..088258f6f0 100644 1324--- a/src/cef/libcef_dll/ctocpp/browser_ctocpp.h 1325+++ b/src/cef/libcef_dll/ctocpp/browser_ctocpp.h 1326@@ -9,7 +9,7 @@ 1327 // implementations. See the translator.README.txt file in the tools directory 1328 // for more information. 1329 // 1330-// $hash=5a8d946ed143178608c22b2952d6f82e46b52976$ 1331+// $hash=02e030f24314da7dc9c9c85b0247b9389730bfaf$ 1332 // 1333 1334 #ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_CTOCPP_H_ 1335@@ -42,6 +42,7 @@ class CefBrowserCToCpp 1336 bool CanGoForward() OVERRIDE; 1337 void GoForward() OVERRIDE; 1338 bool CanGoBackOrForward(int num_steps) OVERRIDE; 1339+ void DeleteHistory() OVERRIDE; 1340 bool IsLoading() OVERRIDE; 1341 void Reload() OVERRIDE; 1342 void ReloadIgnoreCache() OVERRIDE; 1343diff --git a/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.cc b/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.cc 1344index 5b6ff83734..5f6f8b5d02 100644 1345--- a/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.cc 1346+++ b/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.cc 1347@@ -9,7 +9,7 @@ 1348 // implementations. See the translator.README.txt file in the tools directory 1349 // for more information. 1350 // 1351-// $hash=dcd2dbff40a3be4939f946075675080ac88e9441$ 1352+// $hash=87bb5126d6b4b3bd34ed78af087e3afd803d2dcd$ 1353 // 1354 1355 #include "libcef_dll/ctocpp/browser_host_ctocpp.h" 1356@@ -1450,6 +1450,36 @@ void CefBrowserHostCToCpp::SetNativeWindow(cef_native_window_t window) { 1357 _struct->set_native_window(_struct, window); 1358 } 1359 1360+NO_SANITIZE("cfi-icall") 1361+void CefBrowserHostCToCpp::SetWebDebuggingAccess(bool isEnableDebug) { 1362+ shutdown_checker::AssertNotShutdown(); 1363+ 1364+ cef_browser_host_t* _struct = GetStruct(); 1365+ if (CEF_MEMBER_MISSING(_struct, set_web_debugging_access)) 1366+ return; 1367+ 1368+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 1369+ 1370+ // Execute 1371+ _struct->set_web_debugging_access(_struct, isEnableDebug); 1372+} 1373+ 1374+NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::GetWebDebuggingAccess() { 1375+ shutdown_checker::AssertNotShutdown(); 1376+ 1377+ cef_browser_host_t* _struct = GetStruct(); 1378+ if (CEF_MEMBER_MISSING(_struct, get_web_debugging_access)) 1379+ return false; 1380+ 1381+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 1382+ 1383+ // Execute 1384+ int _retval = _struct->get_web_debugging_access(_struct); 1385+ 1386+ // Return type: bool 1387+ return _retval ? true : false; 1388+} 1389+ 1390 // CONSTRUCTOR - Do not edit by hand. 1391 1392 CefBrowserHostCToCpp::CefBrowserHostCToCpp() {} 1393diff --git a/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.h b/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.h 1394index fd85705cfb..bb2fe2c254 100644 1395--- a/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.h 1396+++ b/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.h 1397@@ -9,7 +9,7 @@ 1398 // implementations. See the translator.README.txt file in the tools directory 1399 // for more information. 1400 // 1401-// $hash=aca73f8ef9bcd54b300b1772d1115a32bf270084$ 1402+// $hash=55f32c914962cf44aa47185731a5049c27887223$ 1403 // 1404 1405 #ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_ 1406@@ -162,6 +162,8 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp, 1407 const CefString& code, 1408 CefRefPtr<CefJavaScriptResultCallback> callback) OVERRIDE; 1409 void SetNativeWindow(cef_native_window_t window) OVERRIDE; 1410+ void SetWebDebuggingAccess(bool isEnableDebug) OVERRIDE; 1411+ bool GetWebDebuggingAccess() OVERRIDE; 1412 }; 1413 1414 #endif // CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_ 1415diff --git a/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.cc b/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.cc 1416index 3377b564ca..2cb31ef563 100644 1417--- a/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.cc 1418+++ b/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.cc 1419@@ -9,7 +9,7 @@ 1420 // implementations. See the translator.README.txt file in the tools directory 1421 // for more information. 1422 // 1423-// $hash=cac933371fc47c864230d4537ef1da76cd7e4d8e$ 1424+// $hash=df2505130721df8255b0d5bd511fb8ef394a7d8e$ 1425 // 1426 1427 #include "libcef_dll/ctocpp/dialog_handler_ctocpp.h" 1428@@ -28,6 +28,7 @@ bool CefDialogHandlerCToCpp::OnFileDialog( 1429 const CefString& default_file_path, 1430 const std::vector<CefString>& accept_filters, 1431 int selected_accept_filter, 1432+ bool capture, 1433 CefRefPtr<CefFileDialogCallback> callback) { 1434 shutdown_checker::AssertNotShutdown(); 1435 1436@@ -61,7 +62,7 @@ bool CefDialogHandlerCToCpp::OnFileDialog( 1437 int _retval = _struct->on_file_dialog( 1438 _struct, CefBrowserCppToC::Wrap(browser), mode, title.GetStruct(), 1439 default_file_path.GetStruct(), accept_filtersList, selected_accept_filter, 1440- CefFileDialogCallbackCppToC::Wrap(callback)); 1441+ capture, CefFileDialogCallbackCppToC::Wrap(callback)); 1442 1443 // Restore param:accept_filters; type: string_vec_byref_const 1444 if (accept_filtersList) 1445diff --git a/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.h b/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.h 1446index f2e0798a16..6ebdca5539 100644 1447--- a/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.h 1448+++ b/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.h 1449@@ -9,7 +9,7 @@ 1450 // implementations. See the translator.README.txt file in the tools directory 1451 // for more information. 1452 // 1453-// $hash=4c07a40d3bd171adf3ae3cc4aa935bc7eca4aa5e$ 1454+// $hash=fb268437c35b6a412dc6305ae83798d4d1db56d6$ 1455 // 1456 1457 #ifndef CEF_LIBCEF_DLL_CTOCPP_DIALOG_HANDLER_CTOCPP_H_ 1458@@ -42,6 +42,7 @@ class CefDialogHandlerCToCpp 1459 const CefString& default_file_path, 1460 const std::vector<CefString>& accept_filters, 1461 int selected_accept_filter, 1462+ bool capture, 1463 CefRefPtr<CefFileDialogCallback> callback) override; 1464 }; 1465 1466diff --git a/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.cc b/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.cc 1467index ea239aadf4..08557dfba6 100644 1468--- a/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.cc 1469+++ b/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.cc 1470@@ -9,7 +9,7 @@ 1471 // implementations. See the translator.README.txt file in the tools directory 1472 // for more information. 1473 // 1474-// $hash=a815207886f2b474bff70f4f988a4407bcb3d42a$ 1475+// $hash=ad518c31633727cce6a14d2b17c06370c05b4426$ 1476 // 1477 1478 #include "libcef_dll/ctocpp/load_handler_ctocpp.h" 1479@@ -187,6 +187,39 @@ void CefLoadHandlerCToCpp::OnHttpError(CefRefPtr<CefRequest> request, 1480 CefResponseCppToC::Wrap(response)); 1481 } 1482 1483+NO_SANITIZE("cfi-icall") 1484+void CefLoadHandlerCToCpp::OnRefreshAccessedHistory( 1485+ CefRefPtr<CefBrowser> browser, 1486+ CefRefPtr<CefFrame> frame, 1487+ const CefString& url, 1488+ bool isReload) { 1489+ shutdown_checker::AssertNotShutdown(); 1490+ 1491+ cef_load_handler_t* _struct = GetStruct(); 1492+ if (CEF_MEMBER_MISSING(_struct, on_refresh_accessed_history)) 1493+ return; 1494+ 1495+ // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING 1496+ 1497+ // Verify param: browser; type: refptr_diff 1498+ DCHECK(browser.get()); 1499+ if (!browser.get()) 1500+ return; 1501+ // Verify param: frame; type: refptr_diff 1502+ DCHECK(frame.get()); 1503+ if (!frame.get()) 1504+ return; 1505+ // Verify param: url; type: string_byref_const 1506+ DCHECK(!url.empty()); 1507+ if (url.empty()) 1508+ return; 1509+ 1510+ // Execute 1511+ _struct->on_refresh_accessed_history(_struct, CefBrowserCppToC::Wrap(browser), 1512+ CefFrameCppToC::Wrap(frame), 1513+ url.GetStruct(), isReload); 1514+} 1515+ 1516 // CONSTRUCTOR - Do not edit by hand. 1517 1518 CefLoadHandlerCToCpp::CefLoadHandlerCToCpp() {} 1519diff --git a/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.h b/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.h 1520index 0ef91fc464..021bf5e2eb 100644 1521--- a/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.h 1522+++ b/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.h 1523@@ -9,7 +9,7 @@ 1524 // implementations. See the translator.README.txt file in the tools directory 1525 // for more information. 1526 // 1527-// $hash=dcaaaa3afd30e1e4be34e0d22cedacddc71e41d0$ 1528+// $hash=f2e44ce99b154e3bbfaafd462eb29cbcce01812e$ 1529 // 1530 1531 #ifndef CEF_LIBCEF_DLL_CTOCPP_LOAD_HANDLER_CTOCPP_H_ 1532@@ -58,6 +58,10 @@ class CefLoadHandlerCToCpp : public CefCToCppRefCounted<CefLoadHandlerCToCpp, 1533 bool is_main_frame, 1534 bool has_user_gesture, 1535 CefRefPtr<CefResponse> response) override; 1536+ void OnRefreshAccessedHistory(CefRefPtr<CefBrowser> browser, 1537+ CefRefPtr<CefFrame> frame, 1538+ const CefString& url, 1539+ bool isReload) override; 1540 }; 1541 1542 #endif // CEF_LIBCEF_DLL_CTOCPP_LOAD_HANDLER_CTOCPP_H_ 1543diff --git a/src/content/browser/BUILD.gn b/src/content/browser/BUILD.gn 1544index 157b489c3a..1fe4988fdc 100644 1545--- a/src/content/browser/BUILD.gn 1546+++ b/src/content/browser/BUILD.gn 1547@@ -2206,6 +2206,7 @@ source_set("browser") { 1548 "memory/swap_metrics_driver_impl_linux.h", 1549 "speech/tts_ohos.cc", 1550 ] 1551+ defines += [ "ABILITY_COMMAND_FOR_TEST" ] 1552 public_deps += [ "//components/services/font/public/mojom" ] 1553 } 1554 1555diff --git a/src/content/browser/child_process_launcher_helper.h b/src/content/browser/child_process_launcher_helper.h 1556index 7b78341112..2417be960c 100644 1557--- a/src/content/browser/child_process_launcher_helper.h 1558+++ b/src/content/browser/child_process_launcher_helper.h 1559@@ -217,6 +217,10 @@ class ChildProcessLauncherHelper : 1560 } 1561 #endif 1562 1563+#if defined(OS_OHOS) 1564+ base::TerminationStatus GetProcessStatusByExitCode(int status); 1565+#endif 1566+ 1567 const int child_process_id_; 1568 const scoped_refptr<base::SequencedTaskRunner> client_task_runner_; 1569 base::TimeTicks begin_launch_time_; 1570diff --git a/src/content/browser/child_process_launcher_helper_linux.cc b/src/content/browser/child_process_launcher_helper_linux.cc 1571index 422d3a0183..e431f56d51 100644 1572--- a/src/content/browser/child_process_launcher_helper_linux.cc 1573+++ b/src/content/browser/child_process_launcher_helper_linux.cc 1574@@ -2,6 +2,10 @@ 1575 // Use of this source code is governed by a BSD-style license that can be 1576 // found in the LICENSE file. 1577 1578+#include <signal.h> 1579+#include <sys/types.h> 1580+#include <sys/wait.h> 1581+ 1582 #include "base/path_service.h" 1583 #include "base/posix/global_descriptors.h" 1584 #include "build/build_config.h" 1585@@ -140,6 +144,40 @@ void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread( 1586 const base::LaunchOptions& options) { 1587 } 1588 1589+#if defined(OS_OHOS) 1590+base::TerminationStatus ChildProcessLauncherHelper::GetProcessStatusByExitCode(int status) { 1591+ if (WIFSIGNALED(status)) { 1592+ switch (WTERMSIG(status)) { 1593+ case SIGABRT: 1594+ case SIGBUS: 1595+ case SIGFPE: 1596+ case SIGILL: 1597+ case SIGSEGV: 1598+ case SIGTRAP: 1599+ case SIGSYS: 1600+ return base::TERMINATION_STATUS_PROCESS_CRASHED; 1601+ case SIGKILL: 1602+#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) 1603+ // On ChromeOS, only way a process gets kill by SIGKILL 1604+ // is by oom-killer. 1605+ return TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM; 1606+#endif 1607+ case SIGINT: 1608+ case SIGTERM: 1609+ return base::TERMINATION_STATUS_PROCESS_WAS_KILLED; 1610+ default: 1611+ break; 1612+ } 1613+ } 1614+ 1615+ if (WIFEXITED(status) && WEXITSTATUS(status) != 0) { 1616+ return base::TERMINATION_STATUS_ABNORMAL_TERMINATION; 1617+ } 1618+ 1619+ return base::TERMINATION_STATUS_NORMAL_TERMINATION; 1620+} 1621+#endif 1622+ 1623 ChildProcessTerminationInfo ChildProcessLauncherHelper::GetTerminationInfo( 1624 const ChildProcessLauncherHelper::Process& process, 1625 bool known_dead) { 1626@@ -147,6 +185,18 @@ ChildProcessTerminationInfo ChildProcessLauncherHelper::GetTerminationInfo( 1627 if (process.zygote) { 1628 info.status = process.zygote->GetTerminationStatus( 1629 process.process.Handle(), known_dead, &info.exit_code); 1630+ #if defined(OS_OHOS) 1631+ } else if (app_mgr_client_) { 1632+ int exitStatus; 1633+ int ret = app_mgr_client_->GetRenderProcessTerminationStatus(process.process.Handle(), exitStatus); 1634+ if (ret != 0) { 1635+ LOG(ERROR) << "get render process termination status failed, ret = " << ret; 1636+ } else if (exitStatus < 0) { 1637+ LOG(ERROR) << "get render process termination status success, invalid status = " << exitStatus; 1638+ } else { 1639+ info.status = GetProcessStatusByExitCode(exitStatus); 1640+ } 1641+#endif 1642 } else if (known_dead) { 1643 info.status = base::GetKnownDeadTerminationStatus(process.process.Handle(), 1644 &info.exit_code); 1645diff --git a/src/content/browser/devtools/devtools_http_handler.cc b/src/content/browser/devtools/devtools_http_handler.cc 1646index ab3f19563d..774fa4f6a2 100644 1647--- a/src/content/browser/devtools/devtools_http_handler.cc 1648+++ b/src/content/browser/devtools/devtools_http_handler.cc 1649@@ -278,6 +278,7 @@ void StartServerOnHandlerThread( 1650 browser_guid.c_str()); 1651 fprintf(stderr, "%s", message.c_str()); 1652 fflush(stderr); 1653+ LOG(INFO) << "start devtools listening ok, " << message; 1654 1655 // Write this port to a well-known file in the profile directory 1656 // so Telemetry, ChromeDriver, etc. can pick it up. 1657diff --git a/src/content/browser/portal/portal.cc b/src/content/browser/portal/portal.cc 1658old mode 100644 1659new mode 100755 1660index 2565b98545..aef23d7854 1661--- a/src/content/browser/portal/portal.cc 1662+++ b/src/content/browser/portal/portal.cc 1663@@ -606,6 +606,11 @@ void Portal::ActivateImpl(blink::TransferableMessage data, 1664 devtools_instrumentation::PortalActivated(outer_contents->GetMainFrame()); 1665 successor_contents_raw->set_portal(nullptr); 1666 1667+ // It's important we call this before destroying the outer contents' 1668+ // RenderWidgetHostView, otherwise the dialog may not be cleaned up correctly. 1669+ // See crbug.com/1292261 for more details. 1670+ outer_contents->CancelActiveAndPendingDialogs(); 1671+ 1672 std::unique_ptr<WebContents> predecessor_web_contents = 1673 delegate->ActivatePortalWebContents(outer_contents, 1674 std::move(successor_contents)); 1675diff --git a/src/content/browser/storage_partition_impl.cc b/src/content/browser/storage_partition_impl.cc 1676index 7a517fe224..1d2f3e190a 100755 1677--- a/src/content/browser/storage_partition_impl.cc 1678+++ b/src/content/browser/storage_partition_impl.cc 1679@@ -12,6 +12,9 @@ 1680 #include <utility> 1681 #include <vector> 1682 1683+#include <unistd.h> 1684+#include <thread> 1685+ 1686 #include "base/barrier_closure.h" 1687 #include "base/bind.h" 1688 #include "base/callback_helpers.h" 1689@@ -1382,6 +1385,32 @@ StoragePartitionImpl::GetCookieManagerForBrowserProcess() { 1690 return cookie_manager_for_browser_process_.get(); 1691 } 1692 1693+#if defined(OS_OHOS) 1694+network::mojom::CookieManager* 1695+StoragePartitionImpl::GetCookieManagerForOhos() { 1696+ DCHECK(initialized_); 1697+ // Create the CookieManager remote for ohos as needed. 1698+ if (!cookie_manager_for_ohos_ || 1699+ !cookie_manager_for_ohos_.is_connected()) { 1700+ // Reset |cookie_manager_for_ohos_| before binding it again. 1701+ 1702+ cookie_manager_for_ohos_.reset(); 1703+ GetIOThreadTaskRunner({})->PostTask( 1704+ FROM_HERE, 1705+ base::BindOnce(&StoragePartitionImpl::GetCookieManagerForOhosInternal, 1706+ base::Unretained(this))); 1707+ completion_.Wait(); 1708+ } 1709+ return cookie_manager_for_ohos_.get(); 1710+} 1711+ 1712+void StoragePartitionImpl::GetCookieManagerForOhosInternal() { 1713+ GetNetworkContext()->GetCookieManager( 1714+ cookie_manager_for_ohos_.BindNewPipeAndPassReceiver()); 1715+ completion_.Signal(); 1716+} 1717+#endif 1718+ 1719 void StoragePartitionImpl::CreateRestrictedCookieManager( 1720 network::mojom::RestrictedCookieManagerRole role, 1721 const url::Origin& origin, 1722diff --git a/src/content/browser/storage_partition_impl.h b/src/content/browser/storage_partition_impl.h 1723index 39ad00ebb1..eb7fac8d2f 100644 1724--- a/src/content/browser/storage_partition_impl.h 1725+++ b/src/content/browser/storage_partition_impl.h 1726@@ -11,6 +11,11 @@ 1727 #include <memory> 1728 #include <string> 1729 1730+#if defined(OS_OHOS) 1731+#include "base/synchronization/lock.h" 1732+#include "base/synchronization/waitable_event.h" 1733+#endif 1734+ 1735 #include "base/compiler_specific.h" 1736 #include "base/containers/flat_map.h" 1737 #include "base/containers/flat_set.h" 1738@@ -140,6 +145,7 @@ class CONTENT_EXPORT StoragePartitionImpl 1739 std::unique_ptr<network::PendingSharedURLLoaderFactory> 1740 GetURLLoaderFactoryForBrowserProcessIOThread() override; 1741 network::mojom::CookieManager* GetCookieManagerForBrowserProcess() override; 1742+ network::mojom::CookieManager* GetCookieManagerForOhos() override; 1743 void CreateHasTrustTokensAnswerer( 1744 mojo::PendingReceiver<network::mojom::HasTrustTokensAnswerer> receiver, 1745 const url::Origin& top_frame_origin) override; 1746@@ -502,6 +508,10 @@ class CONTENT_EXPORT StoragePartitionImpl 1747 // OnLocalTrustTokenFulfillerConnectionError. 1748 void ProvisionallyBindUnboundLocalTrustTokenFulfillerIfSupportedBySystem(); 1749 1750+#if defined(OS_OHOS) 1751+ void GetCookieManagerForOhosInternal(); 1752+#endif 1753+ 1754 // Raw pointer that should always be valid. The BrowserContext owns the 1755 // StoragePartitionImplMap which then owns StoragePartitionImpl. When the 1756 // BrowserContext is destroyed, |this| will be destroyed too. 1757@@ -603,6 +613,12 @@ class CONTENT_EXPORT StoragePartitionImpl 1758 bool is_test_url_loader_factory_for_browser_process_with_corb_ = false; 1759 mojo::Remote<network::mojom::CookieManager> 1760 cookie_manager_for_browser_process_; 1761+#if defined(OS_OHOS) 1762+ mojo::Remote<network::mojom::CookieManager> 1763+ cookie_manager_for_ohos_; 1764+ base::WaitableEvent completion_{base::WaitableEvent::ResetPolicy::AUTOMATIC, 1765+ base::WaitableEvent::InitialState::NOT_SIGNALED}; 1766+#endif 1767 mojo::Remote<network::mojom::OriginPolicyManager> 1768 origin_policy_manager_for_browser_process_; 1769 1770diff --git a/src/content/common/cursors/webcursor.cc b/src/content/common/cursors/webcursor.cc 1771index a9d5a6f64f..e5a4e709ea 100644 1772--- a/src/content/common/cursors/webcursor.cc 1773+++ b/src/content/common/cursors/webcursor.cc 1774@@ -32,16 +32,19 @@ WebCursor& WebCursor::operator=(const WebCursor& other) { 1775 } 1776 1777 bool WebCursor::SetCursor(const ui::Cursor& cursor) { 1778- static constexpr int kMaxSize = 1024; 1779+ // This value is just large enough to accommodate: 1780+ // - kMaximumCursorSize in Blink's EventHandler 1781+ // - kCursorSize in Chrome's DevToolsEyeDropper 1782+ static constexpr int kMaximumCursorSize = 150; 1783 if (cursor.image_scale_factor() < 0.01f || 1784 cursor.image_scale_factor() > 100.f || 1785 (cursor.type() == ui::mojom::CursorType::kCustom && 1786- (cursor.custom_bitmap().width() > kMaxSize || 1787- cursor.custom_bitmap().height() > kMaxSize || 1788+ (cursor.custom_bitmap().width() > kMaximumCursorSize || 1789+ cursor.custom_bitmap().height() > kMaximumCursorSize || 1790 cursor.custom_bitmap().width() / cursor.image_scale_factor() > 1791- kMaxSize || 1792+ kMaximumCursorSize || 1793 cursor.custom_bitmap().height() / cursor.image_scale_factor() > 1794- kMaxSize))) { 1795+ kMaximumCursorSize))) { 1796 return false; 1797 } 1798 1799diff --git a/src/content/common/cursors/webcursor_mac.mm b/src/content/common/cursors/webcursor_mac.mm 1800index 2d269dff5f..3359c8033e 100644 1801--- a/src/content/common/cursors/webcursor_mac.mm 1802+++ b/src/content/common/cursors/webcursor_mac.mm 1803@@ -261,6 +261,7 @@ gfx::NativeCursor WebCursor::GetNativeCursor() { 1804 case ui::mojom::CursorType::kCustom: 1805 return CreateCustomCursor(cursor_); 1806 case ui::mojom::CursorType::kNull: 1807+ return [NSCursor arrowCursor]; 1808 case ui::mojom::CursorType::kDndNone: 1809 case ui::mojom::CursorType::kDndMove: 1810 case ui::mojom::CursorType::kDndCopy: 1811diff --git a/src/content/common/cursors/webcursor_unittest.cc b/src/content/common/cursors/webcursor_unittest.cc 1812index b3e0eb250e..42bfc2445e 100644 1813--- a/src/content/common/cursors/webcursor_unittest.cc 1814+++ b/src/content/common/cursors/webcursor_unittest.cc 1815@@ -137,11 +137,11 @@ TEST(WebCursorTest, SetCursor) { 1816 1817 // SetCursor should return false when the image width is too large. 1818 cursor.set_image_scale_factor(1.f); 1819- cursor.set_custom_bitmap(CreateTestBitmap(1025, 3)); 1820+ cursor.set_custom_bitmap(CreateTestBitmap(151, 3)); 1821 EXPECT_FALSE(webcursor.SetCursor(cursor)); 1822 1823 // SetCursor should return false when the image height is too large. 1824- cursor.set_custom_bitmap(CreateTestBitmap(3, 1025)); 1825+ cursor.set_custom_bitmap(CreateTestBitmap(3, 151)); 1826 EXPECT_FALSE(webcursor.SetCursor(cursor)); 1827 1828 // SetCursor should return false when the scaled image width is too large. 1829@@ -151,7 +151,7 @@ TEST(WebCursorTest, SetCursor) { 1830 1831 // SetCursor should return false when the scaled image height is too large. 1832 cursor.set_image_scale_factor(0.1f); 1833- cursor.set_custom_bitmap(CreateTestBitmap(5, 200)); 1834+ cursor.set_custom_bitmap(CreateTestBitmap(5, 20)); 1835 EXPECT_FALSE(webcursor.SetCursor(cursor)); 1836 } 1837 1838diff --git a/src/content/public/browser/storage_partition.h b/src/content/public/browser/storage_partition.h 1839index 2c21c9721c..e3eb244941 100644 1840--- a/src/content/public/browser/storage_partition.h 1841+++ b/src/content/public/browser/storage_partition.h 1842@@ -113,7 +113,10 @@ class CONTENT_EXPORT StoragePartition { 1843 GetURLLoaderFactoryForBrowserProcessIOThread() = 0; 1844 virtual network::mojom::CookieManager* 1845 GetCookieManagerForBrowserProcess() = 0; 1846- 1847+#if defined(OS_OHOS) 1848+ virtual network::mojom::CookieManager* 1849+ GetCookieManagerForOhos() = 0; 1850+#endif 1851 virtual void CreateHasTrustTokensAnswerer( 1852 mojo::PendingReceiver<network::mojom::HasTrustTokensAnswerer> receiver, 1853 const url::Origin& top_frame_origin) = 0; 1854diff --git a/src/content/renderer/BUILD.gn b/src/content/renderer/BUILD.gn 1855index 9325b96383..0d8c076803 100644 1856--- a/src/content/renderer/BUILD.gn 1857+++ b/src/content/renderer/BUILD.gn 1858@@ -36,6 +36,7 @@ if (is_ohos) { 1859 ] 1860 include_dirs = ohos_src_includes 1861 lib_dirs = ohos_libs_dir 1862+ defines = [ "ABILITY_COMMAND_FOR_TEST" ] 1863 } 1864 } 1865 1866diff --git a/src/content/renderer/media/ohos/ohos_media_player_renderer_client.cc b/src/content/renderer/media/ohos/ohos_media_player_renderer_client.cc 1867index ae4c206382..60b5889189 100644 1868--- a/src/content/renderer/media/ohos/ohos_media_player_renderer_client.cc 1869+++ b/src/content/renderer/media/ohos/ohos_media_player_renderer_client.cc 1870@@ -136,8 +136,9 @@ void OHOSMediaPlayerRendererClient::OnFrameUpdate( 1871 << " coded_width:" << coded_width 1872 << " coded_height:" << coded_height 1873 << " visible_width:" << visible_width 1874- << " visible_height:" << visible_height 1875- << " format:" << src_format << " size:" << buffer_size; 1876+ << " visible_height:" << visible_height << " fd:" << fd 1877+ << " mapped:" << (void*)mapped << " format:" << src_format 1878+ << " size:" << buffer_size; 1879 } 1880 gfx::Size coded_size = gfx::Size(coded_width, coded_height); 1881 gfx::Rect visible_rect = gfx::Rect(0, 0, visible_width, visible_height); 1882diff --git a/src/content/renderer/render_remote_proxy.cc b/src/content/renderer/render_remote_proxy.cc 1883index 2fada4e83b..858d5e4c01 100644 1884--- a/src/content/renderer/render_remote_proxy.cc 1885+++ b/src/content/renderer/render_remote_proxy.cc 1886@@ -65,14 +65,22 @@ bool RenderRemoteProxy::WaitForBrowserFd() { 1887 } 1888 LOG(INFO) << "wait for browser fd start"; 1889 std::unique_lock<std::mutex> lk(browser_fd_mtx_); 1890- constexpr int kTimeOutDur = 5; // seconds 1891- if (!browser_fd_cv_.wait_for(lk, std::chrono::seconds(kTimeOutDur), 1892- []() { return is_browser_fd_received_; })) { 1893- LOG(ERROR) << "wait for browser fd timeout(" << kTimeOutDur << "s)"; 1894- return false; 1895+ constexpr uint32_t kTimeOutDur = 10; // milliseconds 1896+ constexpr uint32_t kMaxWaitCount = 10; 1897+ uint32_t wait_count = 0; 1898+ while (++wait_count <= kMaxWaitCount) { 1899+ if (!browser_fd_cv_.wait_for(lk, std::chrono::milliseconds(kTimeOutDur), 1900+ []() { return is_browser_fd_received_; })) { 1901+ LOG(INFO) << "retry AttachRenderProcess for " << wait_count << "time"; 1902+ g_app_mgr_client->AttachRenderProcess(g_render_remote_proxy); 1903+ } else { 1904+ LOG(INFO) << "success, wait for browser fd end"; 1905+ return true; 1906+ } 1907 } 1908- LOG(INFO) << "wait for browser fd end"; 1909- return true; 1910+ LOG(ERROR) << "wait for browser fd timeout(" << (kTimeOutDur * kMaxWaitCount) 1911+ << "ms)"; 1912+ return false; 1913 } 1914 1915 } // namespace content 1916\ No newline at end of file 1917diff --git a/src/media/base/ohos/BUILD.gn b/src/media/base/ohos/BUILD.gn 1918index 96b060fe0a..0d19eac123 100644 1919--- a/src/media/base/ohos/BUILD.gn 1920+++ b/src/media/base/ohos/BUILD.gn 1921@@ -19,6 +19,11 @@ if (is_ohos) { 1922 "ohos_media_player_listener.h", 1923 ] 1924 configs += [ "//media:subcomponent_config" ] 1925+ 1926+ if (product_name == "rk3568") { 1927+ defines = [ "RK3568" ] 1928+ } 1929+ 1930 deps = [ 1931 "//media/base", 1932 "//url", 1933diff --git a/src/media/base/ohos/ohos_media_player_bridge.cc b/src/media/base/ohos/ohos_media_player_bridge.cc 1934index 5c1a893b31..03a1d08bb2 100644 1935--- a/src/media/base/ohos/ohos_media_player_bridge.cc 1936+++ b/src/media/base/ohos/ohos_media_player_bridge.cc 1937@@ -139,10 +139,17 @@ void OHOSMediaPlayerBridge::FinishPaint(int fd) { 1938 return; 1939 } 1940 1941+#if defined(RK3568) 1942+ if (cached_buffers_.front()->GetBufferHandle()->fd != fd) { 1943+ LOG(ERROR) << "match fd error render fd=" << fd << " browser fd=" 1944+ << cached_buffers_.front()->GetBufferHandle()->fd; 1945+ } 1946+#else 1947 if (cached_buffers_.front()->GetBufferHandle()->reserve[0] != fd) { 1948 LOG(ERROR) << "match fd error render fd=" << fd << " browser fd=" 1949 << cached_buffers_.front()->GetBufferHandle()->reserve[0]; 1950 } 1951+#endif 1952 OHOS::SurfaceError ret = 1953 consumer_surface_->ReleaseBuffer(cached_buffers_.front(), -1); 1954 if (ret != OHOS::SURFACE_ERROR_OK) { 1955@@ -188,6 +195,25 @@ void OHOSMediaPlayerBridge::OnBufferAvailable( 1956 return; 1957 } 1958 1959+#if defined(RK3568) 1960+ int fd = buffer->GetBufferHandle()->fd; 1961+#else 1962+ int fd = buffer->GetBufferHandle()->reserve[0]; 1963+#endif 1964+ if (fd <= 0) { 1965+ LOG(ERROR) << "surface buffer fd error fd:" << fd; 1966+ OHOS::SurfaceError ret = consumer_surface_->ReleaseBuffer(buffer, -1); 1967+ if (ret != OHOS::SURFACE_ERROR_OK) { 1968+ LOG(ERROR) << "release buffer fail, ret=" << ret; 1969+ } 1970+ return; 1971+ } 1972+ 1973+#if defined(RK3568) 1974+ client_->OnFrameAvailable(fd, buffer->GetSize(), buffer->GetWidth(), 1975+ buffer->GetHeight(), buffer->GetWidth(), 1976+ buffer->GetHeight(), buffer->GetFormat()); 1977+#else 1978 int32_t coded_height; 1979 int32_t coded_width; 1980 1981@@ -205,10 +231,10 @@ void OHOSMediaPlayerBridge::OnBufferAvailable( 1982 } else { 1983 coded_width = buffer->GetStride(); 1984 } 1985- client_->OnFrameAvailable(buffer->GetBufferHandle()->reserve[0], 1986- buffer->GetSize(), coded_width, coded_height, 1987+ client_->OnFrameAvailable(fd, buffer->GetSize(), coded_width, coded_height, 1988 buffer->GetWidth(), buffer->GetHeight(), 1989 buffer->GetFormat()); 1990+#endif 1991 cached_buffers_.push_back(buffer); 1992 } 1993 1994diff --git a/src/ohos_ndk_aosp/toolchains/clang-r353983c/bin/clang-9 b/src/ohos_ndk_aosp/toolchains/clang-r353983c/bin/clang-9 1995index 220a0cc764..f33e058e95 100755 1996Binary files a/src/ohos_ndk_aosp/toolchains/clang-r353983c/bin/clang-9 and b/src/ohos_ndk_aosp/toolchains/clang-r353983c/bin/clang-9 differ 1997diff --git a/src/ohos_nweb/BUILD.gn b/src/ohos_nweb/BUILD.gn 1998index e53fb88534..c8b528bdb1 100644 1999--- a/src/ohos_nweb/BUILD.gn 2000+++ b/src/ohos_nweb/BUILD.gn 2001@@ -1,6 +1,15 @@ 2002-# Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2003-# Use of this source code is governed by a BSD-style license that can be 2004-# found in the LICENSE file. 2005+# Copyright (c) 2022 Huawei Device Co., Ltd. 2006+# Licensed under the Apache License, Version 2.0 (the "License"); 2007+# you may not use this file except in compliance with the License. 2008+# You may obtain a copy of the License at 2009+# 2010+# http://www.apache.org/licenses/LICENSE-2.0 2011+# 2012+# Unless required by applicable law or agreed to in writing, software 2013+# distributed under the License is distributed on an "AS IS" BASIS, 2014+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2015+# See the License for the specific language governing permissions and 2016+# limitations under the License. 2017 2018 import("//build/buildflag_header.gni") 2019 import("//build/config/features.gni") 2020@@ -63,6 +72,8 @@ component("cef_nweb") { 2021 "src/cef_delegate/nweb_render_handler.cc", 2022 "src/cef_delegate/nweb_event_handler.h", 2023 "src/cef_delegate/nweb_event_handler.cc", 2024+ "src/cef_delegate/nweb_file_selector_params_impl.h", 2025+ "src/cef_delegate/nweb_file_selector_params_impl.cc", 2026 "src/cef_delegate/nweb_js_dialog_result_impl.cc", 2027 "src/cef_delegate/nweb_js_dialog_result_impl.h", 2028 "src/cef_delegate/nweb_geolocation_callback.h", 2029@@ -94,6 +105,10 @@ config("nweb_config") { 2030 "USE_CEF", 2031 ] 2032 2033+ if (product_name == "rk3568") { 2034+ defines += [ "GPU_RK3568" ] 2035+ } 2036+ 2037 include_dirs = [ 2038 "include", 2039 "src", 2040@@ -210,4 +225,4 @@ shared_library("libnweb_render") { 2041 "//cef:libweb_engine", 2042 "//cef:libcef_dll_wrapper", 2043 ] 2044-} 2045\ No newline at end of file 2046+} 2047diff --git a/src/ohos_nweb/include/nweb.h b/src/ohos_nweb/include/nweb.h 2048index fbf54eaac3..ebc8a83f55 100755 2049--- a/src/ohos_nweb/include/nweb.h 2050+++ b/src/ohos_nweb/include/nweb.h 2051@@ -1,6 +1,17 @@ 2052-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2053-// Use of this source code is governed by a BSD-style license that can be 2054-// found in the LICENSE file. 2055+/* 2056+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2057+ * Licensed under the Apache License, Version 2.0 (the "License"); 2058+ * you may not use this file except in compliance with the License. 2059+ * You may obtain a copy of the License at 2060+ * 2061+ * http://www.apache.org/licenses/LICENSE-2.0 2062+ * 2063+ * Unless required by applicable law or agreed to in writing, software 2064+ * distributed under the License is distributed on an "AS IS" BASIS, 2065+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2066+ * See the License for the specific language governing permissions and 2067+ * limitations under the License. 2068+ */ 2069 2070 #ifndef NWEB_H 2071 #define NWEB_H 2072@@ -37,11 +48,11 @@ struct OHOS_NWEB_EXPORT NWebCreateInfo { 2073 std::function<bool(const char*, uint32_t, uint32_t)> output_render_frame = 2074 nullptr; 2075 2076- /* rs producer surface, for acquiring elgsurface from ohos */ 2077- void *producer_surface = nullptr; 2078- 2079 /* init args */ 2080 NWebInitArgs init_args; 2081+ 2082+ /* rs producer surface, for acquiring elgsurface from ohos */ 2083+ void *producer_surface = nullptr; 2084 }; 2085 2086 class OHOS_NWEB_EXPORT NWeb : public std::enable_shared_from_this<NWeb> { 2087@@ -103,6 +114,10 @@ class OHOS_NWEB_EXPORT NWeb : public std::enable_shared_from_this<NWeb> { 2088 * 2089 */ 2090 virtual void NavigateForward() const = 0; 2091+ /** 2092+ * Delete back and forward history list. 2093+ */ 2094+ virtual void DeleteNavigateHistory() = 0; 2095 /** 2096 * Reloads the current URL. 2097 * 2098diff --git a/src/ohos_nweb/include/nweb_access_request.h b/src/ohos_nweb/include/nweb_access_request.h 2099index 6592ba26ee..6a08dd8c44 100644 2100--- a/src/ohos_nweb/include/nweb_access_request.h 2101+++ b/src/ohos_nweb/include/nweb_access_request.h 2102@@ -1,6 +1,17 @@ 2103-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2104-// Use of this source code is governed by a BSD-style license that can be 2105-// found in the LICENSE file. 2106+/* 2107+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2108+ * Licensed under the Apache License, Version 2.0 (the "License"); 2109+ * you may not use this file except in compliance with the License. 2110+ * You may obtain a copy of the License at 2111+ * 2112+ * http://www.apache.org/licenses/LICENSE-2.0 2113+ * 2114+ * Unless required by applicable law or agreed to in writing, software 2115+ * distributed under the License is distributed on an "AS IS" BASIS, 2116+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2117+ * See the License for the specific language governing permissions and 2118+ * limitations under the License. 2119+ */ 2120 2121 #ifndef NWEB_ACCESS_REQUEST_H 2122 #define NWEB_ACCESS_REQUEST_H 2123diff --git a/src/ohos_nweb/include/nweb_console_log.h b/src/ohos_nweb/include/nweb_console_log.h 2124index b0a8d6bbd9..207d6dddaf 100644 2125--- a/src/ohos_nweb/include/nweb_console_log.h 2126+++ b/src/ohos_nweb/include/nweb_console_log.h 2127@@ -1,6 +1,17 @@ 2128-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2129-// Use of this source code is governed by a BSD-style license that can be 2130-// found in the LICENSE file. 2131+/* 2132+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2133+ * Licensed under the Apache License, Version 2.0 (the "License"); 2134+ * you may not use this file except in compliance with the License. 2135+ * You may obtain a copy of the License at 2136+ * 2137+ * http://www.apache.org/licenses/LICENSE-2.0 2138+ * 2139+ * Unless required by applicable law or agreed to in writing, software 2140+ * distributed under the License is distributed on an "AS IS" BASIS, 2141+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2142+ * See the License for the specific language governing permissions and 2143+ * limitations under the License. 2144+ */ 2145 2146 #ifndef NWEB_CONSOLE_LOG_H 2147 #define NWEB_CONSOLE_LOG_H 2148diff --git a/src/ohos_nweb/include/nweb_cookie_manager.h b/src/ohos_nweb/include/nweb_cookie_manager.h 2149index 4e2c33aaf9..fc5c58ddc9 100644 2150--- a/src/ohos_nweb/include/nweb_cookie_manager.h 2151+++ b/src/ohos_nweb/include/nweb_cookie_manager.h 2152@@ -1,6 +1,17 @@ 2153-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2154-// Use of this source code is governed by a BSD-style license that can be 2155-// found in the LICENSE file. 2156+/* 2157+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2158+ * Licensed under the Apache License, Version 2.0 (the "License"); 2159+ * you may not use this file except in compliance with the License. 2160+ * You may obtain a copy of the License at 2161+ * 2162+ * http://www.apache.org/licenses/LICENSE-2.0 2163+ * 2164+ * Unless required by applicable law or agreed to in writing, software 2165+ * distributed under the License is distributed on an "AS IS" BASIS, 2166+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2167+ * See the License for the specific language governing permissions and 2168+ * limitations under the License. 2169+ */ 2170 2171 #ifndef NWEB_COOKIE_MANAGER_H 2172 #define NWEB_COOKIE_MANAGER_H 2173@@ -18,13 +29,6 @@ public: 2174 2175 virtual ~NWebCookieManager() = default; 2176 2177- /** 2178- * @brief Gets the singleton NWebCookieManager instance. 2179- * 2180- * @return the singleton NWebCookieManager instance. 2181- */ 2182- static NWebCookieManager* GetInstance(); 2183- 2184 /** 2185 * @brief Get whether the instance can send and accept cookies. 2186 * 2187@@ -59,7 +63,14 @@ public: 2188 virtual void ReturnCookie(const std::string &url, 2189 std::shared_ptr<NWebValueCallback<std::string>> callback) = 0; 2190 /** 2191- * @brief GSets a single cookie (key-value pair) for the given URL. 2192+ * @brief Gets all the cookies for the given URL. This is sync method 2193+ * 2194+ * @param url the URL for which the cookies are requested. 2195+ * @return the cookie value for given URL. 2196+ */ 2197+ virtual std::string ReturnCookie(const std::string &url) = 0; 2198+ /** 2199+ * @brief Sets a single cookie (key-value pair) for the given URL. 2200 * 2201 * @param url the URL for which the cookie is to be set. 2202 * @param value the cookie as a string, using the format of the 'Set-Cookie' HTTP response header. 2203@@ -68,6 +79,15 @@ public: 2204 virtual void SetCookie(const std::string &url, 2205 const std::string &value, 2206 std::shared_ptr<NWebValueCallback<bool>> callback) = 0; 2207+ /** 2208+ * @brief Sets a single cookie (key-value pair) for the given URL sync. 2209+ * 2210+ * @param url the URL for which the cookie is to be set. 2211+ * @param value the cookie as a string, using the format of the 'Set-Cookie' HTTP response header. 2212+ * @return true if set cookie success else return false. 2213+ */ 2214+ virtual bool SetCookie(const std::string &url, 2215+ const std::string &value) = 0; 2216 /** 2217 * @brief Gets whether there are stored cookies. 2218 * 2219@@ -81,6 +101,13 @@ public: 2220 * @param callback a callback to be executed when cookies has Stored. 2221 */ 2222 virtual void Store(std::shared_ptr<NWebValueCallback<bool>> callback) = 0; 2223+ /** 2224+ * @brief Ensures all cookies currently accessible through the ReturnCookie API are written to 2225+ * persistent storage. 2226+ * 2227+ * @param true if store cookie success else return false. 2228+ */ 2229+ virtual bool Store() = 0; 2230 /** 2231 * @brief Removes all session cookies, which are cookies without an expiration date. 2232 * 2233diff --git a/src/ohos_nweb/include/nweb_download_callback.h b/src/ohos_nweb/include/nweb_download_callback.h 2234index 5ce16d93b4..b7e06a4fa6 100644 2235--- a/src/ohos_nweb/include/nweb_download_callback.h 2236+++ b/src/ohos_nweb/include/nweb_download_callback.h 2237@@ -1,6 +1,17 @@ 2238-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2239-// Use of this source code is governed by a BSD-style license that can be 2240-// found in the LICENSE file. 2241+/* 2242+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2243+ * Licensed under the Apache License, Version 2.0 (the "License"); 2244+ * you may not use this file except in compliance with the License. 2245+ * You may obtain a copy of the License at 2246+ * 2247+ * http://www.apache.org/licenses/LICENSE-2.0 2248+ * 2249+ * Unless required by applicable law or agreed to in writing, software 2250+ * distributed under the License is distributed on an "AS IS" BASIS, 2251+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2252+ * See the License for the specific language governing permissions and 2253+ * limitations under the License. 2254+ */ 2255 2256 #ifndef NWEB_DOWNLOAD_CALLBACK_H 2257 #define NWEB_DOWNLOAD_CALLBACK_H 2258diff --git a/src/ohos_nweb/include/nweb_export.h b/src/ohos_nweb/include/nweb_export.h 2259index e4ebd385d7..fbc05e714b 100644 2260--- a/src/ohos_nweb/include/nweb_export.h 2261+++ b/src/ohos_nweb/include/nweb_export.h 2262@@ -1,6 +1,17 @@ 2263-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2264-// Use of this source code is governed by a BSD-style license that can be 2265-// found in the LICENSE file. 2266+/* 2267+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2268+ * Licensed under the Apache License, Version 2.0 (the "License"); 2269+ * you may not use this file except in compliance with the License. 2270+ * You may obtain a copy of the License at 2271+ * 2272+ * http://www.apache.org/licenses/LICENSE-2.0 2273+ * 2274+ * Unless required by applicable law or agreed to in writing, software 2275+ * distributed under the License is distributed on an "AS IS" BASIS, 2276+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2277+ * See the License for the specific language governing permissions and 2278+ * limitations under the License. 2279+ */ 2280 2281 #ifndef OHOS_NWEB_EXPORT_H 2282 #define OHOS_NWEB_EXPORT_H 2283diff --git a/src/ohos_nweb/include/nweb_file_selector_params.h b/src/ohos_nweb/include/nweb_file_selector_params.h 2284new file mode 100644 2285index 0000000000..1b5d42397b 2286--- /dev/null 2287+++ b/src/ohos_nweb/include/nweb_file_selector_params.h 2288@@ -0,0 +1,50 @@ 2289+/* 2290+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2291+ * Licensed under the Apache License, Version 2.0 (the "License"); 2292+ * you may not use this file except in compliance with the License. 2293+ * You may obtain a copy of the License at 2294+ * 2295+ * http://www.apache.org/licenses/LICENSE-2.0 2296+ * 2297+ * Unless required by applicable law or agreed to in writing, software 2298+ * distributed under the License is distributed on an "AS IS" BASIS, 2299+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2300+ * See the License for the specific language governing permissions and 2301+ * limitations under the License. 2302+ */ 2303+ 2304+#ifndef NWEB_FILE_SELECTOR_PARAMS_H 2305+#define NWEB_FILE_SELECTOR_PARAMS_H 2306+ 2307+#include <string> 2308+#include <vector> 2309+#include "nweb_export.h" 2310+ 2311+namespace OHOS::NWeb { 2312+using AcceptTypeList = std::vector<std::string>; 2313+class OHOS_NWEB_EXPORT NWebFileSelectorParams { 2314+public: 2315+ enum FileSelectorMode{ 2316+ FILE_OPEN_MODE = 0, 2317+ FILE_OPEN_MULTIPLE_MODE, 2318+ FILE_OPEN_FOLDER_MODE, 2319+ FILE_SAVE_MODE 2320+ }; 2321+ 2322+ NWebFileSelectorParams() = default; 2323+ 2324+ virtual ~NWebFileSelectorParams() = default; 2325+ 2326+ virtual const std::string Title() const = 0; 2327+ 2328+ virtual FileSelectorMode Mode() const = 0; 2329+ 2330+ virtual const std::string DefaultFilename() const = 0; 2331+ 2332+ virtual const AcceptTypeList AcceptType() const = 0; 2333+ 2334+ virtual bool IsCapture() const = 0; 2335+}; 2336+} 2337+ 2338+#endif 2339\ No newline at end of file 2340diff --git a/src/ohos_nweb/include/nweb_geolocation_callback_interface.h b/src/ohos_nweb/include/nweb_geolocation_callback_interface.h 2341index 5fe586d606..c7645d7497 100644 2342--- a/src/ohos_nweb/include/nweb_geolocation_callback_interface.h 2343+++ b/src/ohos_nweb/include/nweb_geolocation_callback_interface.h 2344@@ -1,6 +1,17 @@ 2345-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2346-// Use of this source code is governed by a BSD-style license that can be 2347-// found in the LICENSE file. 2348+/* 2349+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2350+ * Licensed under the Apache License, Version 2.0 (the "License"); 2351+ * you may not use this file except in compliance with the License. 2352+ * You may obtain a copy of the License at 2353+ * 2354+ * http://www.apache.org/licenses/LICENSE-2.0 2355+ * 2356+ * Unless required by applicable law or agreed to in writing, software 2357+ * distributed under the License is distributed on an "AS IS" BASIS, 2358+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2359+ * See the License for the specific language governing permissions and 2360+ * limitations under the License. 2361+ */ 2362 2363 #ifndef NWEB_GEOLOCATION_CALLBACK_INTERFACE_H 2364 #define NWEB_GEOLOCATION_CALLBACK_INTERFACE_H 2365diff --git a/src/ohos_nweb/include/nweb_handler.h b/src/ohos_nweb/include/nweb_handler.h 2366old mode 100644 2367new mode 100755 2368index c6dab95ccb..89e8bc49d7 2369--- a/src/ohos_nweb/include/nweb_handler.h 2370+++ b/src/ohos_nweb/include/nweb_handler.h 2371@@ -1,6 +1,17 @@ 2372-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2373-// Use of this source code is governed by a BSD-style license that can be 2374-// found in the LICENSE file. 2375+/* 2376+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2377+ * Licensed under the Apache License, Version 2.0 (the "License"); 2378+ * you may not use this file except in compliance with the License. 2379+ * You may obtain a copy of the License at 2380+ * 2381+ * http://www.apache.org/licenses/LICENSE-2.0 2382+ * 2383+ * Unless required by applicable law or agreed to in writing, software 2384+ * distributed under the License is distributed on an "AS IS" BASIS, 2385+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2386+ * See the License for the specific language governing permissions and 2387+ * limitations under the License. 2388+ */ 2389 2390 #ifndef NWEB_HANDLER_H 2391 #define NWEB_HANDLER_H 2392@@ -13,6 +24,7 @@ 2393 #include "nweb_access_request.h" 2394 #include "nweb.h" 2395 #include "nweb_console_log.h" 2396+#include "nweb_file_selector_params.h" 2397 #include "nweb_geolocation_callback_interface.h" 2398 #include "nweb_js_dialog_result.h" 2399 #include "nweb_url_resource_error.h" 2400@@ -51,6 +63,25 @@ enum class ImageAlphaType { 2401 ALPHA_TYPE_POSTMULTIPLIED = 2, 2402 }; 2403 2404+enum class RenderExitReason { 2405+ // Render process non-zero exit status 2406+ PROCESS_ABNORMAL_TERMINATION, 2407+ 2408+ // SIGKILL or task manager kill 2409+ PROCESS_WAS_KILLED, 2410+ 2411+ // Segmentation fault 2412+ PROCESS_CRASHED, 2413+ 2414+ // Out of memory 2415+ PROCESS_OOM, 2416+ 2417+ // Unknown reason 2418+ PROCESS_EXIT_UNKNOWN, 2419+}; 2420+ 2421+using FileSelectorCallback = NWebValueCallback<std::vector<std::string>&>; 2422+ 2423 class OHOS_NWEB_EXPORT NWebHandler { 2424 public: 2425 NWebHandler() = default; 2426@@ -302,6 +333,32 @@ public: 2427 * permission. 2428 */ 2429 virtual void OnPermissionRequestCanceled(std::shared_ptr<NWebAccessRequest> request) {} 2430+ 2431+ /** 2432+ * @brief called when the render process exit. 2433+ * 2434+ * @param reason the detail reason why render process exit, the implementation of this callback 2435+ * should attempt to clean up the specific nweb that was set by SetNWeb interface. 2436+ */ 2437+ virtual void OnRenderExited(RenderExitReason reason) {} 2438+ 2439+ /** 2440+ * @brief inform application to update its visited links database. 2441+ * 2442+ * @param url the url being visited. 2443+ * @param isReload true if the url is being reload. 2444+ */ 2445+ virtual void OnRefreshAccessedHistory(const std::string& url, bool isReload) {} 2446+ 2447+ /** 2448+ * @brief inform application to show a file selector. 2449+ * @param callback the file list to select. 2450+ * @param params the params of file selector. 2451+ */ 2452+ virtual bool OnFileSelectorShow(std::shared_ptr<FileSelectorCallback> callback, 2453+ std::shared_ptr<NWebFileSelectorParams> params) { 2454+ return false; 2455+ } 2456 }; 2457 } // namespace OHOS::NWeb 2458 2459diff --git a/src/ohos_nweb/include/nweb_hit_testresult.h b/src/ohos_nweb/include/nweb_hit_testresult.h 2460index 510e471280..9115f488cd 100755 2461--- a/src/ohos_nweb/include/nweb_hit_testresult.h 2462+++ b/src/ohos_nweb/include/nweb_hit_testresult.h 2463@@ -1,6 +1,17 @@ 2464-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2465-// Use of this source code is governed by a BSD-style license that can be 2466-// found in the LICENSE file. 2467+/* 2468+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2469+ * Licensed under the Apache License, Version 2.0 (the "License"); 2470+ * you may not use this file except in compliance with the License. 2471+ * You may obtain a copy of the License at 2472+ * 2473+ * http://www.apache.org/licenses/LICENSE-2.0 2474+ * 2475+ * Unless required by applicable law or agreed to in writing, software 2476+ * distributed under the License is distributed on an "AS IS" BASIS, 2477+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2478+ * See the License for the specific language governing permissions and 2479+ * limitations under the License. 2480+ */ 2481 2482 #ifndef WEB_HIT_TESTRESULT_H 2483 #define WEB_HIT_TESTRESULT_H 2484diff --git a/src/ohos_nweb/include/nweb_javascript_result_callback.h b/src/ohos_nweb/include/nweb_javascript_result_callback.h 2485index 2faeb6495d..96ec05f2b1 100644 2486--- a/src/ohos_nweb/include/nweb_javascript_result_callback.h 2487+++ b/src/ohos_nweb/include/nweb_javascript_result_callback.h 2488@@ -1,6 +1,17 @@ 2489-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2490-// Use of this source code is governed by a BSD-style license that can be 2491-// found in the LICENSE file. 2492+/* 2493+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2494+ * Licensed under the Apache License, Version 2.0 (the "License"); 2495+ * you may not use this file except in compliance with the License. 2496+ * You may obtain a copy of the License at 2497+ * 2498+ * http://www.apache.org/licenses/LICENSE-2.0 2499+ * 2500+ * Unless required by applicable law or agreed to in writing, software 2501+ * distributed under the License is distributed on an "AS IS" BASIS, 2502+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2503+ * See the License for the specific language governing permissions and 2504+ * limitations under the License. 2505+ */ 2506 2507 #ifndef NWEB_JAVASCRIPT_RESULT_CALLBACK_H 2508 #define NWEB_JAVASCRIPT_RESULT_CALLBACK_H 2509diff --git a/src/ohos_nweb/include/nweb_preference.h b/src/ohos_nweb/include/nweb_preference.h 2510old mode 100644 2511new mode 100755 2512index f2b805bbda..a9032eb490 2513--- a/src/ohos_nweb/include/nweb_preference.h 2514+++ b/src/ohos_nweb/include/nweb_preference.h 2515@@ -1,6 +1,17 @@ 2516-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 2517-// Use of this source code is governed by a BSD-style license that can be 2518-// found in the LICENSE file. 2519+/* 2520+ * Copyright (c) 2022 Huawei Device Co., Ltd. 2521+ * Licensed under the Apache License, Version 2.0 (the "License"); 2522+ * you may not use this file except in compliance with the License. 2523+ * You may obtain a copy of the License at 2524+ * 2525+ * http://www.apache.org/licenses/LICENSE-2.0 2526+ * 2527+ * Unless required by applicable law or agreed to in writing, software 2528+ * distributed under the License is distributed on an "AS IS" BASIS, 2529+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 2530+ * See the License for the specific language governing permissions and 2531+ * limitations under the License. 2532+ */ 2533 2534 #ifndef NWEB_PREFERENCE_H 2535 #define NWEB_PREFERENCE_H 2536@@ -13,26 +24,26 @@ class OHOS_NWEB_EXPORT NWebPreference { 2537 public: 2538 NWebPreference() = default; 2539 virtual ~NWebPreference() = default; 2540- enum AccessMode { ALWAYS_ALLOW = 0, NEVER_ALLOW = 1, COMPATIBILITY_MODE = 2 }; 2541+ enum class AccessMode { ALWAYS_ALLOW = 0, NEVER_ALLOW = 1, COMPATIBILITY_MODE = 2 }; 2542 /* synchronous set NWebPreference and web preferences */ 2543 /** 2544 * Enables or disables content URL(content from a content provider installed 2545 * in the system) access within WebView. The default is true. 2546 */ 2547 virtual void PutEnableContentAccess(bool flag) = 0; 2548- 2549+ 2550 /** 2551 * Enables or disables file system access within WebView. But files in the 2552 * path of AppData are still accessible. The default is false. 2553 */ 2554 virtual void PutEnableRawFileAccess(bool flag) = 0; 2555- 2556+ 2557 /** 2558 * Put whether to allow JavaScript running in a file scheme URL to access 2559 * content from other file scheme URLs. The default is false. 2560 */ 2561 virtual void PutEnableRawFileAccessFromFileURLs(bool flag) = 0; 2562- 2563+ 2564 /** 2565 * Put whether to allow JavaScript running in a file scheme URL to access 2566 * content from any origin. This includes access to content from other file 2567@@ -40,21 +51,21 @@ public: 2568 * false. 2569 */ 2570 virtual void PutEnableUniversalAccessFromFileURLs(bool flag) = 0; 2571- 2572+ 2573 /** 2574 * Put whether to block the WebView from loading image resources from the 2575 * network (http and https URI schemes). This settings is invalid, if {@link 2576 * #IsImageLoadingAllowed} returns false. The default is false. 2577 */ 2578 virtual void PutLoadImageFromNetworkDisabled(bool flag) = 0; 2579- 2580+ 2581 /** 2582 * Put the cursive font family name. The default is "cursive". 2583 * 2584 * @param font a font family name 2585 */ 2586 virtual void PutCursiveFontFamilyName(std::string font) = 0; 2587- 2588+ 2589 /** 2590 * Enables or disables the database storage API. The default is false. 2591 * This setting is global and effectd all WebView instances in a 2592@@ -62,7 +73,7 @@ public: 2593 * changes won't be ignored. 2594 */ 2595 virtual void PutDatabaseAllowed(bool flag) = 0; 2596- 2597+ 2598 /** 2599 * Put the size of default fixed font. The default is 13. 2600 * 2601@@ -70,7 +81,7 @@ public: 2602 * the specified range will be pinned. 2603 */ 2604 virtual void PutDefaultFixedFontSize(int size) = 0; 2605- 2606+ 2607 /** 2608 * Put the size of default font. The default is 16. 2609 * 2610@@ -78,7 +89,7 @@ public: 2611 * the specified range will be pinned. 2612 */ 2613 virtual void PutDefaultFontSize(int size) = 0; 2614- 2615+ 2616 /** 2617 * Put the default text encoding format that uses to decode html pages. 2618 * The default is "UTF-8". 2619@@ -86,49 +97,49 @@ public: 2620 * @param the text encoding format 2621 */ 2622 virtual void PutDefaultTextEncodingFormat(std::string encoding) = 0; 2623- 2624+ 2625 /** 2626 * Enables or disables the DOM storage API. The default value is false. 2627 */ 2628 virtual void PutDomStorageEnabled(bool flag) = 0; 2629- 2630+ 2631 /** 2632 * Put the fantasy font family name. The default is "fantasy". 2633 * 2634 * @param font a font family name 2635 */ 2636 virtual void PutFantasyFontFamilyName(std::string font) = 0; 2637- 2638+ 2639 /** 2640 * Put the fixed font family name. The default is "monospace". 2641 * 2642 * @param font a font family name 2643 */ 2644 virtual void PutFixedFontFamilyName(std::string font) = 0; 2645- 2646+ 2647 /** 2648 * Enables or disables the force dark mode for this WebView. 2649 * 2650 * @param forceDark true if set the force dark mode for this WebView. 2651 */ 2652 virtual void PutDarkModeEnabled(int forceDark) = 0; 2653- 2654+ 2655 /** 2656 * Put whether JavaScript can open windows by JavaScript. This applies to the 2657 * JavaScript function {@code window.open()}. The default is false. 2658 */ 2659 virtual void PutIsCreateWindowsByJavaScriptAllowed(bool flag) = 0; 2660- 2661+ 2662 /** 2663 * Put whether the WebView can execute JavaScript. The default is false. 2664 */ 2665 virtual void PutJavaScriptEnabled(bool flag) = 0; 2666- 2667+ 2668 /** 2669 * Put whether the WebView can load image. The default is true. 2670 */ 2671 virtual void PutImageLoadingAllowed(bool flag) = 0; 2672- 2673+ 2674 /** 2675 * Put the lower limit of the minimum font size. The default is 8. 2676 * 2677@@ -136,7 +147,7 @@ public: 2678 * the specified range will be pinned. 2679 */ 2680 virtual void PutFontSizeLowerLimit(int size) = 0; 2681- 2682+ 2683 /** 2684 * Put the lower limit of the minimum logical font size. The default is 8. 2685 * 2686@@ -144,28 +155,35 @@ public: 2687 * the specified range will be pinned. 2688 */ 2689 virtual void PutLogicalFontSizeLowerLimit(int size) = 0; 2690- 2691+ 2692+ /** 2693+ * Sets whether the WebView loads pages in overview mode, that is, zooms out the 2694+ * content to fit on screen by width. 2695+ * 2696+ */ 2697+ virtual void PutLoadWithOverviewMode(bool flag) = 0; 2698+ 2699 /** 2700 * Put the sans-serif font family name. The default is "sans-serif". 2701 * 2702 * @param font a font family name 2703 */ 2704 virtual void PutSansSerifFontFamilyName(std::string font) = 0; 2705- 2706+ 2707 /** 2708 * Put the serif font family name. The default is "serif". 2709 * 2710 * @param font a font family name 2711 */ 2712 virtual void PutSerifFontFamilyName(std::string font) = 0; 2713- 2714+ 2715 /** 2716 * Put the standard font family name. The default is "sans-serif". 2717 * 2718 * @param font a font family name 2719 */ 2720 virtual void PutStandardFontFamilyName(std::string font) = 0; 2721- 2722+ 2723 /** 2724 * Put the user-agent string to the nweb. If it is null or empty, 2725 * webview will use the system default value. Changing the user-agent 2726@@ -174,14 +192,14 @@ public: 2727 * @param ua user-agent string. The value may be null. 2728 */ 2729 virtual void PutUserAgent(std::string ua) = 0; 2730- 2731+ 2732 /** 2733 * Put the zoom percentage of the page text. The default is 100. 2734 * 2735 * @param textZoom the zoom percentage of the page text 2736 */ 2737 virtual void PutZoomingForTextFactor(int textZoom) = 0; 2738- 2739+ 2740 /** 2741 * Put whether the WebView can get geolocation. The default is true. 2742 * To get geolocation, an application must have permission to access 2743@@ -191,7 +209,7 @@ public: 2744 * the location request via the JavaScript Geolocation API. 2745 */ 2746 virtual void PutGeolocationAllowed(bool flag) = 0; 2747- 2748+ 2749 /** 2750 * Put the WebView's behavior when a secure origin attempts to load a 2751 * resource from an insecure origin. The default is NEVER_ALLOW. 2752@@ -200,12 +218,12 @@ public: 2753 */ 2754 virtual void PutAccessModeForSecureOriginLoadFromInsecure( 2755 AccessMode mode) = 0; 2756- 2757+ 2758 /** 2759 * Put whether the WebView supports zooming. The default is true. 2760 */ 2761 virtual void PutZoomingFunctionEnabled(bool flag) = 0; 2762- 2763+ 2764 /** 2765 * Put whether the WebView block loading resources from the network. The 2766 * default value is false if the hap has the 2767@@ -215,6 +233,22 @@ public: 2768 */ 2769 virtual void PutBlockNetwork(bool flag) = 0; 2770 2771+ enum CacheModeFlag { 2772+ USE_DEFAULT = 0, 2773+ USE_CACHE_ELSE_NETWORK, 2774+ USE_NO_CACHE, 2775+ USE_CACHE_ONLY 2776+ }; 2777+ /** 2778+ * PutCacheMode 2779+ */ 2780+ virtual void PutCacheMode(CacheModeFlag flag) = 0; 2781+ 2782+ /** 2783+ * Put whether the NWeb can be debugging, default value is false. 2784+ */ 2785+ virtual void PutWebDebuggingAccess(bool flag) = 0; 2786+ 2787 /* get methods */ 2788 /** 2789 * Get if content URL(content from a content provider installed 2790@@ -223,7 +257,7 @@ public: 2791 * @see PutEnableContentAccess 2792 */ 2793 virtual bool EnableContentAccess() = 0; 2794- 2795+ 2796 /** 2797 * Get if file system access within WebView is supported. Notified files in the 2798 * path of AppData are always accessible. 2799@@ -231,7 +265,7 @@ public: 2800 * @see PutEnableRawFileAccess 2801 */ 2802 virtual bool EnableRawFileAccess() = 0; 2803- 2804+ 2805 /** 2806 * Get if JavaScript running in a file scheme URL to access 2807 * content from other file scheme URLs is supported. 2808@@ -239,7 +273,7 @@ public: 2809 * @see PutEnableRawFileAccessFromFileURLs 2810 */ 2811 virtual bool EnableRawFileAccessFromFileURLs() = 0; 2812- 2813+ 2814 /** 2815 * Get if JavaScript running in a file scheme URL to access 2816 * content from any origin is supported. This includes access to content from other file 2817@@ -248,7 +282,7 @@ public: 2818 * @see PutEnableUniversalAccessFromFileURLs 2819 */ 2820 virtual bool EnableUniversalAccessFromFileURLs() = 0; 2821- 2822+ 2823 /** 2824 * Get if the WebView from loading image resources from the 2825 * network (http and https URI schemes) is supported. 2826@@ -256,177 +290,198 @@ public: 2827 * @see PutLoadImageFromNetworkDisabled 2828 */ 2829 virtual bool IsLoadImageFromNetworkDisabled() = 0; 2830- 2831+ 2832 /** 2833 * Get the cursive font family name. 2834 * 2835 * @see PutCursiveFontFamilyName 2836 */ 2837 virtual std::string CursiveFontFamilyName() = 0; 2838- 2839+ 2840 /** 2841 * Get if the database storage API is supported. 2842 * 2843 * @see PutDatabaseAllowed 2844 */ 2845 virtual bool IsDataBaseEnabled() = 0; 2846- 2847+ 2848 /** 2849 * Get the size of default fixed font. 2850 * 2851 * @see PutDefaultFixedFontSize 2852 */ 2853 virtual int DefaultFixedFontSize() = 0; 2854- 2855+ 2856 /** 2857 * Get the size of default font. 2858 * 2859 * @see PutDefaultFontSize 2860 */ 2861 virtual int DefaultFontSize() = 0; 2862- 2863+ 2864 /** 2865 * Get the default text encoding format that uses to decode html pages. 2866 * 2867 * @see PutDefaultTextEncodingFormat 2868 */ 2869 virtual std::string DefaultTextEncodingFormat() = 0; 2870- 2871+ 2872 /** 2873- * Get the default user-agent string to the nweb. 2874+ * Get the default user-agent string to the nweb. 2875 * An instance of WebView could use a different User-Agent that 2876 * NWebPreference#PutUserAgent(String) set to. 2877 * 2878 * @see PutUserAgent 2879 */ 2880 virtual std::string DefaultUserAgent() = 0; 2881- 2882+ 2883 /** 2884- * Get if the DOM storage API is supported. 2885+ * Get if the DOM storage API is supported. 2886 * 2887 * @see PutDomStorageEnabled 2888 */ 2889 virtual bool IsDomStorageEnabled() = 0; 2890- 2891+ 2892 /** 2893- * Get the fantasy font family name. 2894+ * Get the fantasy font family name. 2895 * 2896 * @see PutFantasyFontFamilyName 2897 */ 2898 virtual std::string FantasyFontFamilyName() = 0; 2899- 2900+ 2901 /** 2902- * Get the fixed font family name. 2903+ * Get the fixed font family name. 2904 * 2905 * @see PutFixedFontFamilyName 2906 */ 2907 virtual std::string FixedFontFamilyName() = 0; 2908- 2909+ 2910 /** 2911- * Get if the dark mode for this WebView is supported. 2912+ * Get if the dark mode for this WebView is supported. 2913 * 2914 * @see PutDarkModeEnabled 2915 */ 2916 virtual int DarkModeEnabled() = 0; 2917- 2918+ 2919 /** 2920- * Get if JavaScript can open windows. 2921+ * Get if JavaScript can open windows. 2922 * 2923 * @see PutIsCreateWindowsByJavaScriptAllowed 2924 */ 2925 virtual bool IsCreateWindowsByJavaScriptAllowed() = 0; 2926- 2927+ 2928 /** 2929- * Get if the WebView can execute JavaScript. 2930+ * Get if the WebView can execute JavaScript. 2931 * 2932 * @see PutJavaScriptEnabled 2933 */ 2934 virtual bool IsJavaScriptAllowed() = 0; 2935- 2936+ 2937 /** 2938- * Get if the WebView can load image. 2939+ * Get if the WebView can load image. 2940 * 2941 * @see PutImageLoadingAllowed 2942 */ 2943 virtual bool IsImageLoadingAllowed() = 0; 2944- 2945+ 2946 /** 2947- * Get the lower limit of the minimum font size. 2948+ * Get the lower limit of the minimum font size. 2949 * 2950 * @see PutFontSizeLowerLimit 2951 */ 2952 virtual int FontSizeLowerLimit() = 0; 2953- 2954+ 2955 /** 2956- * Get the lower limit of the minimum logical font size. 2957+ * Get the lower limit of the minimum logical font size. 2958 * 2959 * @see PutLogicalFontSizeLowerLimit 2960 */ 2961 virtual int LogicalFontSizeLowerLimit() = 0; 2962- 2963+ 2964+ /** 2965+ * Get the swith for the overview mode. 2966+ * 2967+ * @see PutLoadWithOverviewMode 2968+ */ 2969+ virtual bool IsLoadWithOverviewMode() = 0; 2970+ 2971 /** 2972- * Get the sans-serif font family name. 2973+ * Get the sans-serif font family name. 2974 * 2975 * @see PutSansSerifFontFamilyName 2976 */ 2977 virtual std::string SansSerifFontFamilyName() = 0; 2978- 2979+ 2980 /** 2981- * Get the serif font family name. 2982+ * Get the serif font family name. 2983 * 2984 * @see PutSerifFontFamilyName 2985 */ 2986 virtual std::string SerifFontFamilyName() = 0; 2987- 2988+ 2989 /** 2990- * Get the standard font family name. 2991+ * Get the standard font family name. 2992 * 2993 * @see PutStandardFontFamilyName 2994 */ 2995 virtual std::string StandardFontFamilyName() = 0; 2996- 2997+ 2998 /** 2999- * Get the user-agent string to the nweb. 3000+ * Get the user-agent string to the nweb. 3001 * 3002 * @see PutUserAgent 3003 */ 3004 virtual std::string UserAgent() = 0; 3005- 3006+ 3007 /** 3008- * Get the zoom percentage of the page text. 3009+ * Get the zoom percentage of the page text. 3010 * 3011 * @see PutZoomingForTextFactor 3012 */ 3013 virtual int ZoomingForTextFactor() = 0; 3014- 3015+ 3016 /** 3017- * Get if the WebView can get geolocation. 3018+ * Get if the WebView can get geolocation. 3019 * 3020 * @see PutGeolocationAllowed 3021 */ 3022 virtual bool GeolocationAllowed() = 0; 3023- 3024+ 3025 /** 3026 * Get the WebView's behavior when a secure origin attempts to load a 3027 * resource from an insecure origin. 3028 * 3029 * @see PutAccessModeForSecureOriginLoadFromInsecure 3030 */ 3031- virtual int AccessModeForSecureOriginLoadFromInsecure() = 0; 3032- 3033+ virtual AccessMode AccessModeForSecureOriginLoadFromInsecure() = 0; 3034+ 3035 /** 3036 * Get if the WebView supports zooming. 3037 * 3038 * @see PutZoomingFunctionEnabled 3039 */ 3040 virtual bool ZoomingfunctionEnabled() = 0; 3041- 3042+ 3043 /** 3044 * Get if the WebView block loading resources from the network. 3045 * 3046 * @see PutBlockNetwork 3047 */ 3048 virtual bool IsNetworkBlocked() = 0; 3049+ 3050+ /** 3051+ * Get cache mode 3052+ * 3053+ * @see PutCacheMode 3054+ */ 3055+ virtual CacheModeFlag CacheMode() = 0; 3056+ 3057+ /** 3058+ * Get if the NWeb can be debugging. 3059+ * 3060+ * @see PutWebDebuggingAccess 3061+ */ 3062+ virtual bool IsWebDebuggingAccess() = 0; 3063 }; 3064 } // namespace OHOS::NWeb 3065 #endif // NWEB_PREFERENCE_H 3066diff --git a/src/ohos_nweb/include/nweb_url_resource_error.h b/src/ohos_nweb/include/nweb_url_resource_error.h 3067index dafc312994..3a4f1871d6 100644 3068--- a/src/ohos_nweb/include/nweb_url_resource_error.h 3069+++ b/src/ohos_nweb/include/nweb_url_resource_error.h 3070@@ -1,6 +1,17 @@ 3071-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3072-// Use of this source code is governed by a BSD-style license that can be 3073-// found in the LICENSE file. 3074+/* 3075+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3076+ * Licensed under the Apache License, Version 2.0 (the "License"); 3077+ * you may not use this file except in compliance with the License. 3078+ * You may obtain a copy of the License at 3079+ * 3080+ * http://www.apache.org/licenses/LICENSE-2.0 3081+ * 3082+ * Unless required by applicable law or agreed to in writing, software 3083+ * distributed under the License is distributed on an "AS IS" BASIS, 3084+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3085+ * See the License for the specific language governing permissions and 3086+ * limitations under the License. 3087+ */ 3088 3089 #ifndef NWEB_URL_RESOURCE_ERROR_H 3090 #define NWEB_URL_RESOURCE_ERROR_H 3091diff --git a/src/ohos_nweb/include/nweb_url_resource_request.h b/src/ohos_nweb/include/nweb_url_resource_request.h 3092index b7166e8ccc..cf2e339cc1 100644 3093--- a/src/ohos_nweb/include/nweb_url_resource_request.h 3094+++ b/src/ohos_nweb/include/nweb_url_resource_request.h 3095@@ -1,6 +1,18 @@ 3096-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3097-// Use of this source code is governed by a BSD-style license that can be 3098-// found in the LICENSE file. 3099+/* 3100+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3101+ * Licensed under the Apache License, Version 2.0 (the "License"); 3102+ * you may not use this file except in compliance with the License. 3103+ * You may obtain a copy of the License at 3104+ * 3105+ * http://www.apache.org/licenses/LICENSE-2.0 3106+ * 3107+ * Unless required by applicable law or agreed to in writing, software 3108+ * distributed under the License is distributed on an "AS IS" BASIS, 3109+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3110+ * See the License for the specific language governing permissions and 3111+ * limitations under the License. 3112+ */ 3113+ 3114 #ifndef NWEB_URL_RESOURCE_REQUEST_H 3115 #define NWEB_URL_RESOURCE_REQUEST_H 3116 #include <map> 3117diff --git a/src/ohos_nweb/include/nweb_url_resource_response.h b/src/ohos_nweb/include/nweb_url_resource_response.h 3118index b8d827df2e..f5755c54e8 100644 3119--- a/src/ohos_nweb/include/nweb_url_resource_response.h 3120+++ b/src/ohos_nweb/include/nweb_url_resource_response.h 3121@@ -1,6 +1,17 @@ 3122-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3123-// Use of this source code is governed by a BSD-style license that can be 3124-// found in the LICENSE file. 3125+/* 3126+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3127+ * Licensed under the Apache License, Version 2.0 (the "License"); 3128+ * you may not use this file except in compliance with the License. 3129+ * You may obtain a copy of the License at 3130+ * 3131+ * http://www.apache.org/licenses/LICENSE-2.0 3132+ * 3133+ * Unless required by applicable law or agreed to in writing, software 3134+ * distributed under the License is distributed on an "AS IS" BASIS, 3135+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3136+ * See the License for the specific language governing permissions and 3137+ * limitations under the License. 3138+ */ 3139 3140 #ifndef NWEB_URL_RESOURCE_RESPONSE_H 3141 #define NWEB_URL_RESOURCE_RESPONSE_H 3142diff --git a/src/ohos_nweb/include/nweb_value.h b/src/ohos_nweb/include/nweb_value.h 3143index e08d162fe9..9120456d91 100644 3144--- a/src/ohos_nweb/include/nweb_value.h 3145+++ b/src/ohos_nweb/include/nweb_value.h 3146@@ -1,6 +1,17 @@ 3147-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3148-// Use of this source code is governed by a BSD-style license that can be 3149-// found in the LICENSE file. 3150+/* 3151+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3152+ * Licensed under the Apache License, Version 2.0 (the "License"); 3153+ * you may not use this file except in compliance with the License. 3154+ * You may obtain a copy of the License at 3155+ * 3156+ * http://www.apache.org/licenses/LICENSE-2.0 3157+ * 3158+ * Unless required by applicable law or agreed to in writing, software 3159+ * distributed under the License is distributed on an "AS IS" BASIS, 3160+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3161+ * See the License for the specific language governing permissions and 3162+ * limitations under the License. 3163+ */ 3164 3165 #ifndef NWEB_VALUE_H_ 3166 #define NWEB_VALUE_H_ 3167@@ -29,7 +40,7 @@ public: 3168 LIST 3169 }; 3170 3171- NWebValue(Type type) : type_(type) {} 3172+ explicit NWebValue(Type type) : type_(type) {} 3173 3174 ~NWebValue() = default; 3175 3176diff --git a/src/ohos_nweb/include/nweb_value_callback.h b/src/ohos_nweb/include/nweb_value_callback.h 3177index 4f521b4232..1a1a0e5537 100644 3178--- a/src/ohos_nweb/include/nweb_value_callback.h 3179+++ b/src/ohos_nweb/include/nweb_value_callback.h 3180@@ -1,6 +1,17 @@ 3181-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3182-// Use of this source code is governed by a BSD-style license that can be 3183-// found in the LICENSE file. 3184+/* 3185+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3186+ * Licensed under the Apache License, Version 2.0 (the "License"); 3187+ * you may not use this file except in compliance with the License. 3188+ * You may obtain a copy of the License at 3189+ * 3190+ * http://www.apache.org/licenses/LICENSE-2.0 3191+ * 3192+ * Unless required by applicable law or agreed to in writing, software 3193+ * distributed under the License is distributed on an "AS IS" BASIS, 3194+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3195+ * See the License for the specific language governing permissions and 3196+ * limitations under the License. 3197+ */ 3198 3199 #ifndef VALUE_CALLBACK_H 3200 #define VALUE_CALLBACK_H 3201diff --git a/src/ohos_nweb/src/cef_delegate/nweb_access_request_delegate.cc b/src/ohos_nweb/src/cef_delegate/nweb_access_request_delegate.cc 3202index 304addd1ad..d9e40643e3 100644 3203--- a/src/ohos_nweb/src/cef_delegate/nweb_access_request_delegate.cc 3204+++ b/src/ohos_nweb/src/cef_delegate/nweb_access_request_delegate.cc 3205@@ -1,6 +1,17 @@ 3206-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3207-// Use of this source code is governed by a BSD-style license that can be 3208-// found in the LICENSE file. 3209+/* 3210+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3211+ * Licensed under the Apache License, Version 2.0 (the "License"); 3212+ * you may not use this file except in compliance with the License. 3213+ * You may obtain a copy of the License at 3214+ * 3215+ * http://www.apache.org/licenses/LICENSE-2.0 3216+ * 3217+ * Unless required by applicable law or agreed to in writing, software 3218+ * distributed under the License is distributed on an "AS IS" BASIS, 3219+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3220+ * See the License for the specific language governing permissions and 3221+ * limitations under the License. 3222+ */ 3223 3224 #include "ohos_nweb/src/cef_delegate/nweb_access_request_delegate.h" 3225 #include "base/logging.h" 3226diff --git a/src/ohos_nweb/src/cef_delegate/nweb_access_request_delegate.h b/src/ohos_nweb/src/cef_delegate/nweb_access_request_delegate.h 3227index 24cc0ff87c..e182672d7d 100644 3228--- a/src/ohos_nweb/src/cef_delegate/nweb_access_request_delegate.h 3229+++ b/src/ohos_nweb/src/cef_delegate/nweb_access_request_delegate.h 3230@@ -1,6 +1,17 @@ 3231-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3232-// Use of this source code is governed by a BSD-style license that can be 3233-// found in the LICENSE file. 3234+/* 3235+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3236+ * Licensed under the Apache License, Version 2.0 (the "License"); 3237+ * you may not use this file except in compliance with the License. 3238+ * You may obtain a copy of the License at 3239+ * 3240+ * http://www.apache.org/licenses/LICENSE-2.0 3241+ * 3242+ * Unless required by applicable law or agreed to in writing, software 3243+ * distributed under the License is distributed on an "AS IS" BASIS, 3244+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3245+ * See the License for the specific language governing permissions and 3246+ * limitations under the License. 3247+ */ 3248 3249 #ifndef NWEB_ACCESS_REQUEST_DELEGATE_H 3250 #define NWEB_ACCESS_REQUEST_DELEGATE_H 3251diff --git a/src/ohos_nweb/src/cef_delegate/nweb_application.cc b/src/ohos_nweb/src/cef_delegate/nweb_application.cc 3252index 2c41dfd128..9840456777 100644 3253--- a/src/ohos_nweb/src/cef_delegate/nweb_application.cc 3254+++ b/src/ohos_nweb/src/cef_delegate/nweb_application.cc 3255@@ -1,6 +1,17 @@ 3256-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3257-// Use of this source code is governed by a BSD-style license that can be 3258-// found in the LICENSE file. 3259+/* 3260+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3261+ * Licensed under the Apache License, Version 2.0 (the "License"); 3262+ * you may not use this file except in compliance with the License. 3263+ * You may obtain a copy of the License at 3264+ * 3265+ * http://www.apache.org/licenses/LICENSE-2.0 3266+ * 3267+ * Unless required by applicable law or agreed to in writing, software 3268+ * distributed under the License is distributed on an "AS IS" BASIS, 3269+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3270+ * See the License for the specific language governing permissions and 3271+ * limitations under the License. 3272+ */ 3273 3274 #include "nweb_application.h" 3275 3276diff --git a/src/ohos_nweb/src/cef_delegate/nweb_application.h b/src/ohos_nweb/src/cef_delegate/nweb_application.h 3277index 84a5c50f4c..7437770d20 100644 3278--- a/src/ohos_nweb/src/cef_delegate/nweb_application.h 3279+++ b/src/ohos_nweb/src/cef_delegate/nweb_application.h 3280@@ -1,6 +1,17 @@ 3281-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3282-// Use of this source code is governed by a BSD-style license that can be 3283-// found in the LICENSE file. 3284+/* 3285+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3286+ * Licensed under the Apache License, Version 2.0 (the "License"); 3287+ * you may not use this file except in compliance with the License. 3288+ * You may obtain a copy of the License at 3289+ * 3290+ * http://www.apache.org/licenses/LICENSE-2.0 3291+ * 3292+ * Unless required by applicable law or agreed to in writing, software 3293+ * distributed under the License is distributed on an "AS IS" BASIS, 3294+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3295+ * See the License for the specific language governing permissions and 3296+ * limitations under the License. 3297+ */ 3298 3299 #ifndef NWEB_APPLICATION_H 3300 #define NWEB_APPLICATION_H 3301diff --git a/src/ohos_nweb/src/cef_delegate/nweb_cookie_manager_delegate.cc b/src/ohos_nweb/src/cef_delegate/nweb_cookie_manager_delegate.cc 3302old mode 100644 3303new mode 100755 3304index 0b0bb59284..3870cdb3a7 3305--- a/src/ohos_nweb/src/cef_delegate/nweb_cookie_manager_delegate.cc 3306+++ b/src/ohos_nweb/src/cef_delegate/nweb_cookie_manager_delegate.cc 3307@@ -1,6 +1,17 @@ 3308-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3309-// Use of this source code is governed by a BSD-style license that can be 3310-// found in the LICENSE file. 3311+/* 3312+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3313+ * Licensed under the Apache License, Version 2.0 (the "License"); 3314+ * you may not use this file except in compliance with the License. 3315+ * You may obtain a copy of the License at 3316+ * 3317+ * http://www.apache.org/licenses/LICENSE-2.0 3318+ * 3319+ * Unless required by applicable law or agreed to in writing, software 3320+ * distributed under the License is distributed on an "AS IS" BASIS, 3321+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3322+ * See the License for the specific language governing permissions and 3323+ * limitations under the License. 3324+ */ 3325 3326 #include "nweb_cookie_manager_delegate.h" 3327 #include <memory> 3328@@ -101,8 +112,10 @@ class ReturnCookieVisitor : public CefCookieVisitor { 3329 public: 3330 ReturnCookieVisitor() = delete; 3331 explicit ReturnCookieVisitor( 3332+ std::shared_ptr<WaitableEvent> event, 3333 std::shared_ptr<NWebValueCallback<std::string>> callback) 3334- : cookie_line_(std::string()), 3335+ : event_(event), 3336+ cookie_line_(std::string()), 3337 cookies_(std::vector<CefCookie>()), 3338 callback_(callback) {} 3339 ~ReturnCookieVisitor() = default; 3340@@ -115,6 +128,9 @@ class ReturnCookieVisitor : public CefCookieVisitor { 3341 if (callback_ != nullptr) { 3342 callback_->OnReceiveValue(cookie_line_); 3343 } 3344+ if (event_ != nullptr) { 3345+ event_->Signal(); 3346+ } 3347 return true; 3348 } 3349 deleteCookie = !cookie.has_expires ? delete_session_ : false; 3350@@ -128,6 +144,9 @@ class ReturnCookieVisitor : public CefCookieVisitor { 3351 if (callback_ != nullptr) { 3352 callback_->OnReceiveValue(cookie_line_); 3353 } 3354+ if (event_ != nullptr) { 3355+ event_->Signal(); 3356+ } 3357 } 3358 3359 std::vector<CefCookie>& GetVisitorCookies() { return cookies_; } 3360@@ -136,6 +155,7 @@ class ReturnCookieVisitor : public CefCookieVisitor { 3361 3362 private: 3363 bool delete_session_; 3364+ std::shared_ptr<WaitableEvent> event_; 3365 std::string cookie_line_; 3366 std::vector<CefCookie> cookies_; 3367 std::shared_ptr<NWebValueCallback<std::string>> callback_; 3368@@ -181,8 +201,6 @@ class CookieDeleteCallback : public CefDeleteCookiesCallback { 3369 } // namespace 3370 3371 namespace OHOS::NWeb { 3372-NWebCookieManagerDelegate::NWebCookieManagerDelegate() {} 3373- 3374 CefRefPtr<CefCookieManager> 3375 NWebCookieManagerDelegate::GetGlobalCookieManager() { 3376 if (!cookie_manager_) { 3377@@ -232,13 +250,33 @@ void NWebCookieManagerDelegate::ReturnCookie( 3378 LOG(ERROR) << "GetGlobalCookieManager failed"; 3379 return; 3380 } 3381- CefRefPtr<ReturnCookieVisitor> visitor = new ReturnCookieVisitor(callback); 3382+ CefRefPtr<ReturnCookieVisitor> visitor = new ReturnCookieVisitor(nullptr, callback); 3383 if (!cookie_manager->VisitUrlCookies(CefString(url), false, visitor)) { 3384 LOG(ERROR) << "VisitUrlCookies failed"; 3385 return; 3386 } 3387 } 3388 3389+std::string NWebCookieManagerDelegate::ReturnCookie( 3390+ const std::string& url) { 3391+ CefRefPtr<CefCookieManager> cookie_manager = GetGlobalCookieManager(); 3392+ if (cookie_manager == nullptr) { 3393+ LOG(ERROR) << "GetGlobalCookieManager failed"; 3394+ return ""; 3395+ } 3396+ std::shared_ptr<base::WaitableEvent> event = 3397+ std::make_shared<base::WaitableEvent>( 3398+ base::WaitableEvent::ResetPolicy::AUTOMATIC, 3399+ base::WaitableEvent::InitialState::NOT_SIGNALED); 3400+ CefRefPtr<ReturnCookieVisitor> visitor = new ReturnCookieVisitor(event, nullptr); 3401+ if (!cookie_manager->VisitUrlCookies(CefString(url), false, visitor)) { 3402+ LOG(ERROR) << "VisitUrlCookies failed"; 3403+ return ""; 3404+ } 3405+ event->Wait(); 3406+ return visitor->ReturnCookieLine(); 3407+} 3408+ 3409 void NWebCookieManagerDelegate::SetCookie( 3410 const std::string& url, 3411 const std::string& value, 3412@@ -254,6 +292,7 @@ void NWebCookieManagerDelegate::SetCookie( 3413 LOG(ERROR) << "CreateCefCookie failed"; 3414 return; 3415 } 3416+ 3417 if (!cookie_manager->SetCookie(CefString(url), cef_cookie, 3418 new CookieSetCallback(nullptr, callback))) { 3419 LOG(ERROR) << "SetCookie error"; 3420@@ -261,6 +300,33 @@ void NWebCookieManagerDelegate::SetCookie( 3421 } 3422 } 3423 3424+bool NWebCookieManagerDelegate::SetCookie( 3425+ const std::string& url, 3426+ const std::string& value) { 3427+ CefRefPtr<CefCookieManager> cookie_manager = GetGlobalCookieManager(); 3428+ if (cookie_manager == nullptr) { 3429+ LOG(ERROR) << "GetGlobalCookieManager failed"; 3430+ return false; 3431+ } 3432+ CefCookie cef_cookie; 3433+ if (!CefCookieManager::CreateCefCookie(CefString(url), CefString(value), 3434+ cef_cookie)) { 3435+ LOG(ERROR) << "CreateCefCookie failed"; 3436+ return false; 3437+ } 3438+ std::shared_ptr<base::WaitableEvent> completion = 3439+ std::make_shared<base::WaitableEvent>( 3440+ base::WaitableEvent::ResetPolicy::AUTOMATIC, 3441+ base::WaitableEvent::InitialState::NOT_SIGNALED); 3442+ CefRefPtr<CookieSetCallback> callback(new CookieSetCallback(completion, nullptr)); 3443+ if (!cookie_manager->SetCookie(CefString(url), cef_cookie, callback)) { 3444+ LOG(ERROR) << "SetCookie error"; 3445+ return false; 3446+ } 3447+ completion->Wait(); 3448+ return callback->IsSetSuccess(); 3449+} 3450+ 3451 void NWebCookieManagerDelegate::ExistCookies( 3452 std::shared_ptr<NWebValueCallback<bool>> callback) { 3453 CefRefPtr<CefCookieManager> cookie_manager = GetGlobalCookieManager(); 3454@@ -288,6 +354,25 @@ void NWebCookieManagerDelegate::Store( 3455 } 3456 } 3457 3458+bool NWebCookieManagerDelegate::Store() { 3459+ CefRefPtr<CefCookieManager> cookie_manager = GetGlobalCookieManager(); 3460+ if (cookie_manager == nullptr) { 3461+ return false; 3462+ } 3463+ std::shared_ptr<base::WaitableEvent> event = 3464+ std::make_shared<base::WaitableEvent>( 3465+ base::WaitableEvent::ResetPolicy::AUTOMATIC, 3466+ base::WaitableEvent::InitialState::NOT_SIGNALED); 3467+ CefRefPtr<CookieCompletionCallback> complete = 3468+ new CookieCompletionCallback(event, nullptr); 3469+ if (!cookie_manager->FlushStore(complete)) { 3470+ LOG(ERROR) << "Store Failed"; 3471+ return false; 3472+ } 3473+ event->Wait(); 3474+ return true; 3475+} 3476+ 3477 void NWebCookieManagerDelegate::DeleteSessionCookies( 3478 std::shared_ptr<NWebValueCallback<bool>> callback) { 3479 CefRefPtr<CefCookieManager> cookie_manager = GetGlobalCookieManager(); 3480@@ -309,12 +394,19 @@ void NWebCookieManagerDelegate::DeleteCookieEntirely( 3481 if (cookie_manager == nullptr) { 3482 return; 3483 } 3484+ std::shared_ptr<base::WaitableEvent> event = (callback != nullptr) ? 3485+ nullptr : std::make_shared<base::WaitableEvent>( 3486+ base::WaitableEvent::ResetPolicy::AUTOMATIC, 3487+ base::WaitableEvent::InitialState::NOT_SIGNALED); 3488 CefRefPtr<CefDeleteCookiesCallback> delete_callback = 3489- new CookieDeleteCallback(callback); 3490+ new CookieDeleteCallback(event, callback); 3491 if (!cookie_manager->DeleteCookies(CefString(std::string()), 3492 CefString(std::string()), false, 3493 delete_callback)) { 3494 LOG(ERROR) << "DeleteCookieEntirely Failed"; 3495 } 3496+ if (event != nullptr) { 3497+ event->Wait(); 3498+ } 3499 } 3500 } // namespace OHOS::NWeb 3501\ No newline at end of file 3502diff --git a/src/ohos_nweb/src/cef_delegate/nweb_cookie_manager_delegate.h b/src/ohos_nweb/src/cef_delegate/nweb_cookie_manager_delegate.h 3503index cb4c60b625..c77cb4c9a6 100644 3504--- a/src/ohos_nweb/src/cef_delegate/nweb_cookie_manager_delegate.h 3505+++ b/src/ohos_nweb/src/cef_delegate/nweb_cookie_manager_delegate.h 3506@@ -1,6 +1,17 @@ 3507-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3508-// Use of this source code is governed by a BSD-style license that can be 3509-// found in the LICENSE file. 3510+/* 3511+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3512+ * Licensed under the Apache License, Version 2.0 (the "License"); 3513+ * you may not use this file except in compliance with the License. 3514+ * You may obtain a copy of the License at 3515+ * 3516+ * http://www.apache.org/licenses/LICENSE-2.0 3517+ * 3518+ * Unless required by applicable law or agreed to in writing, software 3519+ * distributed under the License is distributed on an "AS IS" BASIS, 3520+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3521+ * See the License for the specific language governing permissions and 3522+ * limitations under the License. 3523+ */ 3524 3525 #ifndef NWEB_COOKIE_MANAGER_DELEGATE_H 3526 #define NWEB_COOKIE_MANAGER_DELEGATE_H 3527@@ -13,7 +24,7 @@ 3528 namespace OHOS::NWeb { 3529 class NWebCookieManagerDelegate : public NWebCookieManagerDelegateInterface { 3530 public: 3531- NWebCookieManagerDelegate(); 3532+ NWebCookieManagerDelegate() = default; 3533 ~NWebCookieManagerDelegate() = default; 3534 3535 bool IsAcceptCookieAllowed() override; 3536@@ -23,11 +34,15 @@ class NWebCookieManagerDelegate : public NWebCookieManagerDelegateInterface { 3537 void ReturnCookie( 3538 const std::string& url, 3539 std::shared_ptr<NWebValueCallback<std::string>> callback) override; 3540+ std::string ReturnCookie(const std::string& url) override; 3541 void SetCookie(const std::string& url, 3542 const std::string& value, 3543 std::shared_ptr<NWebValueCallback<bool>> callback) override; 3544+ bool SetCookie(const std::string &url, 3545+ const std::string &value) override; 3546 void ExistCookies(std::shared_ptr<NWebValueCallback<bool>> callback) override; 3547 void Store(std::shared_ptr<NWebValueCallback<bool>> callback) override; 3548+ bool Store() override; 3549 void DeleteSessionCookies( 3550 std::shared_ptr<NWebValueCallback<bool>> callback) override; 3551 void DeleteCookieEntirely( 3552diff --git a/src/ohos_nweb/src/cef_delegate/nweb_delegate.cc b/src/ohos_nweb/src/cef_delegate/nweb_delegate.cc 3553index a32a1d2410..266d00d842 100755 3554--- a/src/ohos_nweb/src/cef_delegate/nweb_delegate.cc 3555+++ b/src/ohos_nweb/src/cef_delegate/nweb_delegate.cc 3556@@ -1,6 +1,17 @@ 3557-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3558-// Use of this source code is governed by a BSD-style license that can be 3559-// found in the LICENSE file. 3560+/* 3561+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3562+ * Licensed under the Apache License, Version 2.0 (the "License"); 3563+ * you may not use this file except in compliance with the License. 3564+ * You may obtain a copy of the License at 3565+ * 3566+ * http://www.apache.org/licenses/LICENSE-2.0 3567+ * 3568+ * Unless required by applicable law or agreed to in writing, software 3569+ * distributed under the License is distributed on an "AS IS" BASIS, 3570+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3571+ * See the License for the specific language governing permissions and 3572+ * limitations under the License. 3573+ */ 3574 3575 #include "nweb_delegate.h" 3576 3577@@ -187,6 +198,13 @@ void NWebDelegate::NavigateForward() const { 3578 } 3579 } 3580 3581+void NWebDelegate::DeleteNavigateHistory() { 3582+ LOG(INFO) << "NWebDelegate::DeleteNavigateHistory"; 3583+ if (GetBrowser().get()) { 3584+ GetBrowser()->DeleteHistory(); 3585+ } 3586+} 3587+ 3588 void NWebDelegate::Reload() const { 3589 LOG(INFO) << "NWebDelegate::Reload"; 3590 if (GetBrowser().get()) { 3591diff --git a/src/ohos_nweb/src/cef_delegate/nweb_delegate.h b/src/ohos_nweb/src/cef_delegate/nweb_delegate.h 3592index 5c4b10fc04..d1792e1e01 100755 3593--- a/src/ohos_nweb/src/cef_delegate/nweb_delegate.h 3594+++ b/src/ohos_nweb/src/cef_delegate/nweb_delegate.h 3595@@ -1,6 +1,17 @@ 3596-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3597-// Use of this source code is governed by a BSD-style license that can be 3598-// found in the LICENSE file. 3599+/* 3600+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3601+ * Licensed under the Apache License, Version 2.0 (the "License"); 3602+ * you may not use this file except in compliance with the License. 3603+ * You may obtain a copy of the License at 3604+ * 3605+ * http://www.apache.org/licenses/LICENSE-2.0 3606+ * 3607+ * Unless required by applicable law or agreed to in writing, software 3608+ * distributed under the License is distributed on an "AS IS" BASIS, 3609+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3610+ * See the License for the specific language governing permissions and 3611+ * limitations under the License. 3612+ */ 3613 3614 #ifndef NWEB_DELEGATE_H 3615 #define NWEB_DELEGATE_H 3616@@ -47,6 +58,7 @@ class NWebDelegate : public NWebDelegateInterface, 3617 bool CanNavigateBackOrForward(int num_steps) const override; 3618 void NavigateBack() const override; 3619 void NavigateForward() const override; 3620+ void DeleteNavigateHistory() override; 3621 void Reload() const override; 3622 void Zoom(float zoomFactor) const override; 3623 void Stop() const override; 3624diff --git a/src/ohos_nweb/src/cef_delegate/nweb_event_handler.cc b/src/ohos_nweb/src/cef_delegate/nweb_event_handler.cc 3625index e737f46e20..ced49179e0 100644 3626--- a/src/ohos_nweb/src/cef_delegate/nweb_event_handler.cc 3627+++ b/src/ohos_nweb/src/cef_delegate/nweb_event_handler.cc 3628@@ -1,6 +1,17 @@ 3629-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3630-// Use of this source code is governed by a BSD-style license that can be 3631-// found in the LICENSE file. 3632+/* 3633+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3634+ * Licensed under the Apache License, Version 2.0 (the "License"); 3635+ * you may not use this file except in compliance with the License. 3636+ * You may obtain a copy of the License at 3637+ * 3638+ * http://www.apache.org/licenses/LICENSE-2.0 3639+ * 3640+ * Unless required by applicable law or agreed to in writing, software 3641+ * distributed under the License is distributed on an "AS IS" BASIS, 3642+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3643+ * See the License for the specific language governing permissions and 3644+ * limitations under the License. 3645+ */ 3646 3647 #include "nweb_event_handler.h" 3648 3649diff --git a/src/ohos_nweb/src/cef_delegate/nweb_event_handler.h b/src/ohos_nweb/src/cef_delegate/nweb_event_handler.h 3650index 4cc8b0c0d9..1ca96dc201 100644 3651--- a/src/ohos_nweb/src/cef_delegate/nweb_event_handler.h 3652+++ b/src/ohos_nweb/src/cef_delegate/nweb_event_handler.h 3653@@ -1,6 +1,17 @@ 3654-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3655-// Use of this source code is governed by a BSD-style license that can be 3656-// found in the LICENSE file. 3657+/* 3658+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3659+ * Licensed under the Apache License, Version 2.0 (the "License"); 3660+ * you may not use this file except in compliance with the License. 3661+ * You may obtain a copy of the License at 3662+ * 3663+ * http://www.apache.org/licenses/LICENSE-2.0 3664+ * 3665+ * Unless required by applicable law or agreed to in writing, software 3666+ * distributed under the License is distributed on an "AS IS" BASIS, 3667+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3668+ * See the License for the specific language governing permissions and 3669+ * limitations under the License. 3670+ */ 3671 3672 #ifndef NWEB_EVENT_HANDLER_H 3673 #define NWEB_EVENT_HANDLER_H 3674diff --git a/src/ohos_nweb/src/cef_delegate/nweb_file_selector_params_impl.cc b/src/ohos_nweb/src/cef_delegate/nweb_file_selector_params_impl.cc 3675new file mode 100644 3676index 0000000000..0ab1c50d60 3677--- /dev/null 3678+++ b/src/ohos_nweb/src/cef_delegate/nweb_file_selector_params_impl.cc 3679@@ -0,0 +1,71 @@ 3680+/* 3681+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3682+ * Licensed under the Apache License, Version 2.0 (the "License"); 3683+ * you may not use this file except in compliance with the License. 3684+ * You may obtain a copy of the License at 3685+ * 3686+ * http://www.apache.org/licenses/LICENSE-2.0 3687+ * 3688+ * Unless required by applicable law or agreed to in writing, software 3689+ * distributed under the License is distributed on an "AS IS" BASIS, 3690+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3691+ * See the License for the specific language governing permissions and 3692+ * limitations under the License. 3693+ */ 3694+ 3695+#include "nweb_file_selector_params_impl.h" 3696+ 3697+#include "base/logging.h" 3698+ 3699+namespace OHOS::NWeb { 3700+FileSelectorParamsImpl::FileSelectorParamsImpl( 3701+ FileSelectorMode mode, 3702+ const std::string& title, 3703+ const std::vector<CefString>& accept_type, 3704+ const std::string& default_filename, 3705+ bool is_capture) 3706+ : mode_(mode), 3707+ title_(title), 3708+ default_filename_(default_filename), 3709+ is_capture_(is_capture) { 3710+ for (auto& c : accept_type) { 3711+ accept_type_.push_back(c.ToString()); 3712+ } 3713+} 3714+ 3715+const std::string FileSelectorParamsImpl::Title() const { 3716+ return title_; 3717+} 3718+ 3719+NWebFileSelectorParams::FileSelectorMode FileSelectorParamsImpl::Mode() const { 3720+ return mode_; 3721+} 3722+ 3723+const std::string FileSelectorParamsImpl::DefaultFilename() const { 3724+ return default_filename_; 3725+} 3726+ 3727+const AcceptTypeList FileSelectorParamsImpl::AcceptType() const { 3728+ return accept_type_; 3729+} 3730+ 3731+bool FileSelectorParamsImpl::IsCapture() const { 3732+ return is_capture_; 3733+} 3734+ 3735+void FileSelectorCallbackImpl::OnReceiveValue(std::vector<std::string>& value) { 3736+ if (callback_ == nullptr || is_used_) { 3737+ LOG(ERROR) << "FileSelectorCallbackImpl is null or already used"; 3738+ return; 3739+ } 3740+ is_used_ = true; 3741+ if (value.size() == 0) { 3742+ callback_->Cancel(); 3743+ } else { 3744+ for (auto& c : value) { 3745+ file_path_.push_back(CefString(c)); 3746+ } 3747+ callback_->Continue(0, file_path_); 3748+ } 3749+} 3750+} // namespace OHOS::NWeb 3751\ No newline at end of file 3752diff --git a/src/ohos_nweb/src/cef_delegate/nweb_file_selector_params_impl.h b/src/ohos_nweb/src/cef_delegate/nweb_file_selector_params_impl.h 3753new file mode 100644 3754index 0000000000..0311d4409d 3755--- /dev/null 3756+++ b/src/ohos_nweb/src/cef_delegate/nweb_file_selector_params_impl.h 3757@@ -0,0 +1,65 @@ 3758+/* 3759+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3760+ * Licensed under the Apache License, Version 2.0 (the "License"); 3761+ * you may not use this file except in compliance with the License. 3762+ * You may obtain a copy of the License at 3763+ * 3764+ * http://www.apache.org/licenses/LICENSE-2.0 3765+ * 3766+ * Unless required by applicable law or agreed to in writing, software 3767+ * distributed under the License is distributed on an "AS IS" BASIS, 3768+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3769+ * See the License for the specific language governing permissions and 3770+ * limitations under the License. 3771+ */ 3772+ 3773+#ifndef NWEB_FILE_SELECTOR_PARAMS_IMPL_H 3774+#define NWEB_FILE_SELECTOR_PARAMS_IMPL_H 3775+ 3776+#include <string> 3777+#include <vector> 3778+#include "cef_dialog_handler.h" 3779+#include "nweb_handler.h" 3780+#include "nweb_file_selector_params.h" 3781+ 3782+namespace OHOS::NWeb { 3783+class FileSelectorParamsImpl : public NWebFileSelectorParams{ 3784+public: 3785+ FileSelectorParamsImpl(FileSelectorMode mode, 3786+ const std::string &title, 3787+ const std::vector<CefString> &accept_type, 3788+ const std::string &default_filename, 3789+ bool is_capture); 3790+ 3791+ const std::string Title() const override; 3792+ NWebFileSelectorParams::FileSelectorMode Mode() const override; 3793+ const std::string DefaultFilename() const override; 3794+ const AcceptTypeList AcceptType() const override; 3795+ bool IsCapture() const override; 3796+ 3797+private: 3798+ NWebFileSelectorParams::FileSelectorMode mode_; 3799+ std::string title_; 3800+ std::string default_filename_; 3801+ AcceptTypeList accept_type_; 3802+ bool is_capture_; 3803+}; 3804+ 3805+class FileSelectorCallbackImpl : public FileSelectorCallback { 3806+ public: 3807+ explicit FileSelectorCallbackImpl(CefRefPtr<CefFileDialogCallback> callback) 3808+ : callback_(callback), 3809+ file_path_(std::vector<CefString>()), 3810+ is_used_(false) {} 3811+ ~FileSelectorCallbackImpl() = default; 3812+ 3813+ void OnReceiveValue(std::vector<std::string>& value) override; 3814+ 3815+ private: 3816+ CefRefPtr<CefFileDialogCallback> callback_; 3817+ std::vector<CefString> file_path_; 3818+ bool is_used_; 3819+}; 3820+} 3821+ 3822+#endif 3823\ No newline at end of file 3824diff --git a/src/ohos_nweb/src/cef_delegate/nweb_geolocation_callback.cc b/src/ohos_nweb/src/cef_delegate/nweb_geolocation_callback.cc 3825index 893b92a9bb..3a97044650 100644 3826--- a/src/ohos_nweb/src/cef_delegate/nweb_geolocation_callback.cc 3827+++ b/src/ohos_nweb/src/cef_delegate/nweb_geolocation_callback.cc 3828@@ -1,6 +1,17 @@ 3829-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3830-// Use of this source code is governed by a BSD-style license that can be 3831-// found in the LICENSE file. 3832+/* 3833+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3834+ * Licensed under the Apache License, Version 2.0 (the "License"); 3835+ * you may not use this file except in compliance with the License. 3836+ * You may obtain a copy of the License at 3837+ * 3838+ * http://www.apache.org/licenses/LICENSE-2.0 3839+ * 3840+ * Unless required by applicable law or agreed to in writing, software 3841+ * distributed under the License is distributed on an "AS IS" BASIS, 3842+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3843+ * See the License for the specific language governing permissions and 3844+ * limitations under the License. 3845+ */ 3846 3847 #include "ohos_nweb/src/cef_delegate/nweb_geolocation_callback.h" 3848 #include "base/logging.h" 3849diff --git a/src/ohos_nweb/src/cef_delegate/nweb_geolocation_callback.h b/src/ohos_nweb/src/cef_delegate/nweb_geolocation_callback.h 3850index 7240ebdf2e..b39feec5c5 100644 3851--- a/src/ohos_nweb/src/cef_delegate/nweb_geolocation_callback.h 3852+++ b/src/ohos_nweb/src/cef_delegate/nweb_geolocation_callback.h 3853@@ -1,6 +1,17 @@ 3854-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3855-// Use of this source code is governed by a BSD-style license that can be 3856-// found in the LICENSE file. 3857+/* 3858+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3859+ * Licensed under the Apache License, Version 2.0 (the "License"); 3860+ * you may not use this file except in compliance with the License. 3861+ * You may obtain a copy of the License at 3862+ * 3863+ * http://www.apache.org/licenses/LICENSE-2.0 3864+ * 3865+ * Unless required by applicable law or agreed to in writing, software 3866+ * distributed under the License is distributed on an "AS IS" BASIS, 3867+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3868+ * See the License for the specific language governing permissions and 3869+ * limitations under the License. 3870+ */ 3871 3872 #ifndef NWEB_GEOLOCATION_CALLBACK_H 3873 #define NWEB_GEOLOCATION_CALLBACK_H 3874diff --git a/src/ohos_nweb/src/cef_delegate/nweb_handler_delegate.cc b/src/ohos_nweb/src/cef_delegate/nweb_handler_delegate.cc 3875index 6fc789fd1e..65a577d0c8 100755 3876--- a/src/ohos_nweb/src/cef_delegate/nweb_handler_delegate.cc 3877+++ b/src/ohos_nweb/src/cef_delegate/nweb_handler_delegate.cc 3878@@ -1,6 +1,17 @@ 3879-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3880-// Use of this source code is governed by a BSD-style license that can be 3881-// found in the LICENSE file. 3882+/* 3883+ * Copyright (c) 2022 Huawei Device Co., Ltd. 3884+ * Licensed under the Apache License, Version 2.0 (the "License"); 3885+ * you may not use this file except in compliance with the License. 3886+ * You may obtain a copy of the License at 3887+ * 3888+ * http://www.apache.org/licenses/LICENSE-2.0 3889+ * 3890+ * Unless required by applicable law or agreed to in writing, software 3891+ * distributed under the License is distributed on an "AS IS" BASIS, 3892+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 3893+ * See the License for the specific language governing permissions and 3894+ * limitations under the License. 3895+ */ 3896 3897 #include "nweb_handler_delegate.h" 3898 3899@@ -13,12 +24,14 @@ 3900 #include "cef/include/wrapper/cef_closure_task.h" 3901 #include "cef/include/wrapper/cef_helpers.h" 3902 #include "nweb_access_request_delegate.h" 3903+#include "nweb_file_selector_params_impl.h" 3904 #include "nweb_geolocation_callback.h" 3905 #include "nweb_js_dialog_result_impl.h" 3906 #include "nweb_resource_handler.h" 3907 #include "nweb_url_resource_error_impl.h" 3908 #include "nweb_url_resource_request_impl.h" 3909 #include "nweb_url_resource_response.h" 3910+#include "nweb_value_callback.h" 3911 3912 namespace OHOS::NWeb { 3913 namespace { 3914@@ -68,6 +81,25 @@ NWebConsoleLog::NWebConsoleLogLevel ConvertConsoleMessageLevel( 3915 return NWebConsoleLog::NWebConsoleLogLevel::UNKNOWN; 3916 } 3917 } 3918+ 3919+NWebFileSelectorParams::FileSelectorMode ConvertFileSelectorMode( 3920+ CefDialogHandler::FileDialogMode mode) { 3921+ NWebFileSelectorParams::FileSelectorMode result_mode = 3922+ NWebFileSelectorParams::FileSelectorMode::FILE_OPEN_MODE; 3923+ switch (mode & FILE_DIALOG_TYPE_MASK) { 3924+ case FILE_DIALOG_OPEN: 3925+ return NWebFileSelectorParams::FileSelectorMode::FILE_OPEN_MODE; 3926+ case FILE_DIALOG_OPEN_MULTIPLE: 3927+ return NWebFileSelectorParams::FileSelectorMode::FILE_OPEN_MULTIPLE_MODE; 3928+ case FILE_DIALOG_OPEN_FOLDER: 3929+ return NWebFileSelectorParams::FileSelectorMode::FILE_OPEN_FOLDER_MODE; 3930+ case FILE_DIALOG_SAVE: 3931+ return NWebFileSelectorParams::FileSelectorMode::FILE_SAVE_MODE; 3932+ default: 3933+ break; 3934+ } 3935+ return result_mode; 3936+} 3937 } // namespace 3938 3939 // static 3940@@ -182,6 +214,10 @@ CefRefPtr<CefJSDialogHandler> NWebHandlerDelegate::GetJSDialogHandler() { 3941 return this; 3942 } 3943 3944+CefRefPtr<CefDialogHandler> NWebHandlerDelegate::GetDialogHandler() { 3945+ return this; 3946+} 3947+ 3948 bool NWebHandlerDelegate::OnProcessMessageReceived( 3949 CefRefPtr<CefBrowser> browser, 3950 CefRefPtr<CefFrame> frame, 3951@@ -307,7 +343,7 @@ void NWebHandlerDelegate::OnLoadEnd(CefRefPtr<CefBrowser> browser, 3952 int http_status_code) { 3953 LOG(INFO) << "NWebHandlerDelegate::OnLoadEnd"; 3954 if (frame == nullptr || !frame->IsMain()) { 3955- return; 3956+ return; 3957 } 3958 LOG(INFO) << "NWebHandlerDelegate:: Mainframe OnLoadEnd"; 3959 if (nweb_handler_ != nullptr) { 3960@@ -392,6 +428,19 @@ void NWebHandlerDelegate::OnHttpError(CefRefPtr<CefRequest> request, 3961 } 3962 } 3963 3964+void NWebHandlerDelegate::OnRefreshAccessedHistory(CefRefPtr<CefBrowser> browser, 3965+ CefRefPtr<CefFrame> frame, 3966+ const CefString& url, 3967+ bool isReload) { 3968+ LOG(INFO) << "NWebHandlerDelegate::OnRefreshAccessedHistory, url = " << url.ToString() << ", isReload = " << isReload; 3969+ if (nweb_handler_ == nullptr) { 3970+ LOG(ERROR) << "nweb handler is null"; 3971+ return; 3972+ } 3973+ 3974+ nweb_handler_->OnRefreshAccessedHistory(url.ToString(), isReload); 3975+} 3976+ 3977 /* CefLoadHandler methods end */ 3978 3979 /* CefRequestHandler methods begin */ 3980@@ -423,8 +472,7 @@ bool NWebHandlerDelegate::OnCertificateError( 3981 return false; 3982 } 3983 3984-CefRefPtr<CefResourceRequestHandler> 3985-NWebHandlerDelegate::GetResourceRequestHandler( 3986+CefRefPtr<CefResourceRequestHandler> NWebHandlerDelegate::GetResourceRequestHandler( 3987 CefRefPtr<CefBrowser> browser, 3988 CefRefPtr<CefFrame> frame, 3989 CefRefPtr<CefRequest> request, 3990@@ -435,6 +483,34 @@ NWebHandlerDelegate::GetResourceRequestHandler( 3991 return this; 3992 } 3993 3994+void NWebHandlerDelegate::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser, TerminationStatus status) { 3995+ if (nweb_handler_ == nullptr) { 3996+ LOG(ERROR) << "invalid nweb handler (nullptr)"; 3997+ return; 3998+ } 3999+ 4000+ RenderExitReason reason; 4001+ switch (status) { 4002+ case TS_ABNORMAL_TERMINATION: 4003+ reason = RenderExitReason::PROCESS_ABNORMAL_TERMINATION; 4004+ break; 4005+ case TS_PROCESS_WAS_KILLED: 4006+ reason = RenderExitReason::PROCESS_WAS_KILLED; 4007+ break; 4008+ case TS_PROCESS_CRASHED: 4009+ reason = RenderExitReason::PROCESS_CRASHED; 4010+ break; 4011+ case TS_PROCESS_OOM: 4012+ reason = RenderExitReason::PROCESS_OOM; 4013+ break; 4014+ default: 4015+ reason = RenderExitReason::PROCESS_EXIT_UNKNOWN; 4016+ break; 4017+ } 4018+ 4019+ LOG(INFO) << "render process exit, reason = " << static_cast<int>(reason); 4020+ nweb_handler_->OnRenderExited(reason); 4021+} 4022 /* CefRequestHandler methods end */ 4023 4024 /* CefDownloadHandler methods begin */ 4025@@ -564,7 +640,7 @@ bool NWebHandlerDelegate::OnConsoleMessage(CefRefPtr<CefBrowser> browser, 4026 NWebConsoleLog::NWebConsoleLogLevel message_level = 4027 ConvertConsoleMessageLevel(level); 4028 NWebConsoleLog console_message(line, message.ToString(), message_level, 4029- source.ToString()); 4030+ source.ToString()); 4031 return nweb_handler_->OnConsoleLog(console_message); 4032 } 4033 return false; 4034@@ -584,10 +660,11 @@ bool NWebHandlerDelegate::OnSetFocus(CefRefPtr<CefBrowser> browser, 4035 /* CefPermissionRequest method begin */ 4036 void NWebHandlerDelegate::OnGeolocationShow(const CefString& origin) { 4037 if (nweb_handler_ != nullptr) { 4038- NWebGeolocationCallback* callback = 4039- new NWebGeolocationCallback(main_browser_); 4040- nweb_handler_->OnGeolocationShow(origin, callback); 4041- delete callback; 4042+ // lifecycle wrapped by ace WebGeolocationOhos 4043+ if (callback_ == nullptr) { 4044+ callback_ = new NWebGeolocationCallback(main_browser_); 4045+ } 4046+ nweb_handler_->OnGeolocationShow(origin, callback_); 4047 } 4048 return; 4049 } 4050@@ -666,6 +743,49 @@ bool NWebHandlerDelegate::OnBeforeUnloadDialog( 4051 4052 /* CefJSDialogHandler method end */ 4053 4054+/* CefDialogHandler method begin */ 4055+bool NWebHandlerDelegate::OnFileDialog( 4056+ CefRefPtr<CefBrowser> browser, 4057+ FileDialogMode mode, 4058+ const CefString& title, 4059+ const CefString& default_file_path, 4060+ const std::vector<CefString>& accept_filters, 4061+ int selected_accept_filter, 4062+ bool capture, 4063+ CefRefPtr<CefFileDialogCallback> callback) { 4064+ if (nweb_handler_ == nullptr) { 4065+ return false; 4066+ } 4067+ std::string file_selector_title = title.ToString(); 4068+ NWebFileSelectorParams::FileSelectorMode file_mode = ConvertFileSelectorMode(mode); 4069+ if (title.ToString().size() == 0) { 4070+ switch (file_mode) { 4071+ case NWebFileSelectorParams::FileSelectorMode::FILE_OPEN_MODE: 4072+ file_selector_title = "open file"; 4073+ break; 4074+ case NWebFileSelectorParams::FileSelectorMode::FILE_OPEN_MULTIPLE_MODE: 4075+ file_selector_title = "open files"; 4076+ break; 4077+ case NWebFileSelectorParams::FileSelectorMode::FILE_OPEN_FOLDER_MODE: 4078+ file_selector_title = "open file folder"; 4079+ break; 4080+ case NWebFileSelectorParams::FileSelectorMode::FILE_SAVE_MODE: 4081+ file_selector_title = "save as"; 4082+ break; 4083+ default: 4084+ break; 4085+ } 4086+ } 4087+ std::shared_ptr<NWebFileSelectorParams> param = 4088+ std::make_shared<FileSelectorParamsImpl>( 4089+ file_mode, file_selector_title, accept_filters, 4090+ default_file_path.ToString(), capture); 4091+ std::shared_ptr<FileSelectorCallback> file_path_callback = 4092+ std::make_shared<FileSelectorCallbackImpl>(callback); 4093+ return nweb_handler_->OnFileSelectorShow(file_path_callback, param); 4094+} 4095+/* CefDialogHandler method end */ 4096+ 4097 const std::vector<std::string> NWebHandlerDelegate::GetVisitedHistory() { 4098 if (nweb_handler_ != nullptr) { 4099 return nweb_handler_->VisitedUrlHistory(); 4100diff --git a/src/ohos_nweb/src/cef_delegate/nweb_handler_delegate.h b/src/ohos_nweb/src/cef_delegate/nweb_handler_delegate.h 4101index 2d92d17575..b977a6be06 100755 4102--- a/src/ohos_nweb/src/cef_delegate/nweb_handler_delegate.h 4103+++ b/src/ohos_nweb/src/cef_delegate/nweb_handler_delegate.h 4104@@ -1,6 +1,17 @@ 4105-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4106-// Use of this source code is governed by a BSD-style license that can be 4107-// found in the LICENSE file. 4108+/* 4109+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4110+ * Licensed under the Apache License, Version 2.0 (the "License"); 4111+ * you may not use this file except in compliance with the License. 4112+ * You may obtain a copy of the License at 4113+ * 4114+ * http://www.apache.org/licenses/LICENSE-2.0 4115+ * 4116+ * Unless required by applicable law or agreed to in writing, software 4117+ * distributed under the License is distributed on an "AS IS" BASIS, 4118+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4119+ * See the License for the specific language governing permissions and 4120+ * limitations under the License. 4121+ */ 4122 4123 #ifndef NWEB_HANDLER_DELEGATE_H 4124 #define NWEB_HANDLER_DELEGATE_H 4125@@ -9,6 +20,7 @@ 4126 #include "cef/include/cef_client.h" 4127 #include "cef/include/cef_jsdialog_handler.h" 4128 #include "cef/include/cef_permission_request.h" 4129+#include "cef/include/cef_dialog_handler.h" 4130 #include "nweb_event_handler.h" 4131 #include "nweb_handler.h" 4132 #include "nweb_preference_delegate.h" 4133@@ -25,6 +37,7 @@ 4134 4135 namespace OHOS::NWeb { 4136 class NWebHandler; 4137+class NWebGeolocationCallback; 4138 4139 class NWebHandlerDelegate : public CefClient, 4140 public CefLifeSpanHandler, 4141@@ -35,7 +48,8 @@ class NWebHandlerDelegate : public CefClient, 4142 public CefDownloadHandler, 4143 public CefFocusHandler, 4144 public CefPermissionRequest, 4145- public CefJSDialogHandler { 4146+ public CefJSDialogHandler, 4147+ public CefDialogHandler { 4148 public: 4149 static CefRefPtr<NWebHandlerDelegate> Create( 4150 std::shared_ptr<NWebPreferenceDelegate> preference_delegate, 4151@@ -71,6 +85,7 @@ class NWebHandlerDelegate : public CefClient, 4152 CefRefPtr<CefFocusHandler> GetFocusHandler() override; 4153 CefRefPtr<CefPermissionRequest> GetPermissionRequest() override; 4154 CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() override; 4155+ CefRefPtr<CefDialogHandler> GetDialogHandler() override; 4156 virtual bool OnProcessMessageReceived( 4157 CefRefPtr<CefBrowser> browser, 4158 CefRefPtr<CefFrame> frame, 4159@@ -131,6 +146,11 @@ class NWebHandlerDelegate : public CefClient, 4160 bool is_main_frame, 4161 bool has_user_gesture, 4162 CefRefPtr<CefResponse> response) override; 4163+ 4164+ void OnRefreshAccessedHistory(CefRefPtr<CefBrowser> browser, 4165+ CefRefPtr<CefFrame> frame, 4166+ const CefString& url, 4167+ bool isReload) override; 4168 /* CefLoadHandler methods end */ 4169 4170 /* CefRequestHandler methods begin */ 4171@@ -152,6 +172,9 @@ class NWebHandlerDelegate : public CefClient, 4172 bool is_download, 4173 const CefString& request_initiator, 4174 bool& disable_default_handling) override; 4175+ 4176+ void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser, 4177+ TerminationStatus status) override; 4178 /* CefRequestHandler methods end */ 4179 4180 /* CefDownloadHandler methods begin */ 4181@@ -223,6 +246,17 @@ class NWebHandlerDelegate : public CefClient, 4182 CefRefPtr<CefJSDialogCallback> callback) override; 4183 /* CefJSDialogHandler method end */ 4184 4185+ /* CefDialogHandler method begin */ 4186+ bool OnFileDialog(CefRefPtr<CefBrowser> browser, 4187+ FileDialogMode mode, 4188+ const CefString& title, 4189+ const CefString& default_file_path, 4190+ const std::vector<CefString>& accept_filters, 4191+ int selected_accept_filter, 4192+ bool capture, 4193+ CefRefPtr<CefFileDialogCallback> callback) override; 4194+ /* CefDialogHandler method end */ 4195+ 4196 const std::vector<std::string> GetVisitedHistory(); 4197 4198 private: 4199@@ -245,6 +279,8 @@ class NWebHandlerDelegate : public CefClient, 4200 std::shared_ptr<NWebHandler> nweb_handler_ = nullptr; 4201 std::shared_ptr<NWebJavaScriptResultCallBack> nweb_javascript_callback_ = 4202 nullptr; 4203+ // lifecycle wrapped by ace WebGeolocationOhos 4204+ NWebGeolocationCallback* callback_ = nullptr; 4205 }; 4206 } // namespace OHOS::NWeb 4207 4208diff --git a/src/ohos_nweb/src/cef_delegate/nweb_inputmethod_client.h b/src/ohos_nweb/src/cef_delegate/nweb_inputmethod_client.h 4209index 73cebd5e2b..2d4bcad12a 100644 4210--- a/src/ohos_nweb/src/cef_delegate/nweb_inputmethod_client.h 4211+++ b/src/ohos_nweb/src/cef_delegate/nweb_inputmethod_client.h 4212@@ -1,6 +1,17 @@ 4213-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4214-// Use of this source code is governed by a BSD-style license that can be 4215-// found in the LICENSE file. 4216+/* 4217+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4218+ * Licensed under the Apache License, Version 2.0 (the "License"); 4219+ * you may not use this file except in compliance with the License. 4220+ * You may obtain a copy of the License at 4221+ * 4222+ * http://www.apache.org/licenses/LICENSE-2.0 4223+ * 4224+ * Unless required by applicable law or agreed to in writing, software 4225+ * distributed under the License is distributed on an "AS IS" BASIS, 4226+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4227+ * See the License for the specific language governing permissions and 4228+ * limitations under the License. 4229+ */ 4230 4231 #ifndef OHOS_NWEB_SRC_CEF_DELEGATE_NWEB_INPUTMETHOD_CLIENT_H_ 4232 #define OHOS_NWEB_SRC_CEF_DELEGATE_NWEB_INPUTMETHOD_CLIENT_H_ 4233diff --git a/src/ohos_nweb/src/cef_delegate/nweb_js_dialog_result_impl.cc b/src/ohos_nweb/src/cef_delegate/nweb_js_dialog_result_impl.cc 4234index 23287ae9ac..7218fea53a 100644 4235--- a/src/ohos_nweb/src/cef_delegate/nweb_js_dialog_result_impl.cc 4236+++ b/src/ohos_nweb/src/cef_delegate/nweb_js_dialog_result_impl.cc 4237@@ -1,6 +1,17 @@ 4238-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4239-// Use of this source code is governed by a BSD-style license that can be 4240-// found in the LICENSE file. 4241+/* 4242+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4243+ * Licensed under the Apache License, Version 2.0 (the "License"); 4244+ * you may not use this file except in compliance with the License. 4245+ * You may obtain a copy of the License at 4246+ * 4247+ * http://www.apache.org/licenses/LICENSE-2.0 4248+ * 4249+ * Unless required by applicable law or agreed to in writing, software 4250+ * distributed under the License is distributed on an "AS IS" BASIS, 4251+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4252+ * See the License for the specific language governing permissions and 4253+ * limitations under the License. 4254+ */ 4255 4256 #include "nweb_js_dialog_result_impl.h" 4257 4258diff --git a/src/ohos_nweb/src/cef_delegate/nweb_js_dialog_result_impl.h b/src/ohos_nweb/src/cef_delegate/nweb_js_dialog_result_impl.h 4259index 0ad0d03214..a97587fe90 100644 4260--- a/src/ohos_nweb/src/cef_delegate/nweb_js_dialog_result_impl.h 4261+++ b/src/ohos_nweb/src/cef_delegate/nweb_js_dialog_result_impl.h 4262@@ -1,6 +1,17 @@ 4263-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4264-// Use of this source code is governed by a BSD-style license that can be 4265-// found in the LICENSE file. 4266+/* 4267+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4268+ * Licensed under the Apache License, Version 2.0 (the "License"); 4269+ * you may not use this file except in compliance with the License. 4270+ * You may obtain a copy of the License at 4271+ * 4272+ * http://www.apache.org/licenses/LICENSE-2.0 4273+ * 4274+ * Unless required by applicable law or agreed to in writing, software 4275+ * distributed under the License is distributed on an "AS IS" BASIS, 4276+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4277+ * See the License for the specific language governing permissions and 4278+ * limitations under the License. 4279+ */ 4280 4281 #ifndef NWEB_JS_DIALOG_RESULT_IMPL_H 4282 #define NWEB_JS_DIALOG_RESULT_IMPL_H 4283diff --git a/src/ohos_nweb/src/cef_delegate/nweb_preference_delegate.cc b/src/ohos_nweb/src/cef_delegate/nweb_preference_delegate.cc 4284old mode 100644 4285new mode 100755 4286index 37ea605711..e2250a7ef0 4287--- a/src/ohos_nweb/src/cef_delegate/nweb_preference_delegate.cc 4288+++ b/src/ohos_nweb/src/cef_delegate/nweb_preference_delegate.cc 4289@@ -1,6 +1,17 @@ 4290-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4291-// Use of this source code is governed by a BSD-style license that can be 4292-// found in the LICENSE file. 4293+/* 4294+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4295+ * Licensed under the Apache License, Version 2.0 (the "License"); 4296+ * you may not use this file except in compliance with the License. 4297+ * You may obtain a copy of the License at 4298+ * 4299+ * http://www.apache.org/licenses/LICENSE-2.0 4300+ * 4301+ * Unless required by applicable law or agreed to in writing, software 4302+ * distributed under the License is distributed on an "AS IS" BASIS, 4303+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4304+ * See the License for the specific language governing permissions and 4305+ * limitations under the License. 4306+ */ 4307 4308 #include "ohos_nweb/src/cef_delegate/nweb_preference_delegate.h" 4309 4310@@ -15,8 +26,22 @@ 4311 #include "cef/libcef/browser/net_service/net_helpers.h" 4312 4313 #include "base/feature_list.h" 4314+#include "net/base/load_flags.h" 4315 4316 namespace OHOS::NWeb { 4317+int ConvertCacheMode(NWebPreference::CacheModeFlag flag) { 4318+ switch (flag) { 4319+ case NWebPreference::CacheModeFlag::USE_CACHE_ELSE_NETWORK: 4320+ return net::LOAD_SKIP_CACHE_VALIDATION; 4321+ case NWebPreference::CacheModeFlag::USE_NO_CACHE: 4322+ return net::LOAD_BYPASS_CACHE; 4323+ case NWebPreference::CacheModeFlag::USE_CACHE_ONLY: 4324+ return net::LOAD_ONLY_FROM_CACHE | net::LOAD_SKIP_CACHE_VALIDATION; 4325+ default: 4326+ return 0; 4327+ } 4328+} 4329+ 4330 const std::string ACCESS_LOCATION = "ohos.permission.INTERNET"; 4331 NWebPreferenceDelegate::NWebPreferenceDelegate() { 4332 uint32_t tokenId = OHOS::IPCSkeleton::GetCallingTokenID(); 4333@@ -80,6 +105,8 @@ void NWebPreferenceDelegate::ComputeBrowserSettings( 4334 browser_settings.default_fixed_font_size = DefaultFixedFontSize(); 4335 browser_settings.minimum_font_size = FontSizeLowerLimit(); 4336 browser_settings.minimum_logical_font_size = LogicalFontSizeLowerLimit(); 4337+ browser_settings.initialize_at_minimum_page_scale = 4338+ !IsLoadWithOverviewMode() ? STATE_ENABLED : STATE_DISABLED; 4339 4340 str = CefString(DefaultTextEncodingFormat()); 4341 cef_string_set(str.c_str(), str.length(), 4342@@ -105,8 +132,6 @@ void NWebPreferenceDelegate::ComputeBrowserSettings( 4343 browser_settings.javascript_can_open_windows_automatically = 4344 IsCreateWindowsByJavaScriptAllowed(); 4345 browser_settings.text_size_percent = ZoomingForTextFactor(); 4346- browser_settings.mixed_content_mode = 4347- AccessModeForSecureOriginLoadFromInsecure(); 4348 browser_settings.allow_running_insecure_content = 4349 RunningInsecureContentAllowed() ? STATE_ENABLED : STATE_DISABLED; 4350 browser_settings.strict_mixed_content_checking = 4351@@ -122,6 +147,7 @@ void NWebPreferenceDelegate::SetBrowserSettingsToNetHelpers() { 4352 net_service::NetHelpers::allow_file_access = EnableRawFileAccess(); 4353 net_service::NetHelpers::allow_content_access = EnableContentAccess(); 4354 net_service::NetHelpers::is_network_blocked = IsNetworkBlocked(); 4355+ net_service::NetHelpers::cache_mode = ConvertCacheMode(CacheMode()); 4356 return; 4357 } 4358 4359@@ -219,6 +245,11 @@ void NWebPreferenceDelegate::PutLogicalFontSizeLowerLimit(int size) { 4360 WebPreferencesChanged(); 4361 } 4362 4363+void NWebPreferenceDelegate::PutLoadWithOverviewMode(bool flag) { 4364+ overload_mode_enabled_ = flag; 4365+ WebPreferencesChanged(); 4366+} 4367+ 4368 void NWebPreferenceDelegate::PutSansSerifFontFamilyName(std::string font) { 4369 sans_serif_font_family_name_ = font; 4370 WebPreferencesChanged(); 4371@@ -282,6 +313,20 @@ void NWebPreferenceDelegate::PutBlockNetwork(bool flag) { 4372 SetBrowserSettingsToNetHelpers(); 4373 } 4374 4375+void NWebPreferenceDelegate::PutCacheMode(CacheModeFlag flag) { 4376+ cache_mode_flag_ = flag; 4377+ SetBrowserSettingsToNetHelpers(); 4378+} 4379+ 4380+void NWebPreferenceDelegate::PutWebDebuggingAccess(bool flag) { 4381+ if (!browser_.get()) { 4382+ LOG(ERROR) << "put web debugging access failed, browser is null"; 4383+ return; 4384+ } 4385+ 4386+ browser_->GetHost()->SetWebDebuggingAccess(flag); 4387+} 4388+ 4389 bool NWebPreferenceDelegate::EnableContentAccess() { 4390 return content_access_; 4391 } 4392@@ -362,6 +407,10 @@ int NWebPreferenceDelegate::LogicalFontSizeLowerLimit() { 4393 return logical_font_size_lower_limit_; 4394 } 4395 4396+bool NWebPreferenceDelegate::IsLoadWithOverviewMode() { 4397+ return overload_mode_enabled_; 4398+} 4399+ 4400 std::string NWebPreferenceDelegate::SansSerifFontFamilyName() { 4401 return sans_serif_font_family_name_; 4402 } 4403@@ -389,16 +438,16 @@ bool NWebPreferenceDelegate::GeolocationAllowed() { 4404 return geolocation_allowed_; 4405 } 4406 4407-int NWebPreferenceDelegate::AccessModeForSecureOriginLoadFromInsecure() { 4408+NWebPreference::AccessMode NWebPreferenceDelegate::AccessModeForSecureOriginLoadFromInsecure() { 4409 return access_mode_; 4410 } 4411 4412 bool NWebPreferenceDelegate::RunningInsecureContentAllowed() { 4413- return access_mode_ == ALWAYS_ALLOW; 4414+ return access_mode_ == AccessMode::ALWAYS_ALLOW; 4415 } 4416 4417 bool NWebPreferenceDelegate::UseStricMixedContentCheckingAllowed() { 4418- return access_mode_ == NEVER_ALLOW; 4419+ return access_mode_ == AccessMode::NEVER_ALLOW; 4420 } 4421 4422 const base::Feature webview_mixed_content_autoupgrades{ 4423@@ -406,7 +455,7 @@ const base::Feature webview_mixed_content_autoupgrades{ 4424 4425 bool NWebPreferenceDelegate::MixedContentAutoupgradesAllowed() { 4426 if (base::FeatureList::IsEnabled(webview_mixed_content_autoupgrades)) { 4427- return access_mode_ == COMPATIBILITY_MODE; 4428+ return access_mode_ == AccessMode::COMPATIBILITY_MODE; 4429 } 4430 return false; 4431 } 4432@@ -419,7 +468,20 @@ bool NWebPreferenceDelegate::IsNetworkBlocked() { 4433 return is_network_blocked_; 4434 } 4435 4436+NWebPreference::CacheModeFlag NWebPreferenceDelegate::CacheMode() { 4437+ return cache_mode_flag_; 4438+} 4439+ 4440 void NWebPreferenceDelegate::PutHasInternetPermission(bool flag) { 4441 has_internet_permission_ = flag; 4442 } 4443+ 4444+bool NWebPreferenceDelegate::IsWebDebuggingAccess() { 4445+ if (!browser_.get()) { 4446+ LOG(ERROR) << "get web debugggin access failed, browser is null"; 4447+ return false; 4448+ } 4449+ 4450+ return browser_->GetHost()->GetWebDebuggingAccess(); 4451+} 4452 } // namespace OHOS::NWeb 4453diff --git a/src/ohos_nweb/src/cef_delegate/nweb_preference_delegate.h b/src/ohos_nweb/src/cef_delegate/nweb_preference_delegate.h 4454old mode 100644 4455new mode 100755 4456index 50078329b1..f3f21f72eb 4457--- a/src/ohos_nweb/src/cef_delegate/nweb_preference_delegate.h 4458+++ b/src/ohos_nweb/src/cef_delegate/nweb_preference_delegate.h 4459@@ -1,6 +1,17 @@ 4460-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4461-// Use of this source code is governed by a BSD-style license that can be 4462-// found in the LICENSE file. 4463+/* 4464+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4465+ * Licensed under the Apache License, Version 2.0 (the "License"); 4466+ * you may not use this file except in compliance with the License. 4467+ * You may obtain a copy of the License at 4468+ * 4469+ * http://www.apache.org/licenses/LICENSE-2.0 4470+ * 4471+ * Unless required by applicable law or agreed to in writing, software 4472+ * distributed under the License is distributed on an "AS IS" BASIS, 4473+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4474+ * See the License for the specific language governing permissions and 4475+ * limitations under the License. 4476+ */ 4477 4478 #ifndef NWEB_PREFERENCE_DELEGATE_H 4479 #define NWEB_PREFERENCE_DELEGATE_H 4480@@ -39,6 +50,7 @@ class NWebPreferenceDelegate : public NWebPreference { 4481 void PutJavaScriptEnabled(bool flag) override; 4482 void PutImageLoadingAllowed(bool flag) override; 4483 void PutFontSizeLowerLimit(int size) override; 4484+ void PutLoadWithOverviewMode(bool flag) override; 4485 void PutLogicalFontSizeLowerLimit(int size) override; 4486 void PutSansSerifFontFamilyName(std::string font) override; 4487 void PutSerifFontFamilyName(std::string font) override; 4488@@ -49,6 +61,8 @@ class NWebPreferenceDelegate : public NWebPreference { 4489 void PutAccessModeForSecureOriginLoadFromInsecure(AccessMode mode) override; 4490 void PutZoomingFunctionEnabled(bool flag) override; 4491 void PutBlockNetwork(bool flag) override; 4492+ void PutCacheMode(NWebPreference::CacheModeFlag flag) override; 4493+ void PutWebDebuggingAccess(bool flag) override; 4494 4495 /* get methods*/ 4496 bool EnableContentAccess() override; 4497@@ -71,15 +85,18 @@ class NWebPreferenceDelegate : public NWebPreference { 4498 bool IsImageLoadingAllowed() override; 4499 int FontSizeLowerLimit() override; 4500 int LogicalFontSizeLowerLimit() override; 4501+ bool IsLoadWithOverviewMode() override; 4502 std::string SansSerifFontFamilyName() override; 4503 std::string SerifFontFamilyName() override; 4504 std::string StandardFontFamilyName() override; 4505 std::string UserAgent() override; 4506 int ZoomingForTextFactor() override; 4507 bool GeolocationAllowed() override; 4508- int AccessModeForSecureOriginLoadFromInsecure() override; 4509+ NWebPreference::AccessMode AccessModeForSecureOriginLoadFromInsecure() override; 4510 bool ZoomingfunctionEnabled() override; 4511 bool IsNetworkBlocked() override; 4512+ NWebPreference::CacheModeFlag CacheMode() override; 4513+ bool IsWebDebuggingAccess() override; 4514 4515 bool RunningInsecureContentAllowed(); 4516 bool UseStricMixedContentCheckingAllowed(); 4517@@ -117,10 +134,12 @@ class NWebPreferenceDelegate : public NWebPreference { 4518 std::string user_agent_{""}; 4519 int zooming_for_text_factor_{100}; 4520 bool geolocation_allowed_{true}; 4521- int access_mode_{NEVER_ALLOW}; 4522+ AccessMode access_mode_{AccessMode::NEVER_ALLOW}; 4523 bool zooming_function_enabled_{true}; 4524 bool is_network_blocked_; 4525 bool has_internet_permission_; 4526+ bool overload_mode_enabled_{true}; 4527+ CacheModeFlag cache_mode_flag_{CacheModeFlag::USE_DEFAULT}; 4528 }; 4529 } // namespace OHOS::NWeb 4530 4531diff --git a/src/ohos_nweb/src/cef_delegate/nweb_render_handler.cc b/src/ohos_nweb/src/cef_delegate/nweb_render_handler.cc 4532index ae7be00613..b61d89831b 100644 4533--- a/src/ohos_nweb/src/cef_delegate/nweb_render_handler.cc 4534+++ b/src/ohos_nweb/src/cef_delegate/nweb_render_handler.cc 4535@@ -1,6 +1,17 @@ 4536-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4537-// Use of this source code is governed by a BSD-style license that can be 4538-// found in the LICENSE file. 4539+/* 4540+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4541+ * Licensed under the Apache License, Version 2.0 (the "License"); 4542+ * you may not use this file except in compliance with the License. 4543+ * You may obtain a copy of the License at 4544+ * 4545+ * http://www.apache.org/licenses/LICENSE-2.0 4546+ * 4547+ * Unless required by applicable law or agreed to in writing, software 4548+ * distributed under the License is distributed on an "AS IS" BASIS, 4549+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4550+ * See the License for the specific language governing permissions and 4551+ * limitations under the License. 4552+ */ 4553 4554 #include "nweb_render_handler.h" 4555 4556diff --git a/src/ohos_nweb/src/cef_delegate/nweb_render_handler.h b/src/ohos_nweb/src/cef_delegate/nweb_render_handler.h 4557index 5f4165d47f..20d735e83a 100644 4558--- a/src/ohos_nweb/src/cef_delegate/nweb_render_handler.h 4559+++ b/src/ohos_nweb/src/cef_delegate/nweb_render_handler.h 4560@@ -1,6 +1,17 @@ 4561-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4562-// Use of this source code is governed by a BSD-style license that can be 4563-// found in the LICENSE file. 4564+/* 4565+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4566+ * Licensed under the Apache License, Version 2.0 (the "License"); 4567+ * you may not use this file except in compliance with the License. 4568+ * You may obtain a copy of the License at 4569+ * 4570+ * http://www.apache.org/licenses/LICENSE-2.0 4571+ * 4572+ * Unless required by applicable law or agreed to in writing, software 4573+ * distributed under the License is distributed on an "AS IS" BASIS, 4574+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4575+ * See the License for the specific language governing permissions and 4576+ * limitations under the License. 4577+ */ 4578 4579 #ifndef NWEB_RENDER_HANDLER_H 4580 #define NWEB_RENDER_HANDLER_H 4581diff --git a/src/ohos_nweb/src/cef_delegate/nweb_resource_handler.cc b/src/ohos_nweb/src/cef_delegate/nweb_resource_handler.cc 4582index 3b465b8f85..adbd62a1fc 100644 4583--- a/src/ohos_nweb/src/cef_delegate/nweb_resource_handler.cc 4584+++ b/src/ohos_nweb/src/cef_delegate/nweb_resource_handler.cc 4585@@ -1,6 +1,17 @@ 4586-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4587-// Use of this source code is governed by a BSD-style license that can be 4588-// found in the LICENSE file. 4589+/* 4590+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4591+ * Licensed under the Apache License, Version 2.0 (the "License"); 4592+ * you may not use this file except in compliance with the License. 4593+ * You may obtain a copy of the License at 4594+ * 4595+ * http://www.apache.org/licenses/LICENSE-2.0 4596+ * 4597+ * Unless required by applicable law or agreed to in writing, software 4598+ * distributed under the License is distributed on an "AS IS" BASIS, 4599+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4600+ * See the License for the specific language governing permissions and 4601+ * limitations under the License. 4602+ */ 4603 4604 #include "nweb_resource_handler.h" 4605 #include "base/logging.h" 4606diff --git a/src/ohos_nweb/src/cef_delegate/nweb_resource_handler.h b/src/ohos_nweb/src/cef_delegate/nweb_resource_handler.h 4607index fc23967df1..e423190bd4 100644 4608--- a/src/ohos_nweb/src/cef_delegate/nweb_resource_handler.h 4609+++ b/src/ohos_nweb/src/cef_delegate/nweb_resource_handler.h 4610@@ -1,6 +1,17 @@ 4611-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4612-// Use of this source code is governed by a BSD-style license that can be 4613-// found in the LICENSE file. 4614+/* 4615+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4616+ * Licensed under the Apache License, Version 2.0 (the "License"); 4617+ * you may not use this file except in compliance with the License. 4618+ * You may obtain a copy of the License at 4619+ * 4620+ * http://www.apache.org/licenses/LICENSE-2.0 4621+ * 4622+ * Unless required by applicable law or agreed to in writing, software 4623+ * distributed under the License is distributed on an "AS IS" BASIS, 4624+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4625+ * See the License for the specific language governing permissions and 4626+ * limitations under the License. 4627+ */ 4628 4629 #ifndef NWEB_REOURCE_HANDLER_H 4630 #define NWEB_REOURCE_HANDLER_H 4631diff --git a/src/ohos_nweb/src/nweb_cookie_manager_delegate_interface.h b/src/ohos_nweb/src/nweb_cookie_manager_delegate_interface.h 4632index 564c57934e..5364766d88 100644 4633--- a/src/ohos_nweb/src/nweb_cookie_manager_delegate_interface.h 4634+++ b/src/ohos_nweb/src/nweb_cookie_manager_delegate_interface.h 4635@@ -1,6 +1,17 @@ 4636-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4637-// Use of this source code is governed by a BSD-style license that can be 4638-// found in the LICENSE file. 4639+/* 4640+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4641+ * Licensed under the Apache License, Version 2.0 (the "License"); 4642+ * you may not use this file except in compliance with the License. 4643+ * You may obtain a copy of the License at 4644+ * 4645+ * http://www.apache.org/licenses/LICENSE-2.0 4646+ * 4647+ * Unless required by applicable law or agreed to in writing, software 4648+ * distributed under the License is distributed on an "AS IS" BASIS, 4649+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4650+ * See the License for the specific language governing permissions and 4651+ * limitations under the License. 4652+ */ 4653 4654 #ifndef NWEB_COOKIE_MANAGER_DELEGATE_INTERFACE_H 4655 #define NWEB_COOKIE_MANAGER_DELEGATE_INTERFACE_H 4656@@ -20,12 +31,16 @@ class NWebCookieManagerDelegateInterface { 4657 virtual void ReturnCookie( 4658 const std::string& url, 4659 std::shared_ptr<NWebValueCallback<std::string>> callback) = 0; 4660+ virtual std::string ReturnCookie(const std::string &url) = 0; 4661 virtual void SetCookie(const std::string& url, 4662 const std::string& value, 4663 std::shared_ptr<NWebValueCallback<bool>> callback) = 0; 4664+ virtual bool SetCookie(const std::string &url, 4665+ const std::string &value) = 0; 4666 virtual void ExistCookies( 4667 std::shared_ptr<NWebValueCallback<bool>> callback) = 0; 4668 virtual void Store(std::shared_ptr<NWebValueCallback<bool>> callback) = 0; 4669+ virtual bool Store() = 0; 4670 virtual void DeleteSessionCookies( 4671 std::shared_ptr<NWebValueCallback<bool>> callback) = 0; 4672 virtual void DeleteCookieEntirely( 4673diff --git a/src/ohos_nweb/src/nweb_cookie_manager_impl.cc b/src/ohos_nweb/src/nweb_cookie_manager_impl.cc 4674index 5d0659ed85..64c0a04158 100644 4675--- a/src/ohos_nweb/src/nweb_cookie_manager_impl.cc 4676+++ b/src/ohos_nweb/src/nweb_cookie_manager_impl.cc 4677@@ -1,6 +1,17 @@ 4678-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4679-// Use of this source code is governed by a BSD-style license that can be 4680-// found in the LICENSE file. 4681+/* 4682+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4683+ * Licensed under the Apache License, Version 2.0 (the "License"); 4684+ * you may not use this file except in compliance with the License. 4685+ * You may obtain a copy of the License at 4686+ * 4687+ * http://www.apache.org/licenses/LICENSE-2.0 4688+ * 4689+ * Unless required by applicable law or agreed to in writing, software 4690+ * distributed under the License is distributed on an "AS IS" BASIS, 4691+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4692+ * See the License for the specific language governing permissions and 4693+ * limitations under the License. 4694+ */ 4695 4696 #include "nweb_cookie_manager_impl.h" 4697 #include "nweb_cookie_manager_delegate.h" 4698@@ -8,6 +19,12 @@ 4699 4700 using namespace OHOS::NWeb; 4701 4702+extern "C" OHOS_NWEB_EXPORT NWebCookieManager* GetCookieManager() { 4703+ WVLOG_I("GetCookieManager"); 4704+ static NWebCookieManagerImpl cookie_manager; 4705+ return &cookie_manager; 4706+} 4707+ 4708 namespace OHOS::NWeb { 4709 NWebCookieManagerImpl::NWebCookieManagerImpl() { 4710 #if defined(USE_CEF) 4711@@ -50,6 +67,15 @@ void NWebCookieManagerImpl::SetCookie( 4712 } 4713 } 4714 4715+bool NWebCookieManagerImpl::SetCookie( 4716+ const std::string& url, 4717+ const std::string& value) { 4718+ if (delegate_ != nullptr) { 4719+ return delegate_->SetCookie(url, value); 4720+ } 4721+ return false; 4722+} 4723+ 4724 void NWebCookieManagerImpl::ReturnCookie( 4725 const std::string& url, 4726 std::shared_ptr<NWebValueCallback<std::string>> callback) { 4727@@ -58,6 +84,14 @@ void NWebCookieManagerImpl::ReturnCookie( 4728 } 4729 } 4730 4731+std::string NWebCookieManagerImpl::ReturnCookie( 4732+ const std::string& url) { 4733+ if (delegate_ != nullptr) { 4734+ return delegate_->ReturnCookie(url); 4735+ } 4736+ return ""; 4737+} 4738+ 4739 void NWebCookieManagerImpl::ExistCookies( 4740 std::shared_ptr<NWebValueCallback<bool>> callback) { 4741 if (delegate_ != nullptr) { 4742@@ -72,6 +106,13 @@ void NWebCookieManagerImpl::Store( 4743 } 4744 } 4745 4746+bool NWebCookieManagerImpl::Store() { 4747+ if (delegate_ != nullptr) { 4748+ return delegate_->Store(); 4749+ } 4750+ return false; 4751+} 4752+ 4753 void NWebCookieManagerImpl::DeleteSessionCookies( 4754 std::shared_ptr<NWebValueCallback<bool>> callback) { 4755 if (delegate_ != nullptr) { 4756@@ -85,9 +126,4 @@ void NWebCookieManagerImpl::DeleteCookieEntirely( 4757 delegate_->DeleteCookieEntirely(callback); 4758 } 4759 } 4760- 4761-NWebCookieManager* NWebCookieManager::GetInstance() { 4762- static NWebCookieManagerImpl instance; 4763- return &instance; 4764-} 4765 } // namespace OHOS::NWeb 4766\ No newline at end of file 4767diff --git a/src/ohos_nweb/src/nweb_cookie_manager_impl.h b/src/ohos_nweb/src/nweb_cookie_manager_impl.h 4768index 128ab637b7..baa468006d 100644 4769--- a/src/ohos_nweb/src/nweb_cookie_manager_impl.h 4770+++ b/src/ohos_nweb/src/nweb_cookie_manager_impl.h 4771@@ -1,6 +1,17 @@ 4772-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4773-// Use of this source code is governed by a BSD-style license that can be 4774-// found in the LICENSE file. 4775+/* 4776+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4777+ * Licensed under the Apache License, Version 2.0 (the "License"); 4778+ * you may not use this file except in compliance with the License. 4779+ * You may obtain a copy of the License at 4780+ * 4781+ * http://www.apache.org/licenses/LICENSE-2.0 4782+ * 4783+ * Unless required by applicable law or agreed to in writing, software 4784+ * distributed under the License is distributed on an "AS IS" BASIS, 4785+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4786+ * See the License for the specific language governing permissions and 4787+ * limitations under the License. 4788+ */ 4789 4790 #ifndef NWEB_COOKIE_MANAGER_IMPL_H 4791 #define NWEB_COOKIE_MANAGER_IMPL_H 4792@@ -21,18 +32,22 @@ class NWebCookieManagerImpl : public NWebCookieManager { 4793 void ReturnCookie( 4794 const std::string& url, 4795 std::shared_ptr<NWebValueCallback<std::string>> callback) override; 4796+ std::string ReturnCookie(const std::string &url) override; 4797 void SetCookie(const std::string& url, 4798 const std::string& value, 4799 std::shared_ptr<NWebValueCallback<bool>> callback) override; 4800+ bool SetCookie(const std::string &url, 4801+ const std::string &value) override; 4802 void ExistCookies(std::shared_ptr<NWebValueCallback<bool>> callback) override; 4803 void Store(std::shared_ptr<NWebValueCallback<bool>> callback) override; 4804+ bool Store() override; 4805 void DeleteSessionCookies( 4806 std::shared_ptr<NWebValueCallback<bool>> callback) override; 4807 void DeleteCookieEntirely( 4808 std::shared_ptr<NWebValueCallback<bool>> callback) override; 4809 4810 private: 4811- std::shared_ptr<NWebCookieManagerDelegateInterface> delegate_ = nullptr; 4812+ std::shared_ptr<NWebCookieManagerDelegateInterface> delegate_; 4813 }; 4814 } // namespace OHOS::NWeb 4815 4816diff --git a/src/ohos_nweb/src/nweb_delegate_adapter.cc b/src/ohos_nweb/src/nweb_delegate_adapter.cc 4817index e604c27e77..badff60157 100644 4818--- a/src/ohos_nweb/src/nweb_delegate_adapter.cc 4819+++ b/src/ohos_nweb/src/nweb_delegate_adapter.cc 4820@@ -1,6 +1,17 @@ 4821-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4822-// Use of this source code is governed by a BSD-style license that can be 4823-// found in the LICENSE file. 4824+/* 4825+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4826+ * Licensed under the Apache License, Version 2.0 (the "License"); 4827+ * you may not use this file except in compliance with the License. 4828+ * You may obtain a copy of the License at 4829+ * 4830+ * http://www.apache.org/licenses/LICENSE-2.0 4831+ * 4832+ * Unless required by applicable law or agreed to in writing, software 4833+ * distributed under the License is distributed on an "AS IS" BASIS, 4834+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4835+ * See the License for the specific language governing permissions and 4836+ * limitations under the License. 4837+ */ 4838 4839 #include "nweb_delegate_adapter.h" 4840 4841diff --git a/src/ohos_nweb/src/nweb_delegate_adapter.h b/src/ohos_nweb/src/nweb_delegate_adapter.h 4842index 0a47d2b4ed..36eb920b24 100644 4843--- a/src/ohos_nweb/src/nweb_delegate_adapter.h 4844+++ b/src/ohos_nweb/src/nweb_delegate_adapter.h 4845@@ -1,6 +1,17 @@ 4846-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4847-// Use of this source code is governed by a BSD-style license that can be 4848-// found in the LICENSE file. 4849+/* 4850+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4851+ * Licensed under the Apache License, Version 2.0 (the "License"); 4852+ * you may not use this file except in compliance with the License. 4853+ * You may obtain a copy of the License at 4854+ * 4855+ * http://www.apache.org/licenses/LICENSE-2.0 4856+ * 4857+ * Unless required by applicable law or agreed to in writing, software 4858+ * distributed under the License is distributed on an "AS IS" BASIS, 4859+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4860+ * See the License for the specific language governing permissions and 4861+ * limitations under the License. 4862+ */ 4863 4864 #ifndef NWEB_DELEGATE_HELPER_H 4865 #define NWEB_DELEGATE_HELPER_H 4866diff --git a/src/ohos_nweb/src/nweb_delegate_interface.h b/src/ohos_nweb/src/nweb_delegate_interface.h 4867index 179578beec..487de47028 100755 4868--- a/src/ohos_nweb/src/nweb_delegate_interface.h 4869+++ b/src/ohos_nweb/src/nweb_delegate_interface.h 4870@@ -1,6 +1,17 @@ 4871-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4872-// Use of this source code is governed by a BSD-style license that can be 4873-// found in the LICENSE file. 4874+/* 4875+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4876+ * Licensed under the Apache License, Version 2.0 (the "License"); 4877+ * you may not use this file except in compliance with the License. 4878+ * You may obtain a copy of the License at 4879+ * 4880+ * http://www.apache.org/licenses/LICENSE-2.0 4881+ * 4882+ * Unless required by applicable law or agreed to in writing, software 4883+ * distributed under the License is distributed on an "AS IS" BASIS, 4884+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4885+ * See the License for the specific language governing permissions and 4886+ * limitations under the License. 4887+ */ 4888 4889 #ifndef NWEB_DELEGATE_INTERFACE_H 4890 #define NWEB_DELEGATE_INTERFACE_H 4891@@ -39,6 +50,7 @@ class NWebDelegateInterface { 4892 virtual bool CanNavigateBackOrForward(int numSteps) const = 0; 4893 virtual void NavigateBack() const = 0; 4894 virtual void NavigateForward() const = 0; 4895+ virtual void DeleteNavigateHistory() = 0; 4896 virtual void Reload() const = 0; 4897 virtual void Zoom(float zoomFactor) const = 0; 4898 virtual void Stop() const = 0; 4899diff --git a/src/ohos_nweb/src/nweb_hilog.h b/src/ohos_nweb/src/nweb_hilog.h 4900index 0e9518b413..467fc56643 100644 4901--- a/src/ohos_nweb/src/nweb_hilog.h 4902+++ b/src/ohos_nweb/src/nweb_hilog.h 4903@@ -1,6 +1,17 @@ 4904-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4905-// Use of this source code is governed by a BSD-style license that can be 4906-// found in the LICENSE file. 4907+/* 4908+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4909+ * Licensed under the Apache License, Version 2.0 (the "License"); 4910+ * you may not use this file except in compliance with the License. 4911+ * You may obtain a copy of the License at 4912+ * 4913+ * http://www.apache.org/licenses/LICENSE-2.0 4914+ * 4915+ * Unless required by applicable law or agreed to in writing, software 4916+ * distributed under the License is distributed on an "AS IS" BASIS, 4917+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4918+ * See the License for the specific language governing permissions and 4919+ * limitations under the License. 4920+ */ 4921 4922 #ifndef NWEB_HILOG_H 4923 #define NWEB_HILOG_H 4924diff --git a/src/ohos_nweb/src/nweb_impl.cc b/src/ohos_nweb/src/nweb_impl.cc 4925index 27f257873e..2f4fa01d20 100755 4926--- a/src/ohos_nweb/src/nweb_impl.cc 4927+++ b/src/ohos_nweb/src/nweb_impl.cc 4928@@ -1,6 +1,17 @@ 4929-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4930-// Use of this source code is governed by a BSD-style license that can be 4931-// found in the LICENSE file. 4932+/* 4933+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4934+ * Licensed under the Apache License, Version 2.0 (the "License"); 4935+ * you may not use this file except in compliance with the License. 4936+ * You may obtain a copy of the License at 4937+ * 4938+ * http://www.apache.org/licenses/LICENSE-2.0 4939+ * 4940+ * Unless required by applicable law or agreed to in writing, software 4941+ * distributed under the License is distributed on an "AS IS" BASIS, 4942+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 4943+ * See the License for the specific language governing permissions and 4944+ * limitations under the License. 4945+ */ 4946 4947 #include "nweb_impl.h" 4948 4949@@ -148,6 +159,9 @@ void NWebImpl::InitWebEngineArgs(const NWebInitArgs& init_args) { 4950 web_engine_args_.emplace_back("/system/bin/web_render"); 4951 web_engine_args_.emplace_back("--in-process-gpu"); 4952 web_engine_args_.emplace_back("--disable-dev-shm-usage"); 4953+#ifdef GPU_RK3568 4954+ // web_engine_args_.emplace_back("--disable-gpu"); 4955+#endif 4956 web_engine_args_.emplace_back("--no-unsandboxed-zygote"); 4957 web_engine_args_.emplace_back("--no-zygote"); 4958 web_engine_args_.emplace_back("--off-screen-frame-rate=60"); 4959@@ -157,9 +171,11 @@ void NWebImpl::InitWebEngineArgs(const NWebInitArgs& init_args) { 4960 web_engine_args_.emplace_back("--ignore-certificate-errors"); 4961 web_engine_args_.emplace_back("--use-mobile-user-agent"); 4962 web_engine_args_.emplace_back("--enable-gpu-rasterization"); 4963+ web_engine_args_.emplace_back("--enable-viewport"); 4964 web_engine_args_.emplace_back( 4965 "--browser-subprocess-path=/system/bin/web_render"); 4966 web_engine_args_.emplace_back("--zygote-cmd-prefix=/system/bin/web_render"); 4967+ web_engine_args_.emplace_back("--remote-debugging-port=9222"); 4968 4969 for (auto arg : init_args.web_engine_args_to_delete) { 4970 auto it = std::find(web_engine_args_.begin(), web_engine_args_.end(), arg); 4971@@ -285,6 +301,13 @@ void NWebImpl::NavigateForward() const { 4972 nweb_delegate_->NavigateForward(); 4973 } 4974 4975+void NWebImpl::DeleteNavigateHistory() { 4976+ if (nweb_delegate_ == nullptr) { 4977+ return; 4978+ } 4979+ nweb_delegate_->DeleteNavigateHistory(); 4980+} 4981+ 4982 void NWebImpl::Reload() const { 4983 if (nweb_delegate_ == nullptr) { 4984 return; 4985diff --git a/src/ohos_nweb/src/nweb_impl.h b/src/ohos_nweb/src/nweb_impl.h 4986index e47f0a8e01..d752003c9a 100755 4987--- a/src/ohos_nweb/src/nweb_impl.h 4988+++ b/src/ohos_nweb/src/nweb_impl.h 4989@@ -1,6 +1,17 @@ 4990-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 4991-// Use of this source code is governed by a BSD-style license that can be 4992-// found in the LICENSE file. 4993+/* 4994+ * Copyright (c) 2022 Huawei Device Co., Ltd. 4995+ * Licensed under the Apache License, Version 2.0 (the "License"); 4996+ * you may not use this file except in compliance with the License. 4997+ * You may obtain a copy of the License at 4998+ * 4999+ * http://www.apache.org/licenses/LICENSE-2.0 5000+ * 5001+ * Unless required by applicable law or agreed to in writing, software 5002+ * distributed under the License is distributed on an "AS IS" BASIS, 5003+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5004+ * See the License for the specific language governing permissions and 5005+ * limitations under the License. 5006+ */ 5007 5008 #ifndef NWEB_IMPL_H 5009 #define NWEB_IMPL_H 5010@@ -40,6 +51,7 @@ class NWebImpl : public NWeb { 5011 bool CanNavigateBackOrForward(int numSteps) const override; 5012 void NavigateBack() const override; 5013 void NavigateForward() const override; 5014+ void DeleteNavigateHistory() override; 5015 void Reload() const override; 5016 void Zoom(float zoomFactor) const override; 5017 void Stop() const override; 5018diff --git a/src/ohos_nweb/src/nweb_input_handler.cc b/src/ohos_nweb/src/nweb_input_handler.cc 5019index 78ea32c2b0..247d2fab7d 100644 5020--- a/src/ohos_nweb/src/nweb_input_handler.cc 5021+++ b/src/ohos_nweb/src/nweb_input_handler.cc 5022@@ -1,6 +1,17 @@ 5023-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5024-// Use of this source code is governed by a BSD-style license that can be 5025-// found in the LICENSE file. 5026+/* 5027+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5028+ * Licensed under the Apache License, Version 2.0 (the "License"); 5029+ * you may not use this file except in compliance with the License. 5030+ * You may obtain a copy of the License at 5031+ * 5032+ * http://www.apache.org/licenses/LICENSE-2.0 5033+ * 5034+ * Unless required by applicable law or agreed to in writing, software 5035+ * distributed under the License is distributed on an "AS IS" BASIS, 5036+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5037+ * See the License for the specific language governing permissions and 5038+ * limitations under the License. 5039+ */ 5040 5041 #include "nweb_input_handler.h" 5042 #include "nweb_hilog.h" 5043diff --git a/src/ohos_nweb/src/nweb_input_handler.h b/src/ohos_nweb/src/nweb_input_handler.h 5044index ee88ec0055..802229b4b0 100644 5045--- a/src/ohos_nweb/src/nweb_input_handler.h 5046+++ b/src/ohos_nweb/src/nweb_input_handler.h 5047@@ -1,6 +1,17 @@ 5048-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5049-// Use of this source code is governed by a BSD-style license that can be 5050-// found in the LICENSE file. 5051+/* 5052+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5053+ * Licensed under the Apache License, Version 2.0 (the "License"); 5054+ * you may not use this file except in compliance with the License. 5055+ * You may obtain a copy of the License at 5056+ * 5057+ * http://www.apache.org/licenses/LICENSE-2.0 5058+ * 5059+ * Unless required by applicable law or agreed to in writing, software 5060+ * distributed under the License is distributed on an "AS IS" BASIS, 5061+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5062+ * See the License for the specific language governing permissions and 5063+ * limitations under the License. 5064+ */ 5065 5066 #ifndef NWEB_INPUT_HANDLER_H 5067 #define NWEB_INPUT_HANDLER_H 5068diff --git a/src/ohos_nweb/src/nweb_inputmethod_handler.cc b/src/ohos_nweb/src/nweb_inputmethod_handler.cc 5069index 4163efc359..08e9f6ecac 100644 5070--- a/src/ohos_nweb/src/nweb_inputmethod_handler.cc 5071+++ b/src/ohos_nweb/src/nweb_inputmethod_handler.cc 5072@@ -1,11 +1,21 @@ 5073-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5074-// Use of this source code is governed by a BSD-style license that can be 5075-// found in the LICENSE file. 5076+/* 5077+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5078+ * Licensed under the Apache License, Version 2.0 (the "License"); 5079+ * you may not use this file except in compliance with the License. 5080+ * You may obtain a copy of the License at 5081+ * 5082+ * http://www.apache.org/licenses/LICENSE-2.0 5083+ * 5084+ * Unless required by applicable law or agreed to in writing, software 5085+ * distributed under the License is distributed on an "AS IS" BASIS, 5086+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5087+ * See the License for the specific language governing permissions and 5088+ * limitations under the License. 5089+ */ 5090 5091 #include "nweb_inputmethod_handler.h" 5092 5093-#include <input_method_controller.h> 5094-#include <input_method_utils.h> 5095+#include "input_method_utils.h" 5096 5097 #include "base/bind.h" 5098 #include "base/callback.h" 5099@@ -37,7 +47,7 @@ class OnTextChangedListenerImpl 5100 5101 void SendKeyEventFromInputMethod( 5102 const OHOS::MiscServices::KeyEvent& event) override { 5103- LOG(INFO) << "NWebInputMethodHandler::DeleteBackward"; 5104+ LOG(INFO) << "NWebInputMethodHandler::SendKeyEventFromInputMethod"; 5105 } 5106 5107 void SendKeyboardInfo(const OHOS::MiscServices::KeyboardInfo& info) override { 5108@@ -54,16 +64,13 @@ class OnTextChangedListenerImpl 5109 } 5110 5111 void MoveCursor(const OHOS::MiscServices::Direction direction) override { 5112- LOG(INFO) << "NWebInputMethodHandler::MoveCursor "; 5113+ LOG(INFO) << "NWebInputMethodHandler::MoveCursor"; 5114 } 5115 5116 private: 5117 NWebInputMethodHandler* handler_; 5118 }; 5119 5120-// The object should be freed while keyboard hidden. 5121-OHOS::sptr<OHOS::MiscServices::OnTextChangedListener> g_listener = nullptr; 5122- 5123 class InputMethodTask : public CefTask { 5124 public: 5125 explicit InputMethodTask(const base::Closure& closure) : closure_(closure) {} 5126@@ -81,20 +88,17 @@ class InputMethodTask : public CefTask { 5127 }; 5128 5129 NWebInputMethodHandler::NWebInputMethodHandler() 5130- : selected_from_(0), selected_to_(0) { 5131- g_listener = nullptr; 5132-} 5133+ : selected_from_(0), selected_to_(0) {} 5134 5135 NWebInputMethodHandler::~NWebInputMethodHandler() {} 5136 5137 void NWebInputMethodHandler::Attach(CefRefPtr<CefBrowser> browser) { 5138 composing_text_.clear(); 5139 browser_ = browser; 5140- 5141- if (g_listener == nullptr) { 5142- g_listener = new OnTextChangedListenerImpl(this); 5143+ if (inputmethod_listener_ == nullptr) { 5144+ inputmethod_listener_ = new OnTextChangedListenerImpl(this); 5145 } 5146- OHOS::MiscServices::InputMethodController::GetInstance()->Attach(g_listener); 5147+ OHOS::MiscServices::InputMethodController::GetInstance()->Attach(inputmethod_listener_); 5148 } 5149 5150 void NWebInputMethodHandler::ShowTextInput() { 5151@@ -183,6 +187,12 @@ void NWebInputMethodHandler::InsertTextHandlerOnUI(const std::u16string& text) { 5152 CefRange selection_range(0, static_cast<int>(composing_text_.length())); 5153 browser_->GetHost()->ImeSetComposition(CefString(composing_text_), underlines, 5154 replacement_range, selection_range); 5155+ // no selection 5156+ browser_->GetHost()->ImeFinishComposingText(false); 5157+ ime_text_composing_ = false; 5158+ selected_from_ += static_cast<int>(composing_text_.length()); 5159+ selected_to_ += static_cast<int>(composing_text_.length()); 5160+ composing_text_.clear(); 5161 } 5162 5163 void NWebInputMethodHandler::DeleteBackwardHandlerOnUI(int32_t length) { 5164diff --git a/src/ohos_nweb/src/nweb_inputmethod_handler.h b/src/ohos_nweb/src/nweb_inputmethod_handler.h 5165index 7fc624e2b3..9cb6c7c62f 100644 5166--- a/src/ohos_nweb/src/nweb_inputmethod_handler.h 5167+++ b/src/ohos_nweb/src/nweb_inputmethod_handler.h 5168@@ -1,10 +1,23 @@ 5169-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5170-// Use of this source code is governed by a BSD-style license that can be 5171-// found in the LICENSE file. 5172+/* 5173+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5174+ * Licensed under the Apache License, Version 2.0 (the "License"); 5175+ * you may not use this file except in compliance with the License. 5176+ * You may obtain a copy of the License at 5177+ * 5178+ * http://www.apache.org/licenses/LICENSE-2.0 5179+ * 5180+ * Unless required by applicable law or agreed to in writing, software 5181+ * distributed under the License is distributed on an "AS IS" BASIS, 5182+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5183+ * See the License for the specific language governing permissions and 5184+ * limitations under the License. 5185+ */ 5186 5187 #ifndef OHOS_NWEB_SRC_NWEB_INPUTMETHOD_HANDLER_H_ 5188 #define OHOS_NWEB_SRC_NWEB_INPUTMETHOD_HANDLER_H_ 5189 5190+#include "input_method_controller.h" 5191+ 5192 #include "cef_delegate/nweb_inputmethod_client.h" 5193 5194 namespace OHOS::NWeb { 5195@@ -37,6 +50,7 @@ class NWebInputMethodHandler : public NWebInputMethodClient { 5196 std::u16string composing_text_; 5197 int selected_from_; 5198 int selected_to_; 5199+ OHOS::sptr<OHOS::MiscServices::OnTextChangedListener> inputmethod_listener_ = nullptr; 5200 5201 IMPLEMENT_REFCOUNTING(NWebInputMethodHandler); 5202 DISALLOW_COPY_AND_ASSIGN(NWebInputMethodHandler); 5203diff --git a/src/ohos_nweb/src/nweb_output_handler.cc b/src/ohos_nweb/src/nweb_output_handler.cc 5204index 1f2a5dec38..0581ad7a63 100644 5205--- a/src/ohos_nweb/src/nweb_output_handler.cc 5206+++ b/src/ohos_nweb/src/nweb_output_handler.cc 5207@@ -1,6 +1,17 @@ 5208-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5209-// Use of this source code is governed by a BSD-style license that can be 5210-// found in the LICENSE file. 5211+/* 5212+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5213+ * Licensed under the Apache License, Version 2.0 (the "License"); 5214+ * you may not use this file except in compliance with the License. 5215+ * You may obtain a copy of the License at 5216+ * 5217+ * http://www.apache.org/licenses/LICENSE-2.0 5218+ * 5219+ * Unless required by applicable law or agreed to in writing, software 5220+ * distributed under the License is distributed on an "AS IS" BASIS, 5221+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5222+ * See the License for the specific language governing permissions and 5223+ * limitations under the License. 5224+ */ 5225 5226 #include "nweb_output_handler.h" 5227 5228diff --git a/src/ohos_nweb/src/nweb_output_handler.h b/src/ohos_nweb/src/nweb_output_handler.h 5229index 059f3d5722..165f136f66 100644 5230--- a/src/ohos_nweb/src/nweb_output_handler.h 5231+++ b/src/ohos_nweb/src/nweb_output_handler.h 5232@@ -1,6 +1,17 @@ 5233-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5234-// Use of this source code is governed by a BSD-style license that can be 5235-// found in the LICENSE file. 5236+/* 5237+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5238+ * Licensed under the Apache License, Version 2.0 (the "License"); 5239+ * you may not use this file except in compliance with the License. 5240+ * You may obtain a copy of the License at 5241+ * 5242+ * http://www.apache.org/licenses/LICENSE-2.0 5243+ * 5244+ * Unless required by applicable law or agreed to in writing, software 5245+ * distributed under the License is distributed on an "AS IS" BASIS, 5246+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5247+ * See the License for the specific language governing permissions and 5248+ * limitations under the License. 5249+ */ 5250 5251 #ifndef NWEB_OUTPUT_HANDLER_H 5252 #define NWEB_OUTPUT_HANDLER_H 5253diff --git a/src/ohos_nweb/src/nweb_render_main.cc b/src/ohos_nweb/src/nweb_render_main.cc 5254index b0b3122e56..a01d0e3007 100644 5255--- a/src/ohos_nweb/src/nweb_render_main.cc 5256+++ b/src/ohos_nweb/src/nweb_render_main.cc 5257@@ -1,6 +1,17 @@ 5258-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5259-// Use of this source code is governed by a BSD-style license that can be 5260-// found in the LICENSE file. 5261+/* 5262+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5263+ * Licensed under the Apache License, Version 2.0 (the "License"); 5264+ * you may not use this file except in compliance with the License. 5265+ * You may obtain a copy of the License at 5266+ * 5267+ * http://www.apache.org/licenses/LICENSE-2.0 5268+ * 5269+ * Unless required by applicable law or agreed to in writing, software 5270+ * distributed under the License is distributed on an "AS IS" BASIS, 5271+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5272+ * See the License for the specific language governing permissions and 5273+ * limitations under the License. 5274+ */ 5275 5276 #include <unistd.h> 5277 #include <sstream> 5278diff --git a/src/ohos_nweb/src/nweb_url_resource_error_impl.h b/src/ohos_nweb/src/nweb_url_resource_error_impl.h 5279index d935afea26..b5557badc3 100644 5280--- a/src/ohos_nweb/src/nweb_url_resource_error_impl.h 5281+++ b/src/ohos_nweb/src/nweb_url_resource_error_impl.h 5282@@ -1,6 +1,17 @@ 5283-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5284-// Use of this source code is governed by a BSD-style license that can be 5285-// found in the LICENSE file. 5286+/* 5287+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5288+ * Licensed under the Apache License, Version 2.0 (the "License"); 5289+ * you may not use this file except in compliance with the License. 5290+ * You may obtain a copy of the License at 5291+ * 5292+ * http://www.apache.org/licenses/LICENSE-2.0 5293+ * 5294+ * Unless required by applicable law or agreed to in writing, software 5295+ * distributed under the License is distributed on an "AS IS" BASIS, 5296+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5297+ * See the License for the specific language governing permissions and 5298+ * limitations under the License. 5299+ */ 5300 5301 #ifndef NWEB_URL_RESOURCE_ERROR_IMPL 5302 #define NWEB_URL_RESOURCE_ERROR_IMPL 5303diff --git a/src/ohos_nweb/src/nweb_url_resource_request_impl.cc b/src/ohos_nweb/src/nweb_url_resource_request_impl.cc 5304index 45b819debd..7c58f035b6 100644 5305--- a/src/ohos_nweb/src/nweb_url_resource_request_impl.cc 5306+++ b/src/ohos_nweb/src/nweb_url_resource_request_impl.cc 5307@@ -1,6 +1,17 @@ 5308-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5309-// Use of this source code is governed by a BSD-style license that can be 5310-// found in the LICENSE file. 5311+/* 5312+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5313+ * Licensed under the Apache License, Version 2.0 (the "License"); 5314+ * you may not use this file except in compliance with the License. 5315+ * You may obtain a copy of the License at 5316+ * 5317+ * http://www.apache.org/licenses/LICENSE-2.0 5318+ * 5319+ * Unless required by applicable law or agreed to in writing, software 5320+ * distributed under the License is distributed on an "AS IS" BASIS, 5321+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5322+ * See the License for the specific language governing permissions and 5323+ * limitations under the License. 5324+ */ 5325 5326 #include "nweb_url_resource_request_impl.h" 5327 5328diff --git a/src/ohos_nweb/src/nweb_url_resource_request_impl.h b/src/ohos_nweb/src/nweb_url_resource_request_impl.h 5329index 9387b49884..8e7b23c1ae 100644 5330--- a/src/ohos_nweb/src/nweb_url_resource_request_impl.h 5331+++ b/src/ohos_nweb/src/nweb_url_resource_request_impl.h 5332@@ -1,6 +1,17 @@ 5333-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5334-// Use of this source code is governed by a BSD-style license that can be 5335-// found in the LICENSE file. 5336+/* 5337+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5338+ * Licensed under the Apache License, Version 2.0 (the "License"); 5339+ * you may not use this file except in compliance with the License. 5340+ * You may obtain a copy of the License at 5341+ * 5342+ * http://www.apache.org/licenses/LICENSE-2.0 5343+ * 5344+ * Unless required by applicable law or agreed to in writing, software 5345+ * distributed under the License is distributed on an "AS IS" BASIS, 5346+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5347+ * See the License for the specific language governing permissions and 5348+ * limitations under the License. 5349+ */ 5350 5351 #ifndef NWEB_URL_RESOURCE_REQUEAST_IMPL_H 5352 #define NWEB_URL_RESOURCE_REQUEAST_IMPL_H 5353diff --git a/src/ohos_nweb/src/ohos_nweb_main.cc b/src/ohos_nweb/src/ohos_nweb_main.cc 5354index 746f9c4012..ca177b2b7b 100644 5355--- a/src/ohos_nweb/src/ohos_nweb_main.cc 5356+++ b/src/ohos_nweb/src/ohos_nweb_main.cc 5357@@ -1,6 +1,17 @@ 5358-// Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 5359-// Use of this source code is governed by a BSD-style license that can be 5360-// found in the LICENSE file. 5361+/* 5362+ * Copyright (c) 2022 Huawei Device Co., Ltd. 5363+ * Licensed under the Apache License, Version 2.0 (the "License"); 5364+ * you may not use this file except in compliance with the License. 5365+ * You may obtain a copy of the License at 5366+ * 5367+ * http://www.apache.org/licenses/LICENSE-2.0 5368+ * 5369+ * Unless required by applicable law or agreed to in writing, software 5370+ * distributed under the License is distributed on an "AS IS" BASIS, 5371+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 5372+ * See the License for the specific language governing permissions and 5373+ * limitations under the License. 5374+ */ 5375 5376 #include <unistd.h> 5377 #include <dlfcn.h> 5378diff --git a/src/services/device/geolocation/ohos/location_provider_ohos.cc b/src/services/device/geolocation/ohos/location_provider_ohos.cc 5379index 8f3eba7d1a..a4b69fed8f 100644 5380--- a/src/services/device/geolocation/ohos/location_provider_ohos.cc 5381+++ b/src/services/device/geolocation/ohos/location_provider_ohos.cc 5382@@ -17,18 +17,31 @@ namespace device { 5383 5384 // LocationProviderOhos 5385 LocationProviderOhos::LocationProviderOhos() { 5386- locator_callback_ = this; 5387+ locator_callback_ = new LocationProviderCallback(); 5388 } 5389 5390 LocationProviderOhos::~LocationProviderOhos() { 5391 StopProvider(); 5392- if (locator_ != nullptr) 5393+ if (locator_ != nullptr) { 5394 locator_.reset(); 5395+ } 5396+ if (locator_callback_ != nullptr) { 5397+ locator_callback_ = nullptr; 5398+ } 5399 } 5400 5401 void LocationProviderOhos::SetUpdateCallback( 5402 const LocationProviderUpdateCallback& callback) { 5403 callback_ = callback; 5404+ 5405+ locator_callback_->SetUpdateCallback(base::BindRepeating( 5406+ &LocationProviderOhos::ProviderUpdateCallback, base::Unretained(this))); 5407+} 5408+ 5409+void LocationProviderOhos::ProviderUpdateCallback( 5410+ const mojom::Geoposition& position) { 5411+ if (!callback_.is_null() && is_running_) 5412+ callback_.Run(this, position); 5413 } 5414 5415 void LocationProviderOhos::StartProvider(bool high_accuracy) { 5416@@ -40,18 +53,20 @@ void LocationProviderOhos::StopProvider() { 5417 if (!is_running_) 5418 return; 5419 is_running_ = false; 5420- locator_->StopLocating(locator_callback_); 5421+ OHOS::sptr<OHOS::Location::ILocatorCallback> locator_call_back = 5422+ locator_callback_; 5423+ locator_->StopLocating(locator_call_back); 5424 } 5425 5426 const mojom::Geoposition& LocationProviderOhos::GetPosition() { 5427- return last_position_; 5428+ return locator_callback_->GetPosition(); 5429 } 5430 5431 void LocationProviderOhos::OnPermissionGranted() { 5432 // Nothing to do here. 5433 } 5434 5435-void LocationProviderOhos::OnNewLocationAvailable( 5436+void LocationProviderCallback::OnNewLocationAvailable( 5437 const std::unique_ptr<OHOS::Location::Location>& location) { 5438 mojom::Geoposition position; 5439 position.latitude = location->GetLatitude(); 5440@@ -67,7 +82,7 @@ void LocationProviderOhos::OnNewLocationAvailable( 5441 NewGeopositionReport(position); 5442 } 5443 5444-void LocationProviderOhos::OnNewErrorAvailable(std::string message) { 5445+void LocationProviderCallback::OnNewErrorAvailable(std::string message) { 5446 mojom::Geoposition position_error; 5447 position_error.error_code = 5448 mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE; 5449@@ -82,7 +97,8 @@ void LocationProviderOhos::RequestLocationUpdate(bool high_accuracy) { 5450 CreateLocationManagerIfNeeded(); 5451 if (locator_ == nullptr) { 5452 LOG(ERROR) << "Locator is null. Can not get location"; 5453- OnErrorReport(LOCATION_GET_FAILED); 5454+ locator_callback_->OnErrorReport( 5455+ LocationProviderCallback::LOCATION_GET_FAILED); 5456 return; 5457 } 5458 5459@@ -90,14 +106,21 @@ void LocationProviderOhos::RequestLocationUpdate(bool high_accuracy) { 5460 std::unique_ptr<OHOS::Location::RequestConfig> requestConfig = 5461 std::make_unique<OHOS::Location::RequestConfig>(); 5462 SetRequestConfig(requestConfig, high_accuracy); 5463- 5464- locator_->StartLocating(requestConfig, locator_callback_, "location.ILocator", 5465- 0, 0); 5466+ OHOS::sptr<OHOS::Location::ILocatorCallback> locator_call_back = 5467+ locator_callback_; 5468+ int ret = locator_->StartLocating(requestConfig, locator_call_back, "location.ILocator", 5469+ 0, 0); 5470+ if (ret != 0) { 5471+ LOG(ERROR) << "StartLocating failed. Can not get location"; 5472+ locator_callback_->OnErrorReport( 5473+ LocationProviderCallback::LOCATION_GET_FAILED); 5474+ } 5475 } 5476 5477 void LocationProviderOhos::CreateLocationManagerIfNeeded() { 5478- if (locator_ != nullptr) 5479+ if (locator_ != nullptr) { 5480 return; 5481+ } 5482 locator_ = std::make_unique<OHOS::Location::LocatorProxy>( 5483 OHOS::Location::CommonUtils::GetRemoteObject( 5484 OHOS::LOCATION_LOCATOR_SA_ID, 5485@@ -111,21 +134,25 @@ void LocationProviderOhos::SetRequestConfig( 5486 requestConfig->SetScenario(OHOS::Location::SCENE_UNSET); 5487 requestConfig->SetTimeInterval(1); 5488 requestConfig->SetDistanceInterval(0); 5489- requestConfig->SetMaxAccuracy(0); 5490- requestConfig->SetFixNumber(1); 5491+ requestConfig->SetMaxAccuracy(50); 5492+ requestConfig->SetFixNumber(0); 5493 } 5494 5495-void LocationProviderOhos::NewGeopositionReport( 5496+void LocationProviderCallback::NewGeopositionReport( 5497 const mojom::Geoposition& position) { 5498 last_position_ = position; 5499 if (!callback_.is_null()) 5500- callback_.Run(this, position); 5501+ callback_.Run(position); 5502 } 5503 5504-int LocationProviderOhos::OnRemoteRequest(uint32_t code, 5505- OHOS::MessageParcel& data, 5506- OHOS::MessageParcel& reply, 5507- OHOS::MessageOption& option) { 5508+int LocationProviderCallback::OnRemoteRequest(uint32_t code, 5509+ OHOS::MessageParcel& data, 5510+ OHOS::MessageParcel& reply, 5511+ OHOS::MessageOption& option) { 5512+ if (data.ReadInterfaceToken() != GetDescriptor()) { 5513+ LOG(INFO) << "invalid token."; 5514+ return -1; 5515+ } 5516 switch (code) { 5517 case RECEIVE_LOCATION_INFO_EVENT: { 5518 std::unique_ptr<OHOS::Location::Location> location = 5519@@ -147,18 +174,14 @@ int LocationProviderOhos::OnRemoteRequest(uint32_t code, 5520 return 0; 5521 } 5522 5523-void LocationProviderOhos::OnLocationReport( 5524+void LocationProviderCallback::OnLocationReport( 5525 const std::unique_ptr<OHOS::Location::Location>& location) { 5526- if (is_running_) { 5527- OnNewLocationAvailable(location); 5528- StopProvider(); 5529- } 5530+ OnNewLocationAvailable(location); 5531 } 5532 5533-void LocationProviderOhos::OnLocatingStatusChange(const int status) {} 5534+void LocationProviderCallback::OnLocatingStatusChange(const int status) {} 5535 5536-void LocationProviderOhos::OnErrorReport(const int errorCode) { 5537- StopProvider(); 5538+void LocationProviderCallback::OnErrorReport(const int errorCode) { 5539 if (errorCode == LOCATION_GET_FAILED) { 5540 OnNewErrorAvailable("Failed to get location!"); 5541 } else { 5542diff --git a/src/services/device/geolocation/ohos/location_provider_ohos.h b/src/services/device/geolocation/ohos/location_provider_ohos.h 5543index c005f7d123..008bba32b8 100644 5544--- a/src/services/device/geolocation/ohos/location_provider_ohos.h 5545+++ b/src/services/device/geolocation/ohos/location_provider_ohos.h 5546@@ -14,21 +14,17 @@ 5547 #include <message_parcel.h> 5548 #include <request_config.h> 5549 5550-#include "base/memory/scoped_refptr.h" 5551 #include "base/single_thread_task_runner.h" 5552 #include "base/threading/thread_checker.h" 5553 #include "services/device/public/cpp/geolocation/location_provider.h" 5554 #include "services/device/public/mojom/geoposition.mojom.h" 5555 5556 namespace device { 5557- 5558-// Location provider for OpenHarmony using the platform provider over JNI. 5559-class LocationProviderOhos 5560- : public LocationProvider, 5561- public OHOS::IRemoteStub<OHOS::Location::ILocatorCallback> { 5562+class LocationProviderCallback 5563+ : public OHOS::IRemoteStub<OHOS::Location::ILocatorCallback> { 5564 public: 5565- LocationProviderOhos(); 5566- ~LocationProviderOhos() override; 5567+ LocationProviderCallback() {} 5568+ ~LocationProviderCallback() = default; 5569 5570 enum LocationErrorCode { 5571 LOCATION_GET_SUCCESS = 0, 5572@@ -36,13 +32,8 @@ class LocationProviderOhos 5573 LOCATION_UNKNOWN_ERROR, 5574 }; 5575 5576- // LocationProvider implementation. 5577- void SetUpdateCallback( 5578- const LocationProviderUpdateCallback& callback) override; 5579- void StartProvider(bool high_accuracy) override; 5580- void StopProvider() override; 5581- const mojom::Geoposition& GetPosition() override; 5582- void OnPermissionGranted() override; 5583+ typedef base::RepeatingCallback<void(const mojom::Geoposition&)> 5584+ UpdateCallback; 5585 5586 // ILocatorCallback implementation. 5587 virtual int OnRemoteRequest(uint32_t code, 5588@@ -57,6 +48,34 @@ class LocationProviderOhos 5589 void OnNewLocationAvailable( 5590 const std::unique_ptr<OHOS::Location::Location>& location); 5591 void OnNewErrorAvailable(std::string message); 5592+ void SetUpdateCallback(const UpdateCallback& callback) { 5593+ callback_ = callback; 5594+ } 5595+ const mojom::Geoposition& GetPosition() { return last_position_; } 5596+ 5597+ private: 5598+ // Calls |callback_| with the new location. 5599+ void NewGeopositionReport(const mojom::Geoposition& position); 5600+ 5601+ mojom::Geoposition last_position_; 5602+ UpdateCallback callback_; 5603+}; 5604+ 5605+// Location provider for OpenHarmony using the platform provider over JNI. 5606+class LocationProviderOhos : public LocationProvider { 5607+ public: 5608+ LocationProviderOhos(); 5609+ ~LocationProviderOhos() override; 5610+ 5611+ // LocationProvider implementation. 5612+ void SetUpdateCallback( 5613+ const LocationProviderUpdateCallback& callback) override; 5614+ void StartProvider(bool high_accuracy) override; 5615+ void StopProvider() override; 5616+ const mojom::Geoposition& GetPosition() override; 5617+ void OnPermissionGranted() override; 5618+ 5619+ void ProviderUpdateCallback(const mojom::Geoposition& position); 5620 5621 private: 5622 void RequestLocationUpdate(bool high_accuracy); 5623@@ -65,17 +84,12 @@ class LocationProviderOhos 5624 std::unique_ptr<OHOS::Location::RequestConfig>& requestConfig, 5625 bool high_accuracy); 5626 5627- // Calls |callback_| with the new location. 5628- void NewGeopositionReport(const mojom::Geoposition& position); 5629- 5630 std::unique_ptr<OHOS::Location::LocatorProxy> locator_; 5631 5632- mojom::Geoposition last_position_; 5633- 5634 LocationProviderUpdateCallback callback_; 5635 5636 bool is_running_ = false; 5637- OHOS::sptr<OHOS::Location::ILocatorCallback> locator_callback_; 5638+ OHOS::sptr<LocationProviderCallback> locator_callback_ = nullptr; 5639 }; 5640 5641 } // namespace device 5642diff --git a/src/third_party/blink/common/web_preferences/web_preferences.cc b/src/third_party/blink/common/web_preferences/web_preferences.cc 5643old mode 100644 5644new mode 100755 5645index b35748d818..9414c4e6c3 5646--- a/src/third_party/blink/common/web_preferences/web_preferences.cc 5647+++ b/src/third_party/blink/common/web_preferences/web_preferences.cc 5648@@ -122,7 +122,7 @@ WebPreferences::WebPreferences() 5649 #endif 5650 supports_multiple_windows(true), 5651 viewport_enabled(false), 5652-#if defined(OS_ANDROID) 5653+#if defined(OS_ANDROID) || defined(OS_OHOS) 5654 viewport_meta_enabled(true), 5655 shrinks_viewport_contents_to_fit(true), 5656 viewport_style(mojom::ViewportStyle::kMobile), 5657@@ -155,13 +155,13 @@ WebPreferences::WebPreferences() 5658 text_tracks_enabled(false), 5659 text_track_margin_percentage(0.0f), 5660 immersive_mode_enabled(false), 5661-#if defined(OS_ANDROID) || defined(OS_MAC) 5662+#if defined(OS_ANDROID) || defined(OS_MAC) || defined(OS_OHOS) 5663 double_tap_to_zoom_enabled(true), 5664 #else 5665 double_tap_to_zoom_enabled(false), 5666 #endif 5667 fullscreen_supported(true), 5668-#if !defined(OS_ANDROID) 5669+#if !defined(OS_ANDROID) && !defined(OS_OHOS) 5670 text_autosizing_enabled(false), 5671 #else 5672 text_autosizing_enabled(true), 5673@@ -169,16 +169,16 @@ WebPreferences::WebPreferences() 5674 device_scale_adjustment(1.0f), 5675 force_enable_zoom(false), 5676 support_deprecated_target_density_dpi(false), 5677- use_legacy_background_size_shorthand_behavior(false), 5678+ use_legacy_background_size_shorthand_behavior(true), 5679 wide_viewport_quirk(false), 5680- use_wide_viewport(true), 5681+ use_wide_viewport(false), 5682 force_zero_layout_height(false), 5683- viewport_meta_merge_content_quirk(false), 5684- viewport_meta_non_user_scalable_quirk(false), 5685- viewport_meta_zero_values_quirk(false), 5686+ viewport_meta_merge_content_quirk(true), 5687+ viewport_meta_non_user_scalable_quirk(true), 5688+ viewport_meta_zero_values_quirk(true), 5689 clobber_user_agent_initial_scale_quirk(false), 5690 ignore_main_frame_overflow_hidden_quirk(false), 5691- report_screen_size_in_physical_pixels_quirk(false), 5692+ report_screen_size_in_physical_pixels_quirk(true), 5693 reuse_global_for_unowned_main_frame(false), 5694 spellcheck_enabled_by_default(true), 5695 video_fullscreen_orientation_lock_enabled(false), 5696@@ -196,7 +196,7 @@ WebPreferences::WebPreferences() 5697 default_minimum_page_scale_factor(1.f), 5698 default_maximum_page_scale_factor(3.f), 5699 #else 5700- default_minimum_page_scale_factor(1.f), 5701+ default_minimum_page_scale_factor(2.f), 5702 default_maximum_page_scale_factor(4.f), 5703 #endif 5704 hide_download_ui(false), 5705diff --git a/src/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/src/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc 5706index 10829ad522..96ed045f29 100644 5707--- a/src/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc 5708+++ b/src/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc 5709@@ -164,7 +164,7 @@ bool StructTraits<blink::mojom::WebPreferencesDataView, 5710 out->double_tap_to_zoom_enabled = data.double_tap_to_zoom_enabled(); 5711 out->fullscreen_supported = data.fullscreen_supported(); 5712 out->text_autosizing_enabled = data.text_autosizing_enabled(); 5713-#if defined(OS_ANDROID) 5714+#if defined(OS_ANDROID) || defined(OS_OHOS) 5715 out->font_scale_factor = data.font_scale_factor(); 5716 out->device_scale_adjustment = data.device_scale_adjustment(); 5717 out->force_enable_zoom = data.force_enable_zoom(); 5718diff --git a/src/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/src/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h 5719index ff772f7af6..5a3bcbbc36 100644 5720--- a/src/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h 5721+++ b/src/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h 5722@@ -546,7 +546,7 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView, 5723 return r.web_app_scope; 5724 } 5725 5726-#if defined(OS_ANDROID) 5727+#if defined(OS_ANDROID) || defined(OS_OHOS) 5728 static float font_scale_factor(const blink::web_pref::WebPreferences& r) { 5729 return r.font_scale_factor; 5730 } 5731diff --git a/src/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/src/third_party/blink/public/mojom/webpreferences/web_preferences.mojom 5732index ba5ebe0cb8..0b4d0c90ba 100644 5733--- a/src/third_party/blink/public/mojom/webpreferences/web_preferences.mojom 5734+++ b/src/third_party/blink/public/mojom/webpreferences/web_preferences.mojom 5735@@ -270,91 +270,91 @@ struct WebPreferences { 5736 // Representation of the Web App Manifest scope if any. 5737 url.mojom.Url web_app_scope; 5738 5739- [EnableIf=is_android] 5740+ // [EnableIf=is_android] 5741 float font_scale_factor; 5742 5743- [EnableIf=is_android] 5744+ // [EnableIf=is_android] 5745 float device_scale_adjustment; 5746 5747- [EnableIf=is_android] 5748+ // [EnableIf=is_android] 5749 bool force_enable_zoom; 5750 5751- [EnableIf=is_android] 5752+ // [EnableIf=is_android] 5753 url.mojom.Url default_video_poster_url; 5754 5755- [EnableIf=is_android] 5756+ // [EnableIf=is_android] 5757 bool support_deprecated_target_density_dpi; 5758 5759- [EnableIf=is_android] 5760+ // [EnableIf=is_android] 5761 bool use_legacy_background_size_shorthand_behavior; 5762 5763- [EnableIf=is_android] 5764+ // [EnableIf=is_android] 5765 bool wide_viewport_quirk; 5766 5767- [EnableIf=is_android] 5768+ // [EnableIf=is_android] 5769 bool use_wide_viewport; 5770 5771- [EnableIf=is_android] 5772+ // [EnableIf=is_android] 5773 bool force_zero_layout_height; 5774 5775- [EnableIf=is_android] 5776+ // [EnableIf=is_android] 5777 bool viewport_meta_merge_content_quirk; 5778 5779- [EnableIf=is_android] 5780+ // [EnableIf=is_android] 5781 bool viewport_meta_non_user_scalable_quirk; 5782 5783- [EnableIf=is_android] 5784+ // [EnableIf=is_android] 5785 bool viewport_meta_zero_values_quirk; 5786 5787- [EnableIf=is_android] 5788+ // [EnableIf=is_android] 5789 bool clobber_user_agent_initial_scale_quirk; 5790 5791- [EnableIf=is_android] 5792+ // [EnableIf=is_android] 5793 bool ignore_main_frame_overflow_hidden_quirk; 5794 5795- [EnableIf=is_android] 5796+ // [EnableIf=is_android] 5797 bool report_screen_size_in_physical_pixels_quirk; 5798 5799 // Used by Android_WebView only to support legacy apps that inject script int32o 5800 // a top-level initial empty document and expect it to persist on navigation. 5801- [EnableIf=is_android] 5802+ // [EnableIf=is_android] 5803 bool reuse_global_for_unowned_main_frame; 5804 5805 // Specifies default setting for spellcheck when the spellcheck attribute is 5806 // not explicitly specified. 5807- [EnableIf=is_android] 5808+ // [EnableIf=is_android] 5809 bool spellcheck_enabled_by_default; 5810 5811 // If enabled, when a video goes fullscreen, the orientation should be locked. 5812- [EnableIf=is_android] 5813+ // [EnableIf=is_android] 5814 bool video_fullscreen_orientation_lock_enabled; 5815 5816 // If enabled, fullscreen should be entered/exited when the device is rotated 5817 // to/from the orientation of the video. 5818- [EnableIf=is_android] 5819+ // [EnableIf=is_android] 5820 bool video_rotate_to_fullscreen_enabled; 5821 5822- [EnableIf=is_android] 5823+ // [EnableIf=is_android] 5824 bool embedded_media_experience_enabled; 5825 5826 // Enable 8 (#RRGGBBAA) and 4 (#RGBA) value hex colors in CSS Android 5827 // WebView quirk (http://crbug.com/618472). 5828- [EnableIf=is_android] 5829+ // [EnableIf=is_android] 5830 bool css_hex_alpha_color_enabled; 5831 5832 // Enable support for document.scrollingElement 5833 // WebView sets this to false to retain old documentElement behaviour 5834 // (http://crbug.com/761016). 5835- [EnableIf=is_android] 5836+ // [EnableIf=is_android] 5837 bool scroll_top_left_interop_enabled; 5838 5839 // Disable features such as offscreen canvas that depend on the viz 5840 // architecture of surface embedding. Android WebView does not support this 5841 // architecture yet. 5842- [EnableIf=is_android] 5843+ // [EnableIf=is_android] 5844 bool disable_features_depending_on_viz; 5845 5846- [EnableIf=is_android] 5847+ // [EnableIf=is_android] 5848 // Don't accelerate small canvases to avoid crashes TODO(crbug.com/1004304) 5849 bool disable_accelerated_small_canvases; 5850 5851diff --git a/src/third_party/blink/renderer/core/exported/web_view_impl.cc b/src/third_party/blink/renderer/core/exported/web_view_impl.cc 5852index 47e3ebb6fa..4552b8ec8c 100644 5853--- a/src/third_party/blink/renderer/core/exported/web_view_impl.cc 5854+++ b/src/third_party/blink/renderer/core/exported/web_view_impl.cc 5855@@ -1577,7 +1577,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, 5856 prefs.dont_send_key_events_to_javascript); 5857 settings->SetWebAppScope(WebString::FromASCII(prefs.web_app_scope.spec())); 5858 5859-#if defined(OS_ANDROID) 5860+#if defined(OS_ANDROID) || defined(OS_OHOS) 5861 settings->SetAllowCustomScrollbarInMainFrame(false); 5862 settings->SetAccessibilityFontScaleFactor(prefs.font_scale_factor); 5863 settings->SetDeviceScaleAdjustment(prefs.device_scale_adjustment); 5864diff --git a/src/third_party/blink/renderer/core/frame/local_frame_view.cc b/src/third_party/blink/renderer/core/frame/local_frame_view.cc 5865old mode 100644 5866new mode 100755 5867index 58fc719381..242a4ee59d 5868--- a/src/third_party/blink/renderer/core/frame/local_frame_view.cc 5869+++ b/src/third_party/blink/renderer/core/frame/local_frame_view.cc 5870@@ -216,7 +216,7 @@ constexpr int kCommitDelayDefaultInMs = 500; // 30 frames @ 60hz 5871 // The maximum number of updatePlugins iterations that should be done before 5872 // returning. 5873 static const unsigned kMaxUpdatePluginsIterations = 2; 5874- 5875+static const float kInitialLayoutSizeRatio = 2.0; 5876 LocalFrameView::LocalFrameView(LocalFrame& frame) 5877 : LocalFrameView(frame, IntRect()) { 5878 Show(); 5879@@ -1515,8 +1515,8 @@ void LocalFrameView::SetLayoutSize(const IntSize& size) { 5880 if (frame_->GetDocument() && 5881 frame_->GetDocument()->Lifecycle().LifecyclePostponed()) 5882 return; 5883- 5884- SetLayoutSizeInternal(size); 5885+ IntSize size_tmp(size.Width() / kInitialLayoutSizeRatio, size.Height() / kInitialLayoutSizeRatio); 5886+ SetLayoutSizeInternal(size_tmp); 5887 } 5888 5889 void LocalFrameView::SetLayoutSizeFixedToFrameSize(bool is_fixed) { 5890diff --git a/src/third_party/blink/renderer/modules/webdatabase/database_tracker.cc b/src/third_party/blink/renderer/modules/webdatabase/database_tracker.cc 5891index 8f2f867209..58970ecb82 100644 5892--- a/src/third_party/blink/renderer/modules/webdatabase/database_tracker.cc 5893+++ b/src/third_party/blink/renderer/modules/webdatabase/database_tracker.cc 5894@@ -78,9 +78,18 @@ bool DatabaseTracker::CanEstablishDatabase(DatabaseContext* database_context, 5895 String DatabaseTracker::FullPathForDatabase(const SecurityOrigin* origin, 5896 const String& name, 5897 bool) { 5898+#ifdef OS_OHOS 5899+ String fileName = "/data/storage/el2/base/" + 5900+ String(Platform::Current()->DatabaseCreateOriginIdentifier(WebSecurityOrigin(origin))); 5901+ if (mkdir(fileName.Utf8().c_str(), 0777) != 0) { 5902+ LOG(ERROR) << " database open directory failed;"; 5903+ } 5904+ return fileName + "/" + name + ".db"; 5905+#else 5906 return String(Platform::Current()->DatabaseCreateOriginIdentifier( 5907 WebSecurityOrigin(origin))) + 5908 "/" + name + "#"; 5909+#endif 5910 } 5911 5912 void DatabaseTracker::AddOpenDatabase(Database* database) { 5913diff --git a/src/third_party/blink/renderer/modules/webdatabase/sqlite/sqlite_database.cc b/src/third_party/blink/renderer/modules/webdatabase/sqlite/sqlite_database.cc 5914index b35b166477..19104b3812 100644 5915--- a/src/third_party/blink/renderer/modules/webdatabase/sqlite/sqlite_database.cc 5916+++ b/src/third_party/blink/renderer/modules/webdatabase/sqlite/sqlite_database.cc 5917@@ -46,10 +46,14 @@ std::tuple<int, sqlite3*> OpenDatabase(const String& filename) { 5918 /*make_default=*/false); 5919 5920 sqlite3* connection; 5921+#ifdef OS_OHOS 5922+ int status = sqlite3_open(filename.Utf8().c_str(), &connection); 5923+#else 5924 constexpr int open_flags = 5925 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_PRIVATECACHE; 5926 int status = sqlite3_open_v2(filename.Utf8().c_str(), &connection, open_flags, 5927 kSqliteVfsName); 5928+#endif 5929 if (status != SQLITE_OK) { 5930 // SQLite creates a connection handle in most cases where open fails. 5931 if (connection) { 5932diff --git a/src/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/src/third_party/blink/renderer/platform/runtime_enabled_features.json5 5933index 955dd1ee1e..71b5be9b34 100644 5934--- a/src/third_party/blink/renderer/platform/runtime_enabled_features.json5 5935+++ b/src/third_party/blink/renderer/platform/runtime_enabled_features.json5 5936@@ -1228,7 +1228,7 @@ 5937 }, 5938 { 5939 name: "MediaCapture", 5940- status: {"Android": "stable"}, 5941+ status: "stable", 5942 }, 5943 { 5944 name: "MediaCaptureDepthVideoKind", 5945diff --git a/src/third_party/node/linux/node-linux-x64/bin/node b/src/third_party/node/linux/node-linux-x64/bin/node 5946index 8f9de130a6..229fef0ec7 100755 5947Binary files a/src/third_party/node/linux/node-linux-x64/bin/node and b/src/third_party/node/linux/node-linux-x64/bin/node differ 5948diff --git a/src/v8/src/objects/objects.cc b/src/v8/src/objects/objects.cc 5949old mode 100644 5950new mode 100755 5951index e2810f1337..fa3f9fc82d 5952--- a/src/v8/src/objects/objects.cc 5953+++ b/src/v8/src/objects/objects.cc 5954@@ -2529,6 +2529,12 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it, 5955 Maybe<bool> result = 5956 JSObject::SetPropertyWithInterceptor(it, should_throw, value); 5957 if (result.IsNothing() || result.FromJust()) return result; 5958+ // Assuming that the callback have side effects, we use 5959+ // Object::SetSuperProperty() which works properly regardless on 5960+ // whether the property was present on the receiver or not when 5961+ // storing to the receiver. 5962+ // Proceed lookup from the next state. 5963+ it->Next(); 5964 } else { 5965 Maybe<PropertyAttributes> maybe_attributes = 5966 JSObject::GetPropertyAttributesWithInterceptor(it); 5967@@ -2536,11 +2542,21 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it, 5968 if ((maybe_attributes.FromJust() & READ_ONLY) != 0) { 5969 return WriteToReadOnlyProperty(it, value, should_throw); 5970 } 5971- if (maybe_attributes.FromJust() == ABSENT) break; 5972- *found = false; 5973- return Nothing<bool>(); 5974+ // At this point we might have called interceptor's query or getter 5975+ // callback. Assuming that the callbacks have side effects, we use 5976+ // Object::SetSuperProperty() which works properly regardless on 5977+ // whether the property was present on the receiver or not when 5978+ // storing to the receiver. 5979+ if (maybe_attributes.FromJust() == ABSENT) { 5980+ // Proceed lookup from the next state. 5981+ it->Next(); 5982+ } else { 5983+ // Finish lookup in order to make Object::SetSuperProperty() store 5984+ // property to the receiver. 5985+ it->NotFound(); 5986+ } 5987 } 5988- break; 5989+ return Object::SetSuperProperty(it, value, store_origin, should_throw); 5990 } 5991 5992 case LookupIterator::ACCESSOR: { 5993@@ -2603,6 +2619,26 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it, 5994 return Nothing<bool>(); 5995 } 5996 5997+bool Object::CheckContextualStoreToJSGlobalObject( 5998+ LookupIterator* it, Maybe<ShouldThrow> should_throw) { 5999+ Isolate* isolate = it->isolate(); 6000+ 6001+ if (it->GetReceiver()->IsJSGlobalObject(isolate) && 6002+ (GetShouldThrow(isolate, should_throw) == ShouldThrow::kThrowOnError)) { 6003+ if (it->state() == LookupIterator::TRANSITION) { 6004+ // The property cell that we have created is garbage because we are going 6005+ // to throw now instead of putting it into the global dictionary. However, 6006+ // the cell might already have been stored into the feedback vector, so 6007+ // we must invalidate it nevertheless. 6008+ it->transition_cell()->ClearAndInvalidate(ReadOnlyRoots(isolate)); 6009+ } 6010+ isolate->Throw(*isolate->factory()->NewReferenceError( 6011+ MessageTemplate::kNotDefined, it->GetName())); 6012+ return false; 6013+ } 6014+ return true; 6015+} 6016+ 6017 Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value, 6018 StoreOrigin store_origin, 6019 Maybe<ShouldThrow> should_throw) { 6020@@ -2613,24 +2649,9 @@ Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value, 6021 if (found) return result; 6022 } 6023 6024- // If the receiver is the JSGlobalObject, the store was contextual. In case 6025- // the property did not exist yet on the global object itself, we have to 6026- // throw a reference error in strict mode. In sloppy mode, we continue. 6027- if (it->GetReceiver()->IsJSGlobalObject() && 6028- (GetShouldThrow(it->isolate(), should_throw) == 6029- ShouldThrow::kThrowOnError)) { 6030- if (it->state() == LookupIterator::TRANSITION) { 6031- // The property cell that we have created is garbage because we are going 6032- // to throw now instead of putting it into the global dictionary. However, 6033- // the cell might already have been stored into the feedback vector, so 6034- // we must invalidate it nevertheless. 6035- it->transition_cell()->ClearAndInvalidate(ReadOnlyRoots(it->isolate())); 6036- } 6037- it->isolate()->Throw(*it->isolate()->factory()->NewReferenceError( 6038- MessageTemplate::kNotDefined, it->GetName())); 6039+ if (!CheckContextualStoreToJSGlobalObject(it, should_throw)) { 6040 return Nothing<bool>(); 6041 } 6042- 6043 return AddDataProperty(it, value, NONE, should_throw, store_origin); 6044 } 6045 6046@@ -2697,6 +2718,9 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value, 6047 JSReceiver::GetOwnPropertyDescriptor(&own_lookup, &desc); 6048 MAYBE_RETURN(owned, Nothing<bool>()); 6049 if (!owned.FromJust()) { 6050+ if (!CheckContextualStoreToJSGlobalObject(&own_lookup, should_throw)) { 6051+ return Nothing<bool>(); 6052+ } 6053 return JSReceiver::CreateDataProperty(&own_lookup, value, 6054 should_throw); 6055 } 6056diff --git a/src/v8/src/objects/objects.h b/src/v8/src/objects/objects.h 6057old mode 100644 6058new mode 100755 6059index c68445597f..93624b7b39 6060--- a/src/v8/src/objects/objects.h 6061+++ b/src/v8/src/objects/objects.h 6062@@ -726,6 +726,8 @@ class Object : public TaggedImpl<HeapObjectReferenceType::STRONG, Address> { 6063 V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static MaybeHandle<Object> 6064 ConvertToIndex(Isolate* isolate, Handle<Object> input, 6065 MessageTemplate error_index); 6066+ V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static bool CheckContextualStoreToJSGlobalObject( 6067+ LookupIterator* it, Maybe<ShouldThrow> should_throw = Nothing<ShouldThrow>()); 6068 }; 6069 6070 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const Object& obj); 6071diff --git a/src/v8/test/cctest/test-api-interceptors.cc b/src/v8/test/cctest/test-api-interceptors.cc 6072old mode 100644 6073new mode 100755 6074index af5858eaef..36ae3a4838 6075--- a/src/v8/test/cctest/test-api-interceptors.cc 6076+++ b/src/v8/test/cctest/test-api-interceptors.cc 6077@@ -5490,10 +5490,10 @@ void DatabaseGetter(Local<Name> name, 6078 const v8::PropertyCallbackInfo<Value>& info) { 6079 ApiTestFuzzer::Fuzz(); 6080 auto context = info.GetIsolate()->GetCurrentContext(); 6081- Local<v8::Object> db = info.Holder() 6082- ->GetRealNamedProperty(context, v8_str("db")) 6083- .ToLocalChecked() 6084- .As<v8::Object>(); 6085+ v8::MaybeLocal<Value> maybe_db = 6086+ info.Holder()->GetRealNamedProperty(context, v8_str("db")); 6087+ if (maybe_db.IsEmpty()) return; 6088+ Local<v8::Object> db = maybe_db.ToLocalChecked().As<v8::Object>(); 6089 if (!db->Has(context, name).FromJust()) return; 6090 info.GetReturnValue().Set(db->Get(context, name).ToLocalChecked()); 6091 } 6092diff --git a/src/v8/test/unittests/api/interceptor-unittest.cc b/src/v8/test/unittests/api/interceptor-unittest.cc 6093old mode 100644 6094new mode 100755 6095index 8a1db3f823..bc00462a29 6096--- a/src/v8/test/unittests/api/interceptor-unittest.cc 6097+++ b/src/v8/test/unittests/api/interceptor-unittest.cc 6098@@ -170,8 +170,8 @@ TEST_F(InterceptorLoggingTest, DispatchTest) { 6099 EXPECT_EQ(Run("obj.foo"), "named getter"); 6100 EXPECT_EQ(Run("obj[42]"), "indexed getter"); 6101 6102- EXPECT_EQ(Run("obj.foo = null"), "named setter"); 6103- EXPECT_EQ(Run("obj[42] = null"), "indexed setter"); 6104+ EXPECT_EQ(Run("obj.foo = null"), "named setter, named descriptor"); 6105+ EXPECT_EQ(Run("obj[42] = null"), "indexed setter, indexed descriptor"); 6106 6107 EXPECT_EQ(Run("Object.getOwnPropertyDescriptor(obj, 'foo')"), 6108 "named descriptor"); 6109