blob: ecb9a0108096af40c39c8e203ca17e242198be1e [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]4875ba12011-03-30 22:31:5111int NetworkDelegate::NotifyBeforeURLRequest(URLRequest* request,
[email protected]4c76d7c2011-04-15 19:14:1212 CompletionCallback* callback,
13 GURL* new_url) {
[email protected]0651b812011-02-24 00:22:5014 DCHECK(CalledOnValidThread());
15 DCHECK(request);
[email protected]05cc4e72011-03-08 21:29:4816 DCHECK(callback);
[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]636eccd2011-06-28 12:28:0120int NetworkDelegate::NotifyBeforeSendHeaders(URLRequest* request,
[email protected]4c76d7c2011-04-15 19:14:1221 CompletionCallback* callback,
22 HttpRequestHeaders* headers) {
[email protected]0651b812011-02-24 00:22:5023 DCHECK(CalledOnValidThread());
24 DCHECK(headers);
[email protected]4875ba12011-03-30 22:31:5125 DCHECK(callback);
[email protected]636eccd2011-06-28 12:28:0126 return OnBeforeSendHeaders(request, callback, headers);
[email protected]0651b812011-02-24 00:22:5027}
28
[email protected]82b42302011-04-20 16:28:1629void NetworkDelegate::NotifyRequestSent(
30 uint64 request_id,
[email protected]783573b2011-05-13 11:05:1531 const HostPortPair& socket_address,
32 const HttpRequestHeaders& headers) {
[email protected]82b42302011-04-20 16:28:1633 DCHECK(CalledOnValidThread());
[email protected]783573b2011-05-13 11:05:1534 OnRequestSent(request_id, socket_address, headers);
[email protected]82b42302011-04-20 16:28:1635}
36
[email protected]0651b812011-02-24 00:22:5037void NetworkDelegate::NotifyResponseStarted(URLRequest* request) {
38 DCHECK(CalledOnValidThread());
39 DCHECK(request);
40 OnResponseStarted(request);
41}
42
[email protected]8523ba52011-05-22 19:00:5843void NetworkDelegate::NotifyRawBytesRead(const URLRequest& request,
44 int bytes_read) {
45 DCHECK(CalledOnValidThread());
46 OnRawBytesRead(request, bytes_read);
47}
48
[email protected]31b2e5f2011-04-20 16:58:3249void NetworkDelegate::NotifyBeforeRedirect(URLRequest* request,
50 const GURL& new_location) {
51 DCHECK(CalledOnValidThread());
52 DCHECK(request);
53 OnBeforeRedirect(request, new_location);
54}
55
[email protected]48944382011-04-23 13:28:1656void NetworkDelegate::NotifyCompleted(URLRequest* request) {
[email protected]0651b812011-02-24 00:22:5057 DCHECK(CalledOnValidThread());
58 DCHECK(request);
[email protected]48944382011-04-23 13:28:1659 OnCompleted(request);
[email protected]0651b812011-02-24 00:22:5060}
61
[email protected]4875ba12011-03-30 22:31:5162void NetworkDelegate::NotifyURLRequestDestroyed(URLRequest* request) {
[email protected]5aa20132011-04-27 23:11:3463 DCHECK(CalledOnValidThread());
[email protected]4875ba12011-03-30 22:31:5164 DCHECK(request);
[email protected]5aa20132011-04-27 23:11:3465 OnURLRequestDestroyed(request);
66}
67
68void NetworkDelegate::NotifyHttpTransactionDestroyed(uint64 request_id) {
69 DCHECK(CalledOnValidThread());
70 OnHttpTransactionDestroyed(request_id);
[email protected]4875ba12011-03-30 22:31:5171}
72
[email protected]82a37672011-05-03 12:02:4173void NetworkDelegate::NotifyPACScriptError(int line_number,
74 const string16& error) {
75 DCHECK(CalledOnValidThread());
76 OnPACScriptError(line_number, error);
77}
78
[email protected]0651b812011-02-24 00:22:5079} // namespace net