blob: 5f7bf9034204f85215c777e6c19f6d19ec5b0d24 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_BASE_NETWORK_DELEGATE_IMPL_H_
#define NET_BASE_NETWORK_DELEGATE_IMPL_H_
#include <stdint.h>
#include <set>
#include "base/optional.h"
#include "base/strings/string16.h"
#include "net/base/completion_once_callback.h"
#include "net/base/net_export.h"
#include "net/base/network_delegate.h"
#include "net/cookies/canonical_cookie.h"
#include "net/proxy_resolution/proxy_retry_info.h"
class GURL;
namespace url {
class Origin;
}
namespace net {
class CookieOptions;
class HttpRequestHeaders;
class HttpResponseHeaders;
class ProxyInfo;
class URLRequest;
class NET_EXPORT NetworkDelegateImpl : public NetworkDelegate {
public:
~NetworkDelegateImpl() override {}
private:
int OnBeforeURLRequest(URLRequest* request,
CompletionOnceCallback callback,
GURL* new_url) override;
int OnBeforeStartTransaction(URLRequest* request,
CompletionOnceCallback callback,
HttpRequestHeaders* headers) override;
void OnBeforeSendHeaders(URLRequest* request,
const ProxyInfo& proxy_info,
const ProxyRetryInfoMap& proxy_retry_info,
HttpRequestHeaders* headers) override;
int OnHeadersReceived(
URLRequest* request,
CompletionOnceCallback callback,
const HttpResponseHeaders* original_response_headers,
scoped_refptr<HttpResponseHeaders>* override_response_headers,
const IPEndPoint& endpoint,
base::Optional<GURL>* preserve_fragment_on_redirect_url) override;
void OnBeforeRedirect(URLRequest* request, const GURL& new_location) override;
void OnResponseStarted(URLRequest* request, int net_error) override;
void OnCompleted(URLRequest* request, bool started, int net_error) override;
void OnURLRequestDestroyed(URLRequest* request) override;
void OnPACScriptError(int line_number, const base::string16& error) override;
bool OnCanGetCookies(const URLRequest& request,
const CookieList& cookie_list,
bool allowed_from_caller) override;
bool OnCanSetCookie(const URLRequest& request,
const net::CanonicalCookie& cookie,
CookieOptions* options,
bool allowed_from_caller) override;
bool OnForcePrivacyMode(
const GURL& url,
const GURL& site_for_cookies,
const base::Optional<url::Origin>& top_frame_origin) const override;
bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
const URLRequest& request,
const GURL& target_url,
const GURL& referrer_url) const override;
bool OnCanQueueReportingReport(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,
const GURL& endpoint) const override;
bool OnCanUseReportingClient(const url::Origin& origin,
const GURL& endpoint) const override;
};
} // namespace net
#endif // NET_BASE_NETWORK_DELEGATE_IMPL_H_