Index: mojo/services/network/url_loader_impl.h |
diff --git a/mojo/services/network/url_loader_impl.h b/mojo/services/network/url_loader_impl.h |
index 54d7f2af302b64835eacf226ecb074ae09cbdafd..40d087dffbf8e29deb6dbb4c43537db8d4860657 100644 |
--- a/mojo/services/network/url_loader_impl.h |
+++ b/mojo/services/network/url_loader_impl.h |
@@ -8,6 +8,8 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
#include "mojo/common/handle_watcher.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
+#include "mojo/public/cpp/bindings/error_handler.h" |
#include "mojo/public/cpp/bindings/interface_impl.h" |
#include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
#include "net/base/net_errors.h" |
@@ -18,11 +20,12 @@ namespace mojo { |
class NetworkContext; |
class NetToMojoPendingBuffer; |
-class URLLoaderImpl : public InterfaceImpl<URLLoader>, |
+class URLLoaderImpl : public URLLoader, |
+ public ErrorHandler, |
public net::URLRequest::Delegate { |
public: |
- explicit URLLoaderImpl(NetworkContext* context); |
- ~URLLoaderImpl() override; |
+ URLLoaderImpl(NetworkContext* context, InterfaceRequest<URLLoader> request); |
+ ~URLLoaderImpl(); |
private: |
// URLLoader methods: |
@@ -31,6 +34,9 @@ class URLLoaderImpl : public InterfaceImpl<URLLoader>, |
void FollowRedirect(const Callback<void(URLResponsePtr)>& callback) override; |
void QueryStatus(const Callback<void(URLLoaderStatusPtr)>& callback) override; |
+ // ErrorHandler methods: |
+ void OnConnectionError() override; |
+ |
// net::URLRequest::Delegate methods: |
void OnReceivedRedirect(net::URLRequest* url_request, |
const net::RedirectInfo& redirect_info, |
@@ -43,8 +49,11 @@ class URLLoaderImpl : public InterfaceImpl<URLLoader>, |
const Callback<void(URLResponsePtr)>& callback); |
void SendResponse(URLResponsePtr response); |
void OnResponseBodyStreamReady(MojoResult result); |
+ void OnResponseBodyStreamClosed(MojoResult result); |
void ReadMore(); |
void DidRead(uint32_t num_bytes, bool completed_synchronously); |
+ void ListenForPeerClosed(); |
+ void DeleteIfNeeded(); |
NetworkContext* context_; |
scoped_ptr<net::URLRequest> url_request_; |
@@ -54,6 +63,8 @@ class URLLoaderImpl : public InterfaceImpl<URLLoader>, |
common::HandleWatcher handle_watcher_; |
uint32 response_body_buffer_size_; |
bool auto_follow_redirects_; |
+ bool connected_; |
+ Binding<URLLoader> binding_; |
base::WeakPtrFactory<URLLoaderImpl> weak_ptr_factory_; |
}; |