network_delegate.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE-CHROMIUM file.
  4. #ifndef BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_
  5. #define BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_
  6. #include <string>
  7. #include <vector>
  8. #include "net/base/network_delegate.h"
  9. namespace brightray {
  10. class NetworkDelegate : public net::NetworkDelegate {
  11. public:
  12. NetworkDelegate();
  13. ~NetworkDelegate() override;
  14. protected:
  15. int OnBeforeURLRequest(net::URLRequest* request,
  16. const net::CompletionCallback& callback,
  17. GURL* new_url) override;
  18. int OnBeforeStartTransaction(net::URLRequest* request,
  19. const net::CompletionCallback& callback,
  20. net::HttpRequestHeaders* headers) override;
  21. void OnBeforeSendHeaders(net::URLRequest* request,
  22. const net::ProxyInfo& proxy_info,
  23. const net::ProxyRetryInfoMap& proxy_retry_info,
  24. net::HttpRequestHeaders* headers) override;
  25. void OnStartTransaction(net::URLRequest* request,
  26. const net::HttpRequestHeaders& headers) override;
  27. int OnHeadersReceived(
  28. net::URLRequest* request,
  29. const net::CompletionCallback& callback,
  30. const net::HttpResponseHeaders* original_response_headers,
  31. scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
  32. GURL* allowed_unsafe_redirect_url) override;
  33. void OnBeforeRedirect(net::URLRequest* request,
  34. const GURL& new_location) override;
  35. void OnResponseStarted(net::URLRequest* request) override;
  36. void OnNetworkBytesReceived(net::URLRequest* request,
  37. int64_t bytes_read) override;
  38. void OnNetworkBytesSent(net::URLRequest* request,
  39. int64_t bytes_sent) override;
  40. void OnCompleted(net::URLRequest* request, bool started) override;
  41. void OnURLRequestDestroyed(net::URLRequest* request) override;
  42. void OnPACScriptError(int line_number, const base::string16& error) override;
  43. AuthRequiredResponse OnAuthRequired(
  44. net::URLRequest* request,
  45. const net::AuthChallengeInfo& auth_info,
  46. const AuthCallback& callback,
  47. net::AuthCredentials* credentials) override;
  48. bool OnCanGetCookies(const net::URLRequest& request,
  49. const net::CookieList& cookie_list) override;
  50. bool OnCanSetCookie(const net::URLRequest& request,
  51. const std::string& cookie_line,
  52. net::CookieOptions* options) override;
  53. bool OnCanAccessFile(const net::URLRequest& request,
  54. const base::FilePath& original_path,
  55. const base::FilePath& absolute_path) const override;
  56. bool OnCanEnablePrivacyMode(
  57. const GURL& url,
  58. const GURL& first_party_for_cookies) const override;
  59. bool OnAreExperimentalCookieFeaturesEnabled() const override;
  60. bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
  61. const net::URLRequest& request,
  62. const GURL& target_url,
  63. const GURL& referrer_url) const override;
  64. bool OnCanQueueReportingReport(const url::Origin& origin) const override;
  65. bool OnCanSendReportingReport(const url::Origin& origin) const override;
  66. bool OnCanSetReportingClient(const url::Origin& origin,
  67. const GURL& endpoint) const override;
  68. bool OnCanUseReportingClient(const url::Origin& origin,
  69. const GURL& endpoint) const override;
  70. private:
  71. std::vector<std::string> ignore_connections_limit_domains_;
  72. DISALLOW_COPY_AND_ASSIGN(NetworkDelegate);
  73. };
  74. } // namespace brightray
  75. #endif // BRIGHTRAY_BROWSER_NETWORK_DELEGATE_H_