diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-11-06 09:16:15 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-01-13 16:12:06 +0100 |
commit | c9d902ca6ca3b1aa2e2762329d18c226d26520af (patch) | |
tree | 199fdd7b3f0d0ad21597fafa086729dc2e75d4e1 /src/core/net | |
parent | 7869ec5823da36a3ce33b379d3d664204756cad5 (diff) |
Adaptations for Chromium 87
Change-Id: Ic4ffd98e02f986dbaf986405360e727c813e696e
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src/core/net')
-rw-r--r-- | src/core/net/client_cert_override.cpp | 6 | ||||
-rw-r--r-- | src/core/net/custom_url_loader_factory.cpp | 22 | ||||
-rw-r--r-- | src/core/net/custom_url_loader_factory.h | 4 |
3 files changed, 24 insertions, 8 deletions
diff --git a/src/core/net/client_cert_override.cpp b/src/core/net/client_cert_override.cpp index f33515f63..d768092e8 100644 --- a/src/core/net/client_cert_override.cpp +++ b/src/core/net/client_cert_override.cpp @@ -65,7 +65,7 @@ #include "net/ssl/client_cert_store_win.h" #endif -#if defined(OS_MACOSX) +#if defined(OS_MAC) #include "net/ssl/client_cert_store_mac.h" #endif @@ -83,7 +83,7 @@ public: std::move(private_key_callback).Run(m_key); } -#if defined(OS_MACOSX) +#if defined(OS_MAC) SecIdentityRef sec_identity_ref() const override { return nullptr; @@ -167,7 +167,7 @@ std::unique_ptr<net::ClientCertStore> ClientCertOverrideStore::createNativeStore return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(net::ClientCertStoreNSS::PasswordDelegateFactory())); #elif defined(OS_WIN) return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); -#elif defined(OS_MACOSX) +#elif defined(OS_MAC) return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); #else return nullptr; diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp index 43facd30c..10b4a9e0f 100644 --- a/src/core/net/custom_url_loader_factory.cpp +++ b/src/core/net/custom_url_loader_factory.cpp @@ -458,10 +458,13 @@ private: class CustomURLLoaderFactory : public network::mojom::URLLoaderFactory { public: - CustomURLLoaderFactory(ProfileAdapter *profileAdapter) + CustomURLLoaderFactory(ProfileAdapter *profileAdapter, mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver) : m_taskRunner(base::CreateSequencedTaskRunner({ content::BrowserThread::IO })) , m_profileAdapter(profileAdapter) { + m_receivers.set_disconnect_handler(base::BindRepeating( + &CustomURLLoaderFactory::OnDisconnect, base::Unretained(this))); + m_receivers.Add(this, std::move(receiver)); } ~CustomURLLoaderFactory() override = default; @@ -492,6 +495,19 @@ public: m_receivers.Add(this, std::move(receiver)); } + void OnDisconnect() + { + if (m_receivers.empty()) + delete this; + } + + static mojo::PendingRemote<network::mojom::URLLoaderFactory> Create(ProfileAdapter *profileAdapter) + { + mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_remote; + new CustomURLLoaderFactory(profileAdapter, pending_remote.InitWithNewPipeAndPassReceiver()); + return pending_remote; + } + const scoped_refptr<base::SequencedTaskRunner> m_taskRunner; mojo::ReceiverSet<network::mojom::URLLoaderFactory> m_receivers; QPointer<ProfileAdapter> m_profileAdapter; @@ -500,9 +516,9 @@ public: } // namespace -std::unique_ptr<network::mojom::URLLoaderFactory> CreateCustomURLLoaderFactory(ProfileAdapter *profileAdapter) +mojo::PendingRemote<network::mojom::URLLoaderFactory> CreateCustomURLLoaderFactory(ProfileAdapter *profileAdapter) { - return std::make_unique<CustomURLLoaderFactory>(profileAdapter); + return CustomURLLoaderFactory::Create(profileAdapter); } } // namespace QtWebEngineCore diff --git a/src/core/net/custom_url_loader_factory.h b/src/core/net/custom_url_loader_factory.h index 58adf4b79..a9eecbd1c 100644 --- a/src/core/net/custom_url_loader_factory.h +++ b/src/core/net/custom_url_loader_factory.h @@ -51,7 +51,7 @@ #ifndef CUSTOM_URL_LOADER_FACTORY_H_ #define CUSTOM_URL_LOADER_FACTORY_H_ -#include <memory> +#include "mojo/public/cpp/bindings/pending_remote.h" namespace network { namespace mojom { @@ -62,7 +62,7 @@ class URLLoaderFactory; namespace QtWebEngineCore { class ProfileAdapter; -std::unique_ptr<network::mojom::URLLoaderFactory> CreateCustomURLLoaderFactory(ProfileAdapter *profileAdapter); +mojo::PendingRemote<network::mojom::URLLoaderFactory> CreateCustomURLLoaderFactory(ProfileAdapter *profileAdapter); } // namespace QtWebEngineCore |