Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: net/base/network_delegate.h

Issue 6698009: Add request_id to HttpRequestInfo and pass it to the NetworkDelegate for events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delegate callbcak Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_NETWORK_DELEGATE_H_ 5 #ifndef NET_BASE_NETWORK_DELEGATE_H_
6 #define NET_BASE_NETWORK_DELEGATE_H_ 6 #define NET_BASE_NETWORK_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/threading/non_thread_safe.h" 9 #include "base/threading/non_thread_safe.h"
10 #include "net/base/completion_callback.h" 10 #include "net/base/completion_callback.h"
(...skipping 16 matching lines...) Expand all
27 27
28 class NetworkDelegate : public base::NonThreadSafe { 28 class NetworkDelegate : public base::NonThreadSafe {
29 public: 29 public:
30 virtual ~NetworkDelegate() {} 30 virtual ~NetworkDelegate() {}
31 31
32 // Notification interface called by the network stack. Note that these 32 // Notification interface called by the network stack. Note that these
33 // functions mostly forward to the private virtuals. They also add some sanity 33 // functions mostly forward to the private virtuals. They also add some sanity
34 // checking on parameters. 34 // checking on parameters.
35 bool NotifyBeforeURLRequest(URLRequest* request, 35 bool NotifyBeforeURLRequest(URLRequest* request,
36 CompletionCallback* callback); 36 CompletionCallback* callback);
37 void NotifySendHttpRequest(HttpRequestHeaders* headers); 37 bool NotifyBeforeSendHeaders(uint64 request_id,
38 HttpRequestHeaders* headers,
39 CompletionCallback* callback);
rvargas (doing something else) 2011/03/23 00:54:35 You should document the expected behavior of this
Matt Perry 2011/03/24 00:11:25 Done.
38 void NotifyResponseStarted(URLRequest* request); 40 void NotifyResponseStarted(URLRequest* request);
39 void NotifyReadCompleted(URLRequest* request, int bytes_read); 41 void NotifyReadCompleted(URLRequest* request, int bytes_read);
40 42
41 // Returns a URLRequestJob that will be used to handle the request if 43 // Returns a URLRequestJob that will be used to handle the request if
42 // non-null. 44 // non-null.
43 // TODO(koz): Currently this is called inside registered ProtocolFactories, 45 // TODO(koz): Currently this is called inside registered ProtocolFactories,
44 // so that we can perform Delegate-dependent request handling from the static 46 // so that we can perform Delegate-dependent request handling from the static
45 // factories, but ultimately it should be called directly from 47 // factories, but ultimately it should be called directly from
46 // URLRequestJobManager::CreateJob() as a general override mechanism. 48 // URLRequestJobManager::CreateJob() as a general override mechanism.
47 URLRequestJob* MaybeCreateURLRequestJob(URLRequest* request); 49 URLRequestJob* MaybeCreateURLRequestJob(URLRequest* request);
48 50
49 private: 51 private:
50 // This is the interface for subclasses of NetworkDelegate to implement. This 52 // This is the interface for subclasses of NetworkDelegate to implement. This
51 // member functions will be called by the respective public notification 53 // member functions will be called by the respective public notification
52 // member function, which will perform basic sanity checking. 54 // member function, which will perform basic sanity checking.
53 55
54 // Called before a request is sent. 56 // Called before a request is sent.
willchan no longer on Chromium 2011/03/22 23:05:35 I missed this earlier, these member functions shou
Matt Perry 2011/03/24 00:11:25 Done.
55 virtual bool OnBeforeURLRequest(URLRequest* request, 57 virtual bool OnBeforeURLRequest(URLRequest* request,
56 CompletionCallback* callback) = 0; 58 CompletionCallback* callback) = 0;
57 59
58 // Called right before the HTTP headers are sent. Allows the delegate to 60 // Called right before the HTTP headers are sent. Allows the delegate to
59 // read/write |headers| before they get sent out. 61 // read/write |headers| before they get sent out.
60 virtual void OnSendHttpRequest(HttpRequestHeaders* headers) = 0; 62 virtual bool OnBeforeSendHeaders(uint64 request_id,
63 HttpRequestHeaders* headers,
64 CompletionCallback* callback) = 0;
61 65
62 // This corresponds to URLRequestDelegate::OnResponseStarted. 66 // This corresponds to URLRequestDelegate::OnResponseStarted.
63 virtual void OnResponseStarted(URLRequest* request) = 0; 67 virtual void OnResponseStarted(URLRequest* request) = 0;
64 68
65 // This corresponds to URLRequestDelegate::OnReadCompleted. 69 // This corresponds to URLRequestDelegate::OnReadCompleted.
66 virtual void OnReadCompleted(URLRequest* request, int bytes_read) = 0; 70 virtual void OnReadCompleted(URLRequest* request, int bytes_read) = 0;
67 71
68 // Called before a request is sent and before a URLRequestJob is created to 72 // Called before a request is sent and before a URLRequestJob is created to
69 // handle the request. 73 // handle the request.
70 virtual URLRequestJob* OnMaybeCreateURLRequestJob(URLRequest* request) = 0; 74 virtual URLRequestJob* OnMaybeCreateURLRequestJob(URLRequest* request) = 0;
71 }; 75 };
72 76
73 } // namespace net 77 } // namespace net
74 78
75 #endif // NET_BASE_NETWORK_DELEGATE_H_ 79 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698