[Chromoting] Break up JS event handler registration into related groups.
[chromium-blink-merge.git] / android_webview / browser / net / aw_network_delegate.cc
blobc5aef1ff30c9ae53c7f26ee618b7b7e4e2ce833a
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/url_request/url_request.h"
13 namespace android_webview {
15 AwNetworkDelegate::AwNetworkDelegate() {
18 AwNetworkDelegate::~AwNetworkDelegate() {
21 int AwNetworkDelegate::OnBeforeURLRequest(
22 net::URLRequest* request,
23 const net::CompletionCallback& callback,
24 GURL* new_url) {
25 return net::OK;
28 int AwNetworkDelegate::OnBeforeSendHeaders(
29 net::URLRequest* request,
30 const net::CompletionCallback& callback,
31 net::HttpRequestHeaders* headers) {
33 DCHECK(headers);
34 headers->SetHeaderIfMissing(
35 "X-Requested-With",
36 base::android::BuildInfo::GetInstance()->package_name());
37 return net::OK;
40 void AwNetworkDelegate::OnSendHeaders(net::URLRequest* request,
41 const net::HttpRequestHeaders& headers) {
44 int AwNetworkDelegate::OnHeadersReceived(
45 net::URLRequest* request,
46 const net::CompletionCallback& callback,
47 const net::HttpResponseHeaders* original_response_headers,
48 scoped_refptr<net::HttpResponseHeaders>* override_response_headers) {
49 return net::OK;
52 void AwNetworkDelegate::OnBeforeRedirect(net::URLRequest* request,
53 const GURL& new_location) {
56 void AwNetworkDelegate::OnResponseStarted(net::URLRequest* request) {
59 void AwNetworkDelegate::OnRawBytesRead(const net::URLRequest& request,
60 int bytes_read) {
63 void AwNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) {
66 void AwNetworkDelegate::OnURLRequestDestroyed(net::URLRequest* request) {
69 void AwNetworkDelegate::OnPACScriptError(int line_number,
70 const base::string16& error) {
73 net::NetworkDelegate::AuthRequiredResponse AwNetworkDelegate::OnAuthRequired(
74 net::URLRequest* request,
75 const net::AuthChallengeInfo& auth_info,
76 const AuthCallback& callback,
77 net::AuthCredentials* credentials) {
78 return AUTH_REQUIRED_RESPONSE_NO_ACTION;
81 bool AwNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
82 const net::CookieList& cookie_list) {
83 return AwCookieAccessPolicy::GetInstance()->OnCanGetCookies(request,
84 cookie_list);
87 bool AwNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
88 const std::string& cookie_line,
89 net::CookieOptions* options) {
90 return AwCookieAccessPolicy::GetInstance()->OnCanSetCookie(request,
91 cookie_line,
92 options);
95 bool AwNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
96 const base::FilePath& path) const {
97 return true;
100 bool AwNetworkDelegate::OnCanThrottleRequest(
101 const net::URLRequest& request) const {
102 return false;
105 int AwNetworkDelegate::OnBeforeSocketStreamConnect(
106 net::SocketStream* stream,
107 const net::CompletionCallback& callback) {
108 return net::OK;
111 } // namespace android_webview