[M108 Migration] Update system language in network context. 38/288238/2
authorayush.k123 <ayush.k123@samsung.com>
Tue, 14 Feb 2023 05:02:44 +0000 (10:32 +0530)
committerBot Blink <blinkbot@samsung.com>
Tue, 14 Feb 2023 13:56:53 +0000 (13:56 +0000)
This patch updates network context whenever there is a system
language update.

Reference: https://review.tizen.org/gerrit/281228/

Change-Id: Ic9164b2883c6c68e8ca43235a72effba6c2bbbd6
Signed-off-by: Ayush Kumar <ayush.k123@samsung.com>
tizen_src/ewk/efl_integration/eweb_view.cc

index afc8270..10b9ff8 100644 (file)
@@ -63,7 +63,9 @@
 #include "private/ewk_settings_private.h"
 #include "private/webview_delegate_ewk.h"
 #include "public/ewk_hit_test_internal.h"
+#include "services/network/public/cpp/features.h"
 #include "services/network/public/cpp/resource_request_body.h"
+#include "services/network/public/mojom/network_context.mojom.h"
 #include "skia/ext/platform_canvas.h"
 #include "third_party/blink/public/common/page/page_zoom.h"
 #include "third_party/blink/public/platform/web_string.h"
@@ -2404,6 +2406,16 @@ void EWebView::InvokeWebProcessCrashedCallback() {
 void EWebView::SyncAcceptLanguages(const std::string& accept_languages) {
   web_contents_->GetMutableRendererPrefs()->accept_languages = accept_languages;
   web_contents_->SyncRendererPrefs();
+  BrowserContext* browser_context = web_contents_->GetBrowserContext();
+  if (!browser_context)
+    return;
+
+  auto* storage_partition = browser_context->GetDefaultStoragePartition();
+  if (!storage_partition)
+    return;
+
+  if (auto* network_context = storage_partition->GetNetworkContext())
+    network_context->SetAcceptLanguage(accept_languages);
 }
 
 void EWebView::HandleRendererProcessCrash() {