OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_SERVICES_NETWORK_URL_LOADER_IMPL_H_ | 5 #ifndef MOJO_SERVICES_NETWORK_URL_LOADER_IMPL_H_ |
6 #define MOJO_SERVICES_NETWORK_URL_LOADER_IMPL_H_ | 6 #define MOJO_SERVICES_NETWORK_URL_LOADER_IMPL_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 private: | 26 private: |
27 class PendingWriteToDataPipe; | 27 class PendingWriteToDataPipe; |
28 class DependentIOBuffer; | 28 class DependentIOBuffer; |
29 | 29 |
30 // InterfaceImpl<> methods: | 30 // InterfaceImpl<> methods: |
31 virtual void OnConnectionError() OVERRIDE; | 31 virtual void OnConnectionError() OVERRIDE; |
32 | 32 |
33 // URLLoader methods: | 33 // URLLoader methods: |
34 virtual void Start( | 34 virtual void Start( |
35 URLRequestPtr request, | 35 URLRequestPtr request, |
36 ScopedDataPipeProducerHandle response_body_stream) OVERRIDE; | 36 const Callback<void(URLResponsePtr)>& callback) OVERRIDE; |
37 virtual void FollowRedirect() OVERRIDE; | 37 virtual void FollowRedirect( |
| 38 const Callback<void(URLResponsePtr)>& callback) OVERRIDE; |
| 39 virtual void QueryStatus( |
| 40 const Callback<void(URLLoaderStatusPtr)>& callback) OVERRIDE; |
38 | 41 |
39 // net::URLRequest::Delegate methods: | 42 // net::URLRequest::Delegate methods: |
40 virtual void OnReceivedRedirect(net::URLRequest* url_request, | 43 virtual void OnReceivedRedirect(net::URLRequest* url_request, |
41 const GURL& new_url, | 44 const GURL& new_url, |
42 bool* defer_redirect) OVERRIDE; | 45 bool* defer_redirect) OVERRIDE; |
43 virtual void OnResponseStarted(net::URLRequest* url_request) OVERRIDE; | 46 virtual void OnResponseStarted(net::URLRequest* url_request) OVERRIDE; |
44 virtual void OnReadCompleted(net::URLRequest* url_request, int bytes_read) | 47 virtual void OnReadCompleted(net::URLRequest* url_request, int bytes_read) |
45 OVERRIDE; | 48 OVERRIDE; |
46 | 49 |
47 void SendError(int error); | 50 void SendError( |
| 51 int error, |
| 52 const Callback<void(URLResponsePtr)>& callback); |
| 53 void SendResponse(URLResponsePtr response); |
48 void OnResponseBodyStreamReady(MojoResult result); | 54 void OnResponseBodyStreamReady(MojoResult result); |
49 void WaitToReadMore(); | 55 void WaitToReadMore(); |
50 void ReadMore(); | 56 void ReadMore(); |
51 void DidRead(uint32_t num_bytes, bool completed_synchronously); | 57 void DidRead(uint32_t num_bytes, bool completed_synchronously); |
52 | 58 |
53 NetworkContext* context_; | 59 NetworkContext* context_; |
54 scoped_ptr<net::URLRequest> url_request_; | 60 scoped_ptr<net::URLRequest> url_request_; |
| 61 Callback<void(URLResponsePtr)> callback_; |
55 ScopedDataPipeProducerHandle response_body_stream_; | 62 ScopedDataPipeProducerHandle response_body_stream_; |
56 scoped_refptr<PendingWriteToDataPipe> pending_write_; | 63 scoped_refptr<PendingWriteToDataPipe> pending_write_; |
57 common::HandleWatcher handle_watcher_; | 64 common::HandleWatcher handle_watcher_; |
| 65 uint32 response_body_buffer_size_; |
58 bool auto_follow_redirects_; | 66 bool auto_follow_redirects_; |
59 | 67 |
60 base::WeakPtrFactory<URLLoaderImpl> weak_ptr_factory_; | 68 base::WeakPtrFactory<URLLoaderImpl> weak_ptr_factory_; |
61 }; | 69 }; |
62 | 70 |
63 } // namespace mojo | 71 } // namespace mojo |
64 | 72 |
65 #endif // MOJO_SERVICES_NETWORK_URL_LOADER_IMPL_H_ | 73 #endif // MOJO_SERVICES_NETWORK_URL_LOADER_IMPL_H_ |
OLD | NEW |