diff --git a/atom/browser/net/atom_network_delegate.cc b/atom/browser/net/atom_network_delegate.cc index 05e52c491ea5..2708de29712d 100644 --- a/atom/browser/net/atom_network_delegate.cc +++ b/atom/browser/net/atom_network_delegate.cc @@ -323,9 +323,10 @@ void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, request->was_cached()); } -void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request) { +void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request, + int net_error) { if (!base::ContainsKey(simple_listeners_, kOnResponseStarted)) { - brightray::NetworkDelegate::OnResponseStarted(request); + brightray::NetworkDelegate::OnResponseStarted(request, net_error); return; } diff --git a/atom/browser/net/atom_network_delegate.h b/atom/browser/net/atom_network_delegate.h index 1ee8d19dc900..9288b70cb422 100644 --- a/atom/browser/net/atom_network_delegate.h +++ b/atom/browser/net/atom_network_delegate.h @@ -96,7 +96,7 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate { GURL* allowed_unsafe_redirect_url) override; void OnBeforeRedirect(net::URLRequest* request, const GURL& new_location) override; - void OnResponseStarted(net::URLRequest* request) override; + void OnResponseStarted(net::URLRequest* request, int net_error) override; void OnCompleted(net::URLRequest* request, bool started) override; void OnURLRequestDestroyed(net::URLRequest* request) override; diff --git a/atom/browser/net/atom_url_request.cc b/atom/browser/net/atom_url_request.cc index 253b7558aa45..1aac780d8821 100644 --- a/atom/browser/net/atom_url_request.cc +++ b/atom/browser/net/atom_url_request.cc @@ -354,7 +354,8 @@ void AtomURLRequest::OnAuthRequired(net::URLRequest* request, this, scoped_refptr(auth_info))); } -void AtomURLRequest::OnResponseStarted(net::URLRequest* request) { +void AtomURLRequest::OnResponseStarted(net::URLRequest* request, + int net_error) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (!request_) { return; @@ -373,7 +374,7 @@ void AtomURLRequest::OnResponseStarted(net::URLRequest* request) { ReadResponse(); } else if (status.status() == net::URLRequestStatus::Status::FAILED) { // Report error on Start. - DoCancelWithError(net::ErrorToString(status.ToNetError()), true); + DoCancelWithError(net::ErrorToString(net_error), true); } // We don't report an error is the request is canceled. } diff --git a/atom/browser/net/atom_url_request.h b/atom/browser/net/atom_url_request.h index 19aaef091fee..2b03ad7bc37c 100644 --- a/atom/browser/net/atom_url_request.h +++ b/atom/browser/net/atom_url_request.h @@ -51,7 +51,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe, bool* defer_redirect) override; void OnAuthRequired(net::URLRequest* request, net::AuthChallengeInfo* auth_info) override; - void OnResponseStarted(net::URLRequest* request) override; + void OnResponseStarted(net::URLRequest* request, int net_error) override; void OnReadCompleted(net::URLRequest* request, int bytes_read) override; // Overrides of net::URLRequestContextGetterObserver diff --git a/brightray/browser/network_delegate.cc b/brightray/browser/network_delegate.cc index e5c0186a7b3d..32981cb8b8d5 100644 --- a/brightray/browser/network_delegate.cc +++ b/brightray/browser/network_delegate.cc @@ -78,7 +78,8 @@ int NetworkDelegate::OnHeadersReceived( void NetworkDelegate::OnBeforeRedirect(net::URLRequest* request, const GURL& new_location) {} -void NetworkDelegate::OnResponseStarted(net::URLRequest* request) {} +void NetworkDelegate::OnResponseStarted(net::URLRequest* request, + int net_error) {} void NetworkDelegate::OnNetworkBytesReceived(net::URLRequest* request, int64_t bytes_read) {} @@ -107,7 +108,7 @@ bool NetworkDelegate::OnCanGetCookies(const net::URLRequest& request, } bool NetworkDelegate::OnCanSetCookie(const net::URLRequest& request, - const std::string& cookie_line, + const net::CanonicalCookie& cookie_line, net::CookieOptions* options) { return true; } @@ -143,10 +144,9 @@ bool NetworkDelegate::OnCanQueueReportingReport( return false; } -bool NetworkDelegate::OnCanSendReportingReport( - const url::Origin& origin) const { - return false; -} +void NetworkDelegate::OnCanSendReportingReports( + std::set origins, + base::OnceCallback)> result_callback) const {} bool NetworkDelegate::OnCanSetReportingClient(const url::Origin& origin, const GURL& endpoint) const { diff --git a/brightray/browser/network_delegate.h b/brightray/browser/network_delegate.h index 3c12624b27e1..77625e5c86b1 100644 --- a/brightray/browser/network_delegate.h +++ b/brightray/browser/network_delegate.h @@ -5,6 +5,7 @@ #ifndef BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_ #define BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_ +#include #include #include @@ -38,7 +39,7 @@ class NetworkDelegate : public net::NetworkDelegate { GURL* allowed_unsafe_redirect_url) override; void OnBeforeRedirect(net::URLRequest* request, const GURL& new_location) override; - void OnResponseStarted(net::URLRequest* request) override; + void OnResponseStarted(net::URLRequest* request, int net_error) override; void OnNetworkBytesReceived(net::URLRequest* request, int64_t bytes_read) override; void OnNetworkBytesSent(net::URLRequest* request, @@ -54,7 +55,7 @@ class NetworkDelegate : public net::NetworkDelegate { bool OnCanGetCookies(const net::URLRequest& request, const net::CookieList& cookie_list) override; bool OnCanSetCookie(const net::URLRequest& request, - const std::string& cookie_line, + const net::CanonicalCookie& cookie_line, net::CookieOptions* options) override; bool OnCanAccessFile(const net::URLRequest& request, const base::FilePath& original_path, @@ -68,7 +69,9 @@ class NetworkDelegate : public net::NetworkDelegate { const GURL& target_url, const GURL& referrer_url) const override; bool OnCanQueueReportingReport(const url::Origin& origin) const override; - bool OnCanSendReportingReport(const url::Origin& origin) const override; + void OnCanSendReportingReports(std::set origins, + base::OnceCallback)> + result_callback) const override; bool OnCanSetReportingClient(const url::Origin& origin, const GURL& endpoint) const override; bool OnCanUseReportingClient(const url::Origin& origin,