blob: 39934eb778216344477d8955f8bd84a33adf8f64 [file] [log] [blame]
[email protected]0651b812011-02-24 00:22:501// Copyright (c) 2011 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.
4
5#include "net/base/network_delegate.h"
6
7#include "base/logging.h"
8
9namespace net {
10
[email protected]084262c2011-12-01 21:12:4711int NetworkDelegate::NotifyBeforeURLRequest(
12 URLRequest* request, const CompletionCallback& callback,
13 GURL* new_url) {
[email protected]0651b812011-02-24 00:22:5014 DCHECK(CalledOnValidThread());
15 DCHECK(request);
[email protected]084262c2011-12-01 21:12:4716 DCHECK(!callback.is_null());
[email protected]4c76d7c2011-04-15 19:14:1217 return OnBeforeURLRequest(request, callback, new_url);
[email protected]0651b812011-02-24 00:22:5018}
19
[email protected]084262c2011-12-01 21:12:4720int NetworkDelegate::NotifyBeforeSendHeaders(
21 URLRequest* request, const CompletionCallback& callback,
22 HttpRequestHeaders* headers) {
[email protected]0651b812011-02-24 00:22:5023 DCHECK(CalledOnValidThread());
24 DCHECK(headers);
[email protected]084262c2011-12-01 21:12:4725 DCHECK(!callback.is_null());
[email protected]636eccd2011-06-28 12:28:0126 return OnBeforeSendHeaders(request, callback, headers);
[email protected]0651b812011-02-24 00:22:5027}
28
[email protected]5796dc942011-07-14 19:26:1029void NetworkDelegate::NotifySendHeaders(URLRequest* request,
30 const HttpRequestHeaders& headers) {
[email protected]82b42302011-04-20 16:28:1631 DCHECK(CalledOnValidThread());
[email protected]5796dc942011-07-14 19:26:1032 OnSendHeaders(request, headers);
[email protected]82b42302011-04-20 16:28:1633}
34
[email protected]ea8141e2011-10-05 13:12:5135int NetworkDelegate::NotifyHeadersReceived(
36 URLRequest* request,
[email protected]084262c2011-12-01 21:12:4737 const CompletionCallback& callback,
[email protected]ea8141e2011-10-05 13:12:5138 HttpResponseHeaders* original_response_headers,
39 scoped_refptr<HttpResponseHeaders>* override_response_headers) {
40 DCHECK(CalledOnValidThread());
41 DCHECK(original_response_headers);
[email protected]084262c2011-12-01 21:12:4742 DCHECK(!callback.is_null());
[email protected]ea8141e2011-10-05 13:12:5143 return OnHeadersReceived(request, callback, original_response_headers,
44 override_response_headers);
45}
46
[email protected]0651b812011-02-24 00:22:5047void NetworkDelegate::NotifyResponseStarted(URLRequest* request) {
48 DCHECK(CalledOnValidThread());
49 DCHECK(request);
50 OnResponseStarted(request);
51}
52
[email protected]8523ba52011-05-22 19:00:5853void NetworkDelegate::NotifyRawBytesRead(const URLRequest& request,
54 int bytes_read) {
55 DCHECK(CalledOnValidThread());
56 OnRawBytesRead(request, bytes_read);
57}
58
[email protected]31b2e5f2011-04-20 16:58:3259void NetworkDelegate::NotifyBeforeRedirect(URLRequest* request,
60 const GURL& new_location) {
61 DCHECK(CalledOnValidThread());
62 DCHECK(request);
63 OnBeforeRedirect(request, new_location);
64}
65
[email protected]48944382011-04-23 13:28:1666void NetworkDelegate::NotifyCompleted(URLRequest* request) {
[email protected]0651b812011-02-24 00:22:5067 DCHECK(CalledOnValidThread());
68 DCHECK(request);
[email protected]48944382011-04-23 13:28:1669 OnCompleted(request);
[email protected]0651b812011-02-24 00:22:5070}
71
[email protected]4875ba12011-03-30 22:31:5172void NetworkDelegate::NotifyURLRequestDestroyed(URLRequest* request) {
[email protected]5aa20132011-04-27 23:11:3473 DCHECK(CalledOnValidThread());
[email protected]4875ba12011-03-30 22:31:5174 DCHECK(request);
[email protected]5aa20132011-04-27 23:11:3475 OnURLRequestDestroyed(request);
76}
77
[email protected]82a37672011-05-03 12:02:4178void NetworkDelegate::NotifyPACScriptError(int line_number,
79 const string16& error) {
80 DCHECK(CalledOnValidThread());
81 OnPACScriptError(line_number, error);
82}
83
[email protected]c2911d72011-10-03 22:16:3684NetworkDelegate::AuthRequiredResponse NetworkDelegate::NotifyAuthRequired(
85 URLRequest* request,
86 const AuthChallengeInfo& auth_info,
87 const AuthCallback& callback,
88 AuthCredentials* credentials) {
[email protected]7efc582d2011-08-03 20:46:3589 DCHECK(CalledOnValidThread());
[email protected]c2911d72011-10-03 22:16:3690 return OnAuthRequired(request, auth_info, callback, credentials);
[email protected]7efc582d2011-08-03 20:46:3591}
92
[email protected]0651b812011-02-24 00:22:5093} // namespace net