OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/sequence_checker.h" |
13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
14 #include "base/threading/non_thread_safe.h" | |
15 #include "net/base/auth.h" | 15 #include "net/base/auth.h" |
16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
17 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
18 #include "net/cookies/canonical_cookie.h" | 18 #include "net/cookies/canonical_cookie.h" |
19 #include "net/proxy/proxy_retry_info.h" | 19 #include "net/proxy/proxy_retry_info.h" |
20 | 20 |
21 class GURL; | 21 class GURL; |
22 | 22 |
23 namespace base { | 23 namespace base { |
24 class FilePath; | 24 class FilePath; |
(...skipping 14 matching lines...) Expand all Loading... |
39 // | 39 // |
40 // NOTE: It is not okay to add any compile-time dependencies on symbols outside | 40 // NOTE: It is not okay to add any compile-time dependencies on symbols outside |
41 // of net/base here, because we have a net_base library. Forward declarations | 41 // of net/base here, because we have a net_base library. Forward declarations |
42 // are ok. | 42 // are ok. |
43 class CookieOptions; | 43 class CookieOptions; |
44 class HttpRequestHeaders; | 44 class HttpRequestHeaders; |
45 class HttpResponseHeaders; | 45 class HttpResponseHeaders; |
46 class ProxyInfo; | 46 class ProxyInfo; |
47 class URLRequest; | 47 class URLRequest; |
48 | 48 |
49 class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { | 49 class NET_EXPORT NetworkDelegate { |
50 public: | 50 public: |
51 // AuthRequiredResponse indicates how a NetworkDelegate handles an | 51 // AuthRequiredResponse indicates how a NetworkDelegate handles an |
52 // OnAuthRequired call. It's placed in this file to prevent url_request.h | 52 // OnAuthRequired call. It's placed in this file to prevent url_request.h |
53 // from having to include network_delegate.h. | 53 // from having to include network_delegate.h. |
54 enum AuthRequiredResponse { | 54 enum AuthRequiredResponse { |
55 AUTH_REQUIRED_RESPONSE_NO_ACTION, | 55 AUTH_REQUIRED_RESPONSE_NO_ACTION, |
56 AUTH_REQUIRED_RESPONSE_SET_AUTH, | 56 AUTH_REQUIRED_RESPONSE_SET_AUTH, |
57 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, | 57 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, |
58 AUTH_REQUIRED_RESPONSE_IO_PENDING, | 58 AUTH_REQUIRED_RESPONSE_IO_PENDING, |
59 }; | 59 }; |
60 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback; | 60 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback; |
61 | 61 |
62 virtual ~NetworkDelegate() {} | 62 virtual ~NetworkDelegate(); |
63 | 63 |
64 // Notification interface called by the network stack. Note that these | 64 // Notification interface called by the network stack. Note that these |
65 // functions mostly forward to the private virtuals. They also add some sanity | 65 // functions mostly forward to the private virtuals. They also add some sanity |
66 // checking on parameters. See the corresponding virtuals for explanations of | 66 // checking on parameters. See the corresponding virtuals for explanations of |
67 // the methods and their arguments. | 67 // the methods and their arguments. |
68 int NotifyBeforeURLRequest(URLRequest* request, | 68 int NotifyBeforeURLRequest(URLRequest* request, |
69 const CompletionCallback& callback, | 69 const CompletionCallback& callback, |
70 GURL* new_url); | 70 GURL* new_url); |
71 int NotifyBeforeStartTransaction(URLRequest* request, | 71 int NotifyBeforeStartTransaction(URLRequest* request, |
72 const CompletionCallback& callback, | 72 const CompletionCallback& callback, |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 306 |
307 virtual bool OnCanQueueReportingReport(const url::Origin& origin) const = 0; | 307 virtual bool OnCanQueueReportingReport(const url::Origin& origin) const = 0; |
308 | 308 |
309 virtual bool OnCanSendReportingReport(const url::Origin& origin) const = 0; | 309 virtual bool OnCanSendReportingReport(const url::Origin& origin) const = 0; |
310 | 310 |
311 virtual bool OnCanSetReportingClient(const url::Origin& origin, | 311 virtual bool OnCanSetReportingClient(const url::Origin& origin, |
312 const GURL& endpoint) const = 0; | 312 const GURL& endpoint) const = 0; |
313 | 313 |
314 virtual bool OnCanUseReportingClient(const url::Origin& origin, | 314 virtual bool OnCanUseReportingClient(const url::Origin& origin, |
315 const GURL& endpoint) const = 0; | 315 const GURL& endpoint) const = 0; |
| 316 |
| 317 SEQUENCE_CHECKER(sequence_checker_); |
316 }; | 318 }; |
317 | 319 |
318 } // namespace net | 320 } // namespace net |
319 | 321 |
320 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 322 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
OLD | NEW |