Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: net/base/layered_network_delegate.h

Issue 787803004: Update from https://crrev.com/307664 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/tools/roll/cc_strip_video.patch ('k') | net/base/layered_network_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/layered_network_delegate.h
diff --git a/net/base/layered_network_delegate.h b/net/base/layered_network_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..93c9d11274ac7a20daa42f1c974a263b68086de1
--- /dev/null
+++ b/net/base/layered_network_delegate.h
@@ -0,0 +1,171 @@
+// 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_LAYERED_NETWORK_DELEGATE_H_
+#define NET_BASE_LAYERED_NETWORK_DELEGATE_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/strings/string16.h"
+#include "net/base/completion_callback.h"
+#include "net/base/network_delegate.h"
+#include "net/cookies/canonical_cookie.h"
+
+class GURL;
+
+namespace base {
+class FilePath;
+}
+
+namespace net {
+
+class CookieOptions;
+class HttpRequestHeaders;
+class HttpResponseHeaders;
+class ProxyInfo;
+class ProxyServer;
+class ProxyService;
+class URLRequest;
+
+// WrappingNetworkDelegate takes a |network_delegate| and extends it. When
+// On*() is called, the On*Internal() method of this is first called and then
+// the On*() of |network_delegate| is called. On*Internal() methods have no
+// return values, and cannot prevent calling into the nested network delegate.
+class NET_EXPORT LayeredNetworkDelegate : public NetworkDelegate {
+ public:
+ explicit LayeredNetworkDelegate(
+ scoped_ptr<NetworkDelegate> nested_network_delegate);
+ ~LayeredNetworkDelegate() override;
+
+ // NetworkDelegate implementation:
+ int OnBeforeURLRequest(URLRequest* request,
+ const CompletionCallback& callback,
+ GURL* new_url) final override;
+ void OnResolveProxy(const GURL& url,
+ int load_flags,
+ const ProxyService& proxy_service,
+ ProxyInfo* result) final override;
+ void OnProxyFallback(const ProxyServer& bad_proxy,
+ int net_error) final override;
+ int OnBeforeSendHeaders(URLRequest* request,
+ const CompletionCallback& callback,
+ HttpRequestHeaders* headers) final override;
+ void OnBeforeSendProxyHeaders(URLRequest* request,
+ const ProxyInfo& proxy_info,
+ HttpRequestHeaders* headers) final override;
+ void OnSendHeaders(URLRequest* request,
+ const HttpRequestHeaders& headers) final override;
+ int OnHeadersReceived(
+ URLRequest* request,
+ const CompletionCallback& callback,
+ const HttpResponseHeaders* original_response_headers,
+ scoped_refptr<HttpResponseHeaders>* override_response_headers,
+ GURL* allowed_unsafe_redirect_url) final override;
+ void OnBeforeRedirect(URLRequest* request,
+ const GURL& new_location) final override;
+ void OnResponseStarted(URLRequest* request) final override;
+ void OnRawBytesRead(const URLRequest& request, int bytes_read) final override;
+ void OnCompleted(URLRequest* request, bool started) final override;
+ void OnURLRequestDestroyed(URLRequest* request) final override;
+ void OnPACScriptError(int line_number,
+ const base::string16& error) final override;
+ AuthRequiredResponse OnAuthRequired(
+ URLRequest* request,
+ const AuthChallengeInfo& auth_info,
+ const AuthCallback& callback,
+ AuthCredentials* credentials) final override;
+ bool OnCanGetCookies(const URLRequest& request,
+ const CookieList& cookie_list) final override;
+ bool OnCanSetCookie(const URLRequest& request,
+ const std::string& cookie_line,
+ CookieOptions* options) final override;
+ bool OnCanAccessFile(const URLRequest& request,
+ const base::FilePath& path) const final override;
+ bool OnCanThrottleRequest(const URLRequest& request) const final override;
+ bool OnCanEnablePrivacyMode(
+ const GURL& url,
+ const GURL& first_party_for_cookies) const final override;
+ bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
+ const URLRequest& request,
+ const GURL& target_url,
+ const GURL& referrer_url) const final override;
+
+ protected:
+ virtual void OnBeforeURLRequestInternal(URLRequest* request,
+ const CompletionCallback& callback,
+ GURL* new_url);
+
+ virtual void OnResolveProxyInternal(const GURL& url,
+ int load_flags,
+ const ProxyService& proxy_service,
+ ProxyInfo* result);
+
+ virtual void OnProxyFallbackInternal(const ProxyServer& bad_proxy,
+ int net_error);
+
+ virtual void OnBeforeSendHeadersInternal(URLRequest* request,
+ const CompletionCallback& callback,
+ HttpRequestHeaders* headers);
+
+ virtual void OnBeforeSendProxyHeadersInternal(URLRequest* request,
+ const ProxyInfo& proxy_info,
+ HttpRequestHeaders* headers);
+
+ virtual void OnSendHeadersInternal(URLRequest* request,
+ const HttpRequestHeaders& headers);
+
+ virtual void OnHeadersReceivedInternal(
+ URLRequest* request,
+ const CompletionCallback& callback,
+ const HttpResponseHeaders* original_response_headers,
+ scoped_refptr<HttpResponseHeaders>* override_response_headers,
+ GURL* allowed_unsafe_redirect_url);
+
+ virtual void OnBeforeRedirectInternal(URLRequest* request,
+ const GURL& new_location);
+
+ virtual void OnResponseStartedInternal(URLRequest* request);
+
+ virtual void OnRawBytesReadInternal(const URLRequest& request,
+ int bytes_read);
+
+ virtual void OnCompletedInternal(URLRequest* request, bool started);
+
+ virtual void OnURLRequestDestroyedInternal(URLRequest* request);
+
+ virtual void OnPACScriptErrorInternal(int line_number,
+ const base::string16& error);
+
+ virtual void OnCanGetCookiesInternal(const URLRequest& request,
+ const CookieList& cookie_list);
+
+ virtual void OnCanSetCookieInternal(const URLRequest& request,
+ const std::string& cookie_line,
+ CookieOptions* options);
+
+ virtual void OnAuthRequiredInternal(URLRequest* request,
+ const AuthChallengeInfo& auth_info,
+ const AuthCallback& callback,
+ AuthCredentials* credentials);
+
+ virtual void OnCanAccessFileInternal(const URLRequest& request,
+ const base::FilePath& path) const;
+
+ virtual void OnCanThrottleRequestInternal(const URLRequest& request) const;
+
+ virtual void OnCanEnablePrivacyModeInternal(
+ const GURL& url,
+ const GURL& first_party_for_cookies) const;
+
+ virtual void OnCancelURLRequestWithPolicyViolatingReferrerHeaderInternal(
+ const URLRequest& request,
+ const GURL& target_url,
+ const GURL& referrer_url) const;
+
+ private:
+ scoped_ptr<NetworkDelegate> nested_network_delegate_;
+};
+
+} // namespace net
+
+#endif // NET_BASE_LAYERED_NETWORK_DELEGATE_H_
« no previous file with comments | « mojo/tools/roll/cc_strip_video.patch ('k') | net/base/layered_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698