Revert of Disable spdy tests for constant failures on Volantis bot (patchset #2 id...
[chromium-blink-merge.git] / android_webview / browser / net / aw_network_delegate.cc
blobbc778fe3410cb1c967302af867a7cbcff227d913
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 file.
5 #include "android_webview/browser/net/aw_network_delegate.h"
7 #include "android_webview/browser/aw_cookie_access_policy.h"
8 #include "base/android/build_info.h"
9 #include "net/base/net_errors.h"
10 #include "net/base/completion_callback.h"
11 #include "net/proxy/proxy_info.h"
12 #include "net/proxy/proxy_server.h"
13 #include "net/url_request/url_request.h"
15 namespace android_webview {
17 AwNetworkDelegate::AwNetworkDelegate() {
20 AwNetworkDelegate::~AwNetworkDelegate() {
23 int AwNetworkDelegate::OnBeforeURLRequest(
24 net::URLRequest* request,
25 const net::CompletionCallback& callback,
26 GURL* new_url) {
27 return net::OK;
30 int AwNetworkDelegate::OnBeforeSendHeaders(
31 net::URLRequest* request,
32 const net::CompletionCallback& callback,
33 net::HttpRequestHeaders* headers) {
35 DCHECK(headers);
36 headers->SetHeaderIfMissing(
37 "X-Requested-With",
38 base::android::BuildInfo::GetInstance()->package_name());
39 return net::OK;
42 void AwNetworkDelegate::OnSendHeaders(net::URLRequest* request,
43 const net::HttpRequestHeaders& headers) {
46 int AwNetworkDelegate::OnHeadersReceived(
47 net::URLRequest* request,
48 const net::CompletionCallback& callback,
49 const net::HttpResponseHeaders* original_response_headers,
50 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
51 GURL* allowed_unsafe_redirect_url) {
52 return net::OK;
55 void AwNetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
56 const GURL& new_location) {
59 void AwNetworkDelegate::OnResponseStarted(net::URLRequest* request) {
62 void AwNetworkDelegate::OnRawBytesRead(const net::URLRequest& request,
63 int bytes_read) {
66 void AwNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) {
69 void AwNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) {
72 void AwNetworkDelegate::OnPACScriptError(int line_number,
73 const base::string16& error) {
76 net::NetworkDelegate::AuthRequiredResponse AwNetworkDelegate::OnAuthRequired(
77 net::URLRequest* request,
78 const net::AuthChallengeInfo& auth_info,
79 const AuthCallback& callback,
80 net::AuthCredentials* credentials) {
81 return AUTH_REQUIRED_RESPONSE_NO_ACTION;
84 bool AwNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
85 const net::CookieList& cookie_list) {
86 return AwCookieAccessPolicy::GetInstance()->OnCanGetCookies(request,
87 cookie_list);
90 bool AwNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
91 const std::string& cookie_line,
92 net::CookieOptions* options) {
93 return AwCookieAccessPolicy::GetInstance()->OnCanSetCookie(request,
94 cookie_line,
95 options);
98 bool AwNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
99 const base::FilePath& path) const {
100 return true;
103 bool AwNetworkDelegate::OnCanThrottleRequest(
104 const net::URLRequest& request) const {
105 return false;
108 } // namespace android_webview