NetworkService: Implement URLLoader::OnCertificateRequested

https://chromium-review.googlesource.com/c/chromium/src/+/848303
This commit is contained in:
deepak1556 2018-04-12 14:18:50 +05:30 committed by Samuel Attard
parent b268e37663
commit 27cb84eee0
4 changed files with 27 additions and 27 deletions

View file

@ -52,6 +52,16 @@
#include "ui/base/l10n/l10n_util.h"
#include "v8/include/v8.h"
#if defined(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h"
#elif defined(OS_WIN)
#include "net/ssl/client_cert_store_win.h"
#elif defined(OS_MACOSX)
#include "net/ssl/client_cert_store_mac.h"
#elif defined(USE_OPENSSL)
#include "net/ssl/client_cert_store.h"
#endif
using content::BrowserThread;
namespace atom {
@ -167,7 +177,7 @@ bool AtomBrowserClient::RendererDisablesPopups(int process_id) {
void AtomBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host,
service_manager::mojom::ServiceRequest* service_request)) {
service_manager::mojom::ServiceRequest* service_request) {
// When a render process is crashed, it might be reused.
int process_id = host->GetID();
if (IsProcessObserved(process_id))
@ -473,6 +483,20 @@ void AtomBrowserClient::SiteInstanceDeleting(
}
}
std::unique_ptr<net::ClientCertStore> AtomBrowserClient::CreateClientCertStore(
content::ResourceContext* resource_context) {
#if defined(USE_NSS_CERTS)
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)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac());
#elif defined(USE_OPENSSL)
return std::unique_ptr<net::ClientCertStore>();
#endif
}
brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
const content::MainFunctionParams&) {
v8::V8::Initialize(); // Init V8 before creating main parts.

View file

@ -104,6 +104,8 @@ class AtomBrowserClient : public brightray::BrowserClient,
void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* schemes) override;
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::ResourceContext* resource_context) override;
// brightray::BrowserClient:
brightray::BrowserMainParts* OverrideCreateBrowserMainParts(

View file

@ -14,17 +14,8 @@
#include "content/public/browser/download_manager.h"
#include "content/public/browser/render_frame_host.h"
#include "net/base/escape.h"
#include "net/ssl/client_cert_store.h"
#include "url/gurl.h"
#if defined(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h"
#elif defined(OS_WIN)
#include "net/ssl/client_cert_store_win.h"
#elif defined(OS_MACOSX)
#include "net/ssl/client_cert_store_mac.h"
#endif
#if defined(ENABLE_PDF_VIEWER)
#include "atom/common/atom_constants.h"
#include "base/strings/stringprintf.h"
@ -130,21 +121,6 @@ AtomResourceDispatcherHostDelegate::CreateLoginDelegate(
return new LoginHandler(auth_info, request);
}
std::unique_ptr<net::ClientCertStore>
AtomResourceDispatcherHostDelegate::CreateClientCertStore(
content::ResourceContext* resource_context) {
#if defined(USE_NSS_CERTS)
return std::make_unique<net::ClientCertStoreNSS>(
net::ClientCertStoreNSS::PasswordDelegateFactory());
#elif defined(OS_WIN)
return std::make_unique<net::ClientCertStoreWin>();
#elif defined(OS_MACOSX)
return std::make_unique<net::ClientCertStoreMac>();
#elif defined(USE_OPENSSL)
return std::unique_ptr<net::ClientCertStore>();
#endif
}
bool AtomResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream(
net::URLRequest* request,
const std::string& mime_type,

View file

@ -22,8 +22,6 @@ class AtomResourceDispatcherHostDelegate
content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
net::AuthChallengeInfo* auth_info,
net::URLRequest* request) override;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::ResourceContext* resource_context) override;
bool ShouldInterceptResourceAsStream(net::URLRequest* request,
const std::string& mime_type,
GURL* origin,