diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index d089dbaceb8e..764d8d5dba71 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -199,10 +199,11 @@ ['OS=="win"', { 'conditions': [ ['libchromiumcontent_component', { - # sandbox, base_static, devtools_discovery, devtools_http_handler, - # http_server are always linked statically. 'link_settings': { 'libraries': [ + # Needed by desktop_capture.lib: + '-ld3d11.lib', + # Following libs are always linked statically. '<(libchromiumcontent_dir)/base_static.lib', '<(libchromiumcontent_dir)/sandbox.lib', '<(libchromiumcontent_dir)/sandbox_helper_win.lib', diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index a1136577cd38..7694d6143a4e 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -25,15 +25,6 @@ #include "content/public/browser/resource_context.h" #include "content/public/browser/storage_partition.h" #include "net/base/escape.h" -#include "net/ssl/client_cert_store.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 using content::BrowserThread; @@ -65,19 +56,6 @@ class BrowserContext::ResourceContext : public content::ResourceContext { return getter_->GetURLRequestContext(); } - std::unique_ptr CreateClientCertStore() override { - #if defined(USE_NSS_CERTS) - return std::unique_ptr(new net::ClientCertStoreNSS( - net::ClientCertStoreNSS::PasswordDelegateFactory())); - #elif defined(OS_WIN) - return std::unique_ptr(new net::ClientCertStoreWin()); - #elif defined(OS_MACOSX) - return std::unique_ptr(new net::ClientCertStoreMac()); - #elif defined(USE_OPENSSL) - return std::unique_ptr(); - #endif - } - URLRequestContextGetter* getter_; }; diff --git a/brightray/browser/devtools_embedder_message_dispatcher.cc b/brightray/browser/devtools_embedder_message_dispatcher.cc index 9df6a08b6de0..ffba3268aecf 100644 --- a/brightray/browser/devtools_embedder_message_dispatcher.cc +++ b/brightray/browser/devtools_embedder_message_dispatcher.cc @@ -13,21 +13,21 @@ namespace { using DispatchCallback = DevToolsEmbedderMessageDispatcher::DispatchCallback; -bool GetValue(const base::Value* value, std::string* result) { - return value->GetAsString(result); +bool GetValue(const base::Value& value, std::string* result) { + return value.GetAsString(result); } -bool GetValue(const base::Value* value, int* result) { - return value->GetAsInteger(result); +bool GetValue(const base::Value& value, int* result) { + return value.GetAsInteger(result); } -bool GetValue(const base::Value* value, bool* result) { - return value->GetAsBoolean(result); +bool GetValue(const base::Value& value, bool* result) { + return value.GetAsBoolean(result); } -bool GetValue(const base::Value* value, gfx::Rect* rect) { +bool GetValue(const base::Value& value, gfx::Rect* rect) { const base::DictionaryValue* dict; - if (!value->GetAsDictionary(&dict)) + if (!value.GetAsDictionary(&dict)) return false; int x = 0; int y = 0; @@ -69,7 +69,8 @@ template struct ParamTuple { bool Parse(const base::ListValue& list, const base::ListValue::const_iterator& it) { - return it != list.end() && GetValue(*it, &head) && tail.Parse(list, it + 1); + return it != list.end() && GetValue(**it, &head) && + tail.Parse(list, it + 1); } template diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 6ace243cac3f..4295074888b7 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -317,7 +317,7 @@ void InspectableWebContentsImpl::AttachTo(const scoped_refptrDetachClient(); + agent_host_->DetachClient(this); agent_host_ = nullptr; } @@ -530,7 +530,7 @@ void InspectableWebContentsImpl::DispatchProtocolMessageFromDevToolsFrontend( } if (agent_host_.get()) - agent_host_->DispatchProtocolMessage(message); + agent_host_->DispatchProtocolMessage(this, message); } void InspectableWebContentsImpl::RecordActionUMA(const std::string& name, int action) { @@ -687,11 +687,11 @@ content::ColorChooser* InspectableWebContentsImpl::OpenColorChooser( } void InspectableWebContentsImpl::RunFileChooser( - content::WebContents* source, + content::RenderFrameHost* render_frame_host, const content::FileChooserParams& params) { auto delegate = web_contents_->GetDelegate(); if (delegate) - delegate->RunFileChooser(source, params); + delegate->RunFileChooser(render_frame_host, params); } void InspectableWebContentsImpl::EnumerateDirectory( diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index 249829aed834..d25f1be5f99f 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -157,7 +157,7 @@ class InspectableWebContentsImpl : content::WebContents* source, SkColor color, const std::vector& suggestions) override; - void RunFileChooser(content::WebContents* source, + void RunFileChooser(content::RenderFrameHost* render_frame_host, const content::FileChooserParams& params) override; void EnumerateDirectory(content::WebContents* source, int request_id, diff --git a/brightray/browser/net/devtools_network_transaction.cc b/brightray/browser/net/devtools_network_transaction.cc index e4c057b289df..0a62346392a1 100644 --- a/brightray/browser/net/devtools_network_transaction.cc +++ b/brightray/browser/net/devtools_network_transaction.cc @@ -284,9 +284,9 @@ void DevToolsNetworkTransaction::SetBeforeNetworkStartCallback( transaction_->SetBeforeNetworkStartCallback(callback); } -void DevToolsNetworkTransaction::SetBeforeProxyHeadersSentCallback( - const BeforeProxyHeadersSentCallback& callback) { - transaction_->SetBeforeProxyHeadersSentCallback(callback); +void DevToolsNetworkTransaction::SetBeforeHeadersSentCallback( + const BeforeHeadersSentCallback& callback) { + transaction_->SetBeforeHeadersSentCallback(callback); } int DevToolsNetworkTransaction::ResumeNetworkStart() { diff --git a/brightray/browser/net/devtools_network_transaction.h b/brightray/browser/net/devtools_network_transaction.h index 3de3a1587676..3648ca71c740 100644 --- a/brightray/browser/net/devtools_network_transaction.h +++ b/brightray/browser/net/devtools_network_transaction.h @@ -62,8 +62,8 @@ class DevToolsNetworkTransaction : public net::HttpTransaction { net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; void SetBeforeNetworkStartCallback( const BeforeNetworkStartCallback& callback) override; - void SetBeforeProxyHeadersSentCallback( - const BeforeProxyHeadersSentCallback& callback) override; + void SetBeforeHeadersSentCallback( + const BeforeHeadersSentCallback& callback) override; int ResumeNetworkStart() override; void GetConnectionAttempts(net::ConnectionAttempts* out) const override; diff --git a/brightray/browser/network_delegate.cc b/brightray/browser/network_delegate.cc index 5e63a0c57c05..e0ef20bb57bb 100644 --- a/brightray/browser/network_delegate.cc +++ b/brightray/browser/network_delegate.cc @@ -50,23 +50,25 @@ int NetworkDelegate::OnBeforeURLRequest( return net::OK; } -int NetworkDelegate::OnBeforeSendHeaders( +int NetworkDelegate::OnBeforeStartTransaction( net::URLRequest* request, const net::CompletionCallback& callback, net::HttpRequestHeaders* headers) { return net::OK; } -void NetworkDelegate::OnBeforeSendProxyHeaders(net::URLRequest* request, - const net::ProxyInfo& proxy_info, - net::HttpRequestHeaders* headers) { -} - -void NetworkDelegate::OnSendHeaders( +void NetworkDelegate::OnStartTransaction( net::URLRequest* request, const net::HttpRequestHeaders& headers) { } +void NetworkDelegate::OnBeforeSendHeaders( + net::URLRequest* request, + const net::ProxyInfo& proxy_info, + const net::ProxyRetryInfoMap& proxy_retry_info, + net::HttpRequestHeaders* headers) { +} + int NetworkDelegate::OnHeadersReceived( net::URLRequest* request, const net::CompletionCallback& callback, diff --git a/brightray/browser/network_delegate.h b/brightray/browser/network_delegate.h index bc2601886ac9..752434222aca 100644 --- a/brightray/browser/network_delegate.h +++ b/brightray/browser/network_delegate.h @@ -22,14 +22,15 @@ class NetworkDelegate : public net::NetworkDelegate { int OnBeforeURLRequest(net::URLRequest* request, const net::CompletionCallback& callback, GURL* new_url) override; - int OnBeforeSendHeaders(net::URLRequest* request, - const net::CompletionCallback& callback, - net::HttpRequestHeaders* headers) override; - void OnBeforeSendProxyHeaders(net::URLRequest* request, - const net::ProxyInfo& proxy_info, - net::HttpRequestHeaders* headers) override; - void OnSendHeaders(net::URLRequest* request, - const net::HttpRequestHeaders& headers) override; + int OnBeforeStartTransaction(net::URLRequest* request, + const net::CompletionCallback& callback, + net::HttpRequestHeaders* headers) override; + void OnBeforeSendHeaders(net::URLRequest* request, + const net::ProxyInfo& proxy_info, + const net::ProxyRetryInfoMap& proxy_retry_info, + net::HttpRequestHeaders* headers) override; + void OnStartTransaction(net::URLRequest* request, + const net::HttpRequestHeaders& headers) override; int OnHeadersReceived( net::URLRequest* request, const net::CompletionCallback& callback, diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index ce12bacbc980..601006e5c4ed 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -22,6 +22,8 @@ #include "content/public/common/content_switches.h" #include "net/base/host_mapping_rules.h" #include "net/cert/cert_verifier.h" +#include "net/cert/ct_policy_enforcer.h" +#include "net/cert/multi_log_ct_verifier.h" #include "net/cookies/cookie_monster.h" #include "net/dns/mapped_host_resolver.h" #include "net/http/http_auth_filter.h" @@ -274,6 +276,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { new net::HttpServerPropertiesImpl); storage_->set_http_server_properties(std::move(server_properties)); + cert_transparency_verifier_.reset(new net::MultiLogCTVerifier()); + ct_policy_enforcer_.reset(new net::CTPolicyEnforcer()); + net::HttpNetworkSession::Params network_session_params; network_session_params.cert_verifier = url_request_context_->cert_verifier(); network_session_params.proxy_service = url_request_context_->proxy_service(); @@ -287,6 +292,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { network_session_params.http_auth_handler_factory = url_request_context_->http_auth_handler_factory(); network_session_params.net_log = url_request_context_->net_log(); + network_session_params.cert_transparency_verifier = + cert_transparency_verifier_.get(); + network_session_params.ct_policy_enforcer = ct_policy_enforcer_.get(); // --disable-http2 if (command_line.HasSwitch(switches::kDisableHttp2)) { @@ -295,7 +303,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { } // --ignore-certificate-errors - if (command_line.HasSwitch(::switches::kIgnoreCertificateErrors)) + if (command_line.HasSwitch(switches::kIgnoreCertificateErrors)) network_session_params.ignore_certificate_errors = true; // --host-rules diff --git a/brightray/browser/url_request_context_getter.h b/brightray/browser/url_request_context_getter.h index ed2814c738bd..31427d0ccdb8 100644 --- a/brightray/browser/url_request_context_getter.h +++ b/brightray/browser/url_request_context_getter.h @@ -88,6 +88,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { std::unique_ptr host_mapping_rules_; std::unique_ptr http_auth_preferences_; std::unique_ptr http_network_session_; + std::unique_ptr cert_transparency_verifier_; + std::unique_ptr ct_policy_enforcer_; content::ProtocolHandlerMap protocol_handlers_; content::URLRequestInterceptorScopedVector protocol_interceptors_; diff --git a/brightray/common/content_client.cc b/brightray/common/content_client.cc index b13fc73ef900..ebe066be613d 100644 --- a/brightray/common/content_client.cc +++ b/brightray/common/content_client.cc @@ -54,8 +54,8 @@ gfx::Image& ContentClient::GetNativeImageNamed(int resource_id) const { resource_id); } -base::RefCountedStaticMemory* ContentClient::GetDataResourceBytes( - int resource_id) const { +base::RefCountedMemory* ContentClient::GetDataResourceBytes( + int resource_id) const { return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); } diff --git a/brightray/common/content_client.h b/brightray/common/content_client.h index d54cf5df7301..4d1d6238c954 100644 --- a/brightray/common/content_client.h +++ b/brightray/common/content_client.h @@ -24,8 +24,7 @@ class ContentClient : public content::ContentClient { base::StringPiece GetDataResource(int resource_id, ui::ScaleFactor) const override; gfx::Image& GetNativeImageNamed(int resource_id) const override; - base::RefCountedStaticMemory* GetDataResourceBytes( - int resource_id) const override; + base::RefCountedMemory* GetDataResourceBytes(int resource_id) const override; DISALLOW_COPY_AND_ASSIGN(ContentClient); }; diff --git a/brightray/common/switches.cc b/brightray/common/switches.cc index 7ca869ae98f9..c46fe3bda974 100644 --- a/brightray/common/switches.cc +++ b/brightray/common/switches.cc @@ -49,6 +49,9 @@ const char kAuthServerWhitelist[] = "auth-server-whitelist"; // Whitelist containing servers for which Kerberos delegation is allowed. const char kAuthNegotiateDelegateWhitelist[] = "auth-negotiate-delegate-whitelist"; +// Ignores certificate-related errors. +const char kIgnoreCertificateErrors[] = "ignore-certificate-errors"; + } // namespace switches } // namespace brightray diff --git a/brightray/common/switches.h b/brightray/common/switches.h index 3af00813830f..3aad50656b74 100644 --- a/brightray/common/switches.h +++ b/brightray/common/switches.h @@ -17,6 +17,7 @@ extern const char kProxyPacUrl[]; extern const char kDisableHttp2[]; extern const char kAuthServerWhitelist[]; extern const char kAuthNegotiateDelegateWhitelist[]; +extern const char kIgnoreCertificateErrors[]; } // namespace switches diff --git a/brightray/vendor/libchromiumcontent b/brightray/vendor/libchromiumcontent index c5cf295ef93d..346dfe40a965 160000 --- a/brightray/vendor/libchromiumcontent +++ b/brightray/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit c5cf295ef93d4ee88bff0c4b06b28ff0969a890e +Subproject commit 346dfe40a9658cc40924d29a1deb1d9669509076