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
|
|
|
|
2016-06-07 20:44:59 +02:00
|
|
|
template<class T> class PrefMember;
|
|
|
|
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
|
|
|
|
2015-12-09 17:10:16 +01:00
|
|
|
// Match the logic from ChromeNetworkDelegate and
|
|
|
|
// RenderFrameMessageFilter::OnSetCookie.
|
|
|
|
static bool AreExperimentalCookieFeaturesEnabled();
|
|
|
|
static bool AreStrictSecureCookiesEnabled();
|
|
|
|
|
2016-06-07 20:44:59 +02:00
|
|
|
void set_force_google_safesearch(
|
|
|
|
BooleanPrefMember* force_google_safesearch) {
|
|
|
|
force_google_safesearch_ = force_google_safesearch;
|
|
|
|
}
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
private:
|
|
|
|
// net::NetworkDelegate methods.
|
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;
|
2014-11-12 20:25:15 +01:00
|
|
|
bool OnCanAccessFile(const net::URLRequest& request,
|
2015-04-02 17:21:46 +02:00
|
|
|
const base::FilePath& path) const override;
|
2015-12-09 17:10:16 +01:00
|
|
|
bool OnAreExperimentalCookieFeaturesEnabled() const override;
|
|
|
|
bool OnAreStrictSecureCookiesEnabled() const override;
|
2015-12-05 03:58:56 +01:00
|
|
|
net::Filter* SetupFilter(net::URLRequest* request,
|
|
|
|
net::Filter* filter_list) 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_
|