2012-04-03 03:34:16 +02:00
|
|
|
// Copyright (c) 2012 The Chromium Embedded Framework 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 CEF_LIBCEF_BROWSER_URL_NETWORK_DELEGATE_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_URL_NETWORK_DELEGATE_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "net/base/network_delegate.h"
|
|
|
|
|
|
|
|
// Used for intercepting resource requests, redirects and responses. The single
|
|
|
|
// instance of this class is managed by CefURLRequestContextGetter.
|
|
|
|
class CefNetworkDelegate : public net::NetworkDelegate {
|
|
|
|
public:
|
|
|
|
CefNetworkDelegate();
|
|
|
|
~CefNetworkDelegate();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// net::NetworkDelegate methods.
|
|
|
|
virtual int OnBeforeURLRequest(net::URLRequest* request,
|
|
|
|
const net::CompletionCallback& callback,
|
|
|
|
GURL* new_url) OVERRIDE;
|
|
|
|
virtual int OnBeforeSendHeaders(net::URLRequest* request,
|
|
|
|
const net::CompletionCallback& callback,
|
|
|
|
net::HttpRequestHeaders* headers) OVERRIDE;
|
|
|
|
virtual void OnSendHeaders(net::URLRequest* request,
|
|
|
|
const net::HttpRequestHeaders& headers) OVERRIDE;
|
|
|
|
virtual int OnHeadersReceived(
|
|
|
|
net::URLRequest* request,
|
|
|
|
const net::CompletionCallback& callback,
|
2012-11-05 21:18:20 +01:00
|
|
|
const net::HttpResponseHeaders* original_response_headers,
|
2012-04-03 03:34:16 +02:00
|
|
|
scoped_refptr<net::HttpResponseHeaders>* override_response_headers)
|
|
|
|
OVERRIDE;
|
|
|
|
virtual void OnBeforeRedirect(net::URLRequest* request,
|
|
|
|
const GURL& new_location) OVERRIDE;
|
|
|
|
virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
|
|
|
|
virtual void OnRawBytesRead(const net::URLRequest& request, int bytes_read)
|
|
|
|
OVERRIDE;
|
|
|
|
virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE;
|
|
|
|
virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE;
|
|
|
|
virtual void OnPACScriptError(int line_number, const string16& error)
|
|
|
|
OVERRIDE;
|
|
|
|
virtual AuthRequiredResponse OnAuthRequired(
|
|
|
|
net::URLRequest* request,
|
|
|
|
const net::AuthChallengeInfo& auth_info,
|
|
|
|
const AuthCallback& callback,
|
|
|
|
net::AuthCredentials* credentials) OVERRIDE;
|
2012-05-18 17:04:56 +02:00
|
|
|
virtual bool OnCanGetCookies(const net::URLRequest& request,
|
|
|
|
const net::CookieList& cookie_list) OVERRIDE;
|
|
|
|
virtual bool OnCanSetCookie(const net::URLRequest& request,
|
|
|
|
const std::string& cookie_line,
|
|
|
|
net::CookieOptions* options) OVERRIDE;
|
|
|
|
virtual bool OnCanAccessFile(const net::URLRequest& request,
|
2013-02-23 01:43:28 +01:00
|
|
|
const base::FilePath& path) const OVERRIDE;
|
2012-06-22 00:50:34 +02:00
|
|
|
virtual bool OnCanThrottleRequest(
|
|
|
|
const net::URLRequest& request) const OVERRIDE;
|
|
|
|
virtual int OnBeforeSocketStreamConnect(
|
|
|
|
net::SocketStream* stream,
|
|
|
|
const net::CompletionCallback& callback) OVERRIDE;
|
2012-08-29 00:26:35 +02:00
|
|
|
virtual void OnRequestWaitStateChange(const net::URLRequest& request,
|
|
|
|
RequestWaitState state) OVERRIDE;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefNetworkDelegate);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_URL_NETWORK_DELEGATE_H_
|