Update NetworkDelegate

* Remove Deprecated OnResponseStarted.
  https://chromium-review.googlesource.com/c/chromium/src/+/763193
* Replace cookie lines with CanonicalCookie in CanSetCookie delegates.
  https://chromium-review.googlesource.com/c/chromium/src/+/775606
* Reporting: Check upload permissions asynchronously
  https://chromium-review.googlesource.com/c/chromium/src/+/937566
This commit is contained in:
deepak1556 2018-04-08 23:47:17 +05:30 committed by Samuel Attard
parent bf55d856d2
commit 026e7bff40
6 changed files with 20 additions and 15 deletions

View file

@ -323,9 +323,10 @@ void AtomNetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
request->was_cached()); request->was_cached());
} }
void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request) { void AtomNetworkDelegate::OnResponseStarted(net::URLRequest* request,
int net_error) {
if (!base::ContainsKey(simple_listeners_, kOnResponseStarted)) { if (!base::ContainsKey(simple_listeners_, kOnResponseStarted)) {
brightray::NetworkDelegate::OnResponseStarted(request); brightray::NetworkDelegate::OnResponseStarted(request, net_error);
return; return;
} }

View file

@ -96,7 +96,7 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate {
GURL* allowed_unsafe_redirect_url) override; GURL* allowed_unsafe_redirect_url) override;
void OnBeforeRedirect(net::URLRequest* request, void OnBeforeRedirect(net::URLRequest* request,
const GURL& new_location) override; 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 OnCompleted(net::URLRequest* request, bool started) override;
void OnURLRequestDestroyed(net::URLRequest* request) override; void OnURLRequestDestroyed(net::URLRequest* request) override;

View file

@ -354,7 +354,8 @@ void AtomURLRequest::OnAuthRequired(net::URLRequest* request,
this, scoped_refptr<net::AuthChallengeInfo>(auth_info))); this, scoped_refptr<net::AuthChallengeInfo>(auth_info)));
} }
void AtomURLRequest::OnResponseStarted(net::URLRequest* request) { void AtomURLRequest::OnResponseStarted(net::URLRequest* request,
int net_error) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (!request_) { if (!request_) {
return; return;
@ -373,7 +374,7 @@ void AtomURLRequest::OnResponseStarted(net::URLRequest* request) {
ReadResponse(); ReadResponse();
} else if (status.status() == net::URLRequestStatus::Status::FAILED) { } else if (status.status() == net::URLRequestStatus::Status::FAILED) {
// Report error on Start. // 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. // We don't report an error is the request is canceled.
} }

View file

@ -51,7 +51,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
bool* defer_redirect) override; bool* defer_redirect) override;
void OnAuthRequired(net::URLRequest* request, void OnAuthRequired(net::URLRequest* request,
net::AuthChallengeInfo* auth_info) override; 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; void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
// Overrides of net::URLRequestContextGetterObserver // Overrides of net::URLRequestContextGetterObserver

View file

@ -78,7 +78,8 @@ int NetworkDelegate::OnHeadersReceived(
void NetworkDelegate::OnBeforeRedirect(net::URLRequest* request, void NetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
const GURL& new_location) {} 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, void NetworkDelegate::OnNetworkBytesReceived(net::URLRequest* request,
int64_t bytes_read) {} int64_t bytes_read) {}
@ -107,7 +108,7 @@ bool NetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
} }
bool NetworkDelegate::OnCanSetCookie(const net::URLRequest& request, bool NetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
const std::string& cookie_line, const net::CanonicalCookie& cookie_line,
net::CookieOptions* options) { net::CookieOptions* options) {
return true; return true;
} }
@ -143,10 +144,9 @@ bool NetworkDelegate::OnCanQueueReportingReport(
return false; return false;
} }
bool NetworkDelegate::OnCanSendReportingReport( void NetworkDelegate::OnCanSendReportingReports(
const url::Origin& origin) const { std::set<url::Origin> origins,
return false; base::OnceCallback<void(std::set<url::Origin>)> result_callback) const {}
}
bool NetworkDelegate::OnCanSetReportingClient(const url::Origin& origin, bool NetworkDelegate::OnCanSetReportingClient(const url::Origin& origin,
const GURL& endpoint) const { const GURL& endpoint) const {

View file

@ -5,6 +5,7 @@
#ifndef BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_ #ifndef BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_
#define BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_ #define BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_
#include <set>
#include <string> #include <string>
#include <vector> #include <vector>
@ -38,7 +39,7 @@ class NetworkDelegate : public net::NetworkDelegate {
GURL* allowed_unsafe_redirect_url) override; GURL* allowed_unsafe_redirect_url) override;
void OnBeforeRedirect(net::URLRequest* request, void OnBeforeRedirect(net::URLRequest* request,
const GURL& new_location) override; 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, void OnNetworkBytesReceived(net::URLRequest* request,
int64_t bytes_read) override; int64_t bytes_read) override;
void OnNetworkBytesSent(net::URLRequest* request, void OnNetworkBytesSent(net::URLRequest* request,
@ -54,7 +55,7 @@ class NetworkDelegate : public net::NetworkDelegate {
bool OnCanGetCookies(const net::URLRequest& request, bool OnCanGetCookies(const net::URLRequest& request,
const net::CookieList& cookie_list) override; const net::CookieList& cookie_list) override;
bool OnCanSetCookie(const net::URLRequest& request, bool OnCanSetCookie(const net::URLRequest& request,
const std::string& cookie_line, const net::CanonicalCookie& cookie_line,
net::CookieOptions* options) override; net::CookieOptions* options) override;
bool OnCanAccessFile(const net::URLRequest& request, bool OnCanAccessFile(const net::URLRequest& request,
const base::FilePath& original_path, const base::FilePath& original_path,
@ -68,7 +69,9 @@ class NetworkDelegate : public net::NetworkDelegate {
const GURL& target_url, const GURL& target_url,
const GURL& referrer_url) const override; const GURL& referrer_url) const override;
bool OnCanQueueReportingReport(const url::Origin& origin) const override; bool OnCanQueueReportingReport(const url::Origin& origin) const override;
bool OnCanSendReportingReport(const url::Origin& origin) const override; void OnCanSendReportingReports(std::set<url::Origin> origins,
base::OnceCallback<void(std::set<url::Origin>)>
result_callback) const override;
bool OnCanSetReportingClient(const url::Origin& origin, bool OnCanSetReportingClient(const url::Origin& origin,
const GURL& endpoint) const override; const GURL& endpoint) const override;
bool OnCanUseReportingClient(const url::Origin& origin, bool OnCanUseReportingClient(const url::Origin& origin,