summaryrefslogtreecommitdiffstats
path: root/src/core/content_browser_client_qt.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-05-10 14:39:15 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-05-12 12:46:13 +0200
commit4629185e555e6c891d6308ae7cafa584ce6d731f (patch)
tree1ed9f01ec7fdb6f52a607cab0a31b60bb60179d2 /src/core/content_browser_client_qt.cpp
parentf8527fa9427984082cd425d304d29fd030ff5b1a (diff)
parent5d41d39b82acb3e2da597df0588fb906e212d608 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: examples/webenginewidgets/printme/printhandler.cpp src/3rdparty src/core/api/qwebenginepage_p.h src/core/content_browser_client_qt.h src/core/web_contents_adapter_client.h src/core/web_contents_delegate_qt.cpp src/core/web_contents_delegate_qt.h src/webenginequick/api/qquickwebengineview_p_p.h tests/auto/quick/qmltests/data/tst_download.qml tests/auto/quick/qmltests/data/tst_viewSoure.qml tests/auto/widgets/loadsignals/tst_loadsignals.cpp tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp Change-Id: I9c1819ec15e13d4f8e244defe860e26274b5d4be
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r--src/core/content_browser_client_qt.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 1b8ba26e8..d68cad2b0 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -39,6 +39,7 @@
#include "content_browser_client_qt.h"
+#include "base/files/file_util.h"
#include "base/optional.h"
#include "base/task/post_task.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
@@ -348,12 +349,7 @@ std::unique_ptr<net::ClientCertStore> ContentBrowserClientQt::CreateClientCertSt
std::string ContentBrowserClientQt::GetApplicationLocale()
{
- std::string bcp47Name = QLocale().bcp47Name().toStdString();
- if (m_cachedQtLocale != bcp47Name) {
- m_cachedQtLocale = bcp47Name;
- m_appLocale = WebEngineLibraryInfo::getApplicationLocale();
- }
- return m_appLocale;
+ return WebEngineLibraryInfo::getApplicationLocale();
}
std::string ContentBrowserClientQt::GetAcceptLangs(content::BrowserContext *context)
@@ -369,7 +365,7 @@ void ContentBrowserClientQt::AppendExtraCommandLineSwitches(base::CommandLine* c
std::string processType = command_line->GetSwitchValueASCII(switches::kProcessType);
if (processType == switches::kZygoteProcess)
- command_line->AppendSwitchASCII(switches::kLang, GetApplicationLocale());
+ command_line->AppendSwitchASCII(switches::kLang, WebEngineLibraryInfo::getApplicationLocale());
}
void ContentBrowserClientQt::GetAdditionalWebUISchemes(std::vector<std::string>* additional_schemes)
@@ -397,9 +393,8 @@ void ContentBrowserClientQt::GetAdditionalAllowedSchemesForFileSystem(std::vecto
#if defined(Q_OS_LINUX)
void ContentBrowserClientQt::GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings)
{
- const std::string &locale = GetApplicationLocale();
- const base::FilePath &locale_file_path = ui::ResourceBundle::GetSharedInstance().GetLocaleFilePath(locale);
- if (locale_file_path.empty())
+ const base::FilePath &locale_file_path = ui::ResourceBundle::GetSharedInstance().GetLocaleFilePath(WebEngineLibraryInfo::getResolvedLocale());
+ if (locale_file_path.empty() || !base::PathExists(locale_file_path))
return;
// Open pak file of the current locale in the Browser process and pass its file descriptor to the sandboxed
@@ -852,7 +847,13 @@ static bool navigationThrottleCallback(content::WebContents *source,
WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(source)->GetView())->client();
if (!client)
return false;
- client->navigationRequested(pageTransitionToNavigationType(params.transition_type()),
+
+ // Redirects might not be reflected in transition_type at this point (see also chrome/.../web_navigation_api_helpers.cc)
+ auto transition_type = params.transition_type();
+ if (params.is_redirect())
+ transition_type = ui::PageTransitionFromInt(transition_type | ui::PAGE_TRANSITION_SERVER_REDIRECT);
+
+ client->navigationRequested(pageTransitionToNavigationType(transition_type),
toQt(params.url()),
navigationRequestAction,
params.is_main_frame());