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.
|
|
|
|
|
2015-11-26 03:53:12 +01:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_NET_NETWORK_DELEGATE_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_NET_NETWORK_DELEGATE_H_
|
2012-04-03 03:34:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
2016-01-06 20:20:54 +01:00
|
|
|
#include "base/macros.h"
|
2014-12-13 21:18:31 +01:00
|
|
|
#include "net/base/network_delegate_impl.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
template <class T>
|
|
|
|
class PrefMember;
|
2016-06-07 20:44:59 +02:00
|
|
|
typedef PrefMember<bool> BooleanPrefMember;
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// Used for intercepting resource requests, redirects and responses. The single
|
|
|
|
// instance of this class is managed by CefURLRequestContextGetter.
|
2014-12-13 21:18:31 +01:00
|
|
|
class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
2012-04-03 03:34:16 +02:00
|
|
|
public:
|
|
|
|
CefNetworkDelegate();
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefNetworkDelegate() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void set_force_google_safesearch(BooleanPrefMember* force_google_safesearch) {
|
2016-06-07 20:44:59 +02:00
|
|
|
force_google_safesearch_ = force_google_safesearch;
|
|
|
|
}
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
private:
|
|
|
|
// net::NetworkDelegate methods.
|
2016-11-23 21:54:29 +01:00
|
|
|
std::unique_ptr<net::SourceStream> CreateSourceStream(
|
|
|
|
net::URLRequest* request,
|
|
|
|
std::unique_ptr<net::SourceStream> upstream) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
int OnBeforeURLRequest(net::URLRequest* request,
|
|
|
|
const net::CompletionCallback& callback,
|
|
|
|
GURL* new_url) override;
|
|
|
|
AuthRequiredResponse OnAuthRequired(
|
2012-04-03 03:34:16 +02:00
|
|
|
net::URLRequest* request,
|
|
|
|
const net::AuthChallengeInfo& auth_info,
|
|
|
|
const AuthCallback& callback,
|
2014-11-12 20:25:15 +01:00
|
|
|
net::AuthCredentials* credentials) override;
|
2015-12-04 19:59:14 +01:00
|
|
|
void OnCompleted(net::URLRequest* request, bool started) override;
|
2018-02-06 01:21:14 +01:00
|
|
|
bool OnCanGetCookies(const net::URLRequest& request,
|
|
|
|
const net::CookieList& cookie_list) override;
|
|
|
|
bool OnCanSetCookie(const net::URLRequest& request,
|
|
|
|
const net::CanonicalCookie& cookie,
|
|
|
|
net::CookieOptions* options) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
bool OnCanAccessFile(const net::URLRequest& request,
|
2017-07-27 01:19:27 +02:00
|
|
|
const base::FilePath& original_path,
|
|
|
|
const base::FilePath& absolute_path) const override;
|
2015-12-09 17:10:16 +01:00
|
|
|
bool OnAreExperimentalCookieFeaturesEnabled() const override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2016-06-07 20:44:59 +02:00
|
|
|
// Weak, owned by our owner (CefURLRequestContextGetterImpl).
|
|
|
|
BooleanPrefMember* force_google_safesearch_;
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefNetworkDelegate);
|
|
|
|
};
|
|
|
|
|
2015-11-26 03:53:12 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_NET_NETWORK_DELEGATE_H_
|