2013-03-13 19:12:05 +00:00
|
|
|
// Copyright (c) 2012 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-CHROMIUM file.
|
|
|
|
|
2013-03-13 19:42:16 +00:00
|
|
|
#ifndef BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_
|
|
|
|
#define BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_
|
2013-03-13 19:12:05 +00:00
|
|
|
|
|
|
|
#include "net/base/network_delegate.h"
|
|
|
|
|
2013-11-17 23:36:34 +00:00
|
|
|
#include <string>
|
|
|
|
|
2013-03-13 19:12:05 +00:00
|
|
|
namespace brightray {
|
|
|
|
|
|
|
|
class NetworkDelegate : public net::NetworkDelegate {
|
2013-07-17 14:21:33 +00:00
|
|
|
public:
|
2013-03-13 19:12:05 +00:00
|
|
|
NetworkDelegate();
|
|
|
|
virtual ~NetworkDelegate();
|
|
|
|
|
2013-07-17 14:21:33 +00:00
|
|
|
protected:
|
2013-11-17 23:36:34 +00:00
|
|
|
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,
|
|
|
|
const net::HttpResponseHeaders* original_response_headers,
|
|
|
|
scoped_refptr<net::HttpResponseHeaders>*
|
|
|
|
override_response_headers) OVERRIDE;
|
|
|
|
virtual void OnBeforeRedirect(net::URLRequest* request,
|
|
|
|
const GURL& new_location) OVERRIDE;
|
2013-03-13 19:12:05 +00:00
|
|
|
virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
|
2013-11-17 23:36:34 +00:00
|
|
|
virtual void OnRawBytesRead(const net::URLRequest& request,
|
|
|
|
int bytes_read) OVERRIDE;
|
2013-03-13 19:12:05 +00:00
|
|
|
virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE;
|
|
|
|
virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE;
|
2013-11-17 23:36:34 +00:00
|
|
|
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;
|
|
|
|
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,
|
|
|
|
const base::FilePath& path) const OVERRIDE;
|
|
|
|
virtual bool OnCanThrottleRequest(
|
|
|
|
const net::URLRequest& request) const OVERRIDE;
|
|
|
|
virtual int OnBeforeSocketStreamConnect(
|
|
|
|
net::SocketStream* stream,
|
|
|
|
const net::CompletionCallback& callback) OVERRIDE;
|
|
|
|
virtual void OnRequestWaitStateChange(const net::URLRequest& request,
|
|
|
|
RequestWaitState state) OVERRIDE;
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2013-07-17 14:21:33 +00:00
|
|
|
private:
|
2013-03-13 19:12:05 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(NetworkDelegate);
|
|
|
|
};
|
|
|
|
|
2013-11-17 23:20:17 +00:00
|
|
|
} // namespace brightray
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2013-03-13 19:42:16 +00:00
|
|
|
#endif
|