| OLD | NEW |
| 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 CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class SocketStreamDispatcherHost : public BrowserMessageFilter, | 26 class SocketStreamDispatcherHost : public BrowserMessageFilter, |
| 27 public net::SocketStream::Delegate { | 27 public net::SocketStream::Delegate { |
| 28 public: | 28 public: |
| 29 SocketStreamDispatcherHost( | 29 SocketStreamDispatcherHost( |
| 30 ResourceMessageFilter::URLRequestContextSelector* selector, | 30 ResourceMessageFilter::URLRequestContextSelector* selector, |
| 31 const content::ResourceContext* resource_context); | 31 const content::ResourceContext* resource_context); |
| 32 virtual ~SocketStreamDispatcherHost(); | 32 virtual ~SocketStreamDispatcherHost(); |
| 33 | 33 |
| 34 // BrowserMessageFilter methods. | 34 // BrowserMessageFilter methods. |
| 35 virtual bool OnMessageReceived(const IPC::Message& message, | 35 virtual bool OnMessageReceived(const IPC::Message& message, |
| 36 bool* message_was_ok); | 36 bool* message_was_ok) OVERRIDE; |
| 37 | 37 |
| 38 // The object died, so cancel and detach all requests associated with it. | 38 // The object died, so cancel and detach all requests associated with it. |
| 39 void CancelRequestsForProcess(int host_id); | 39 void CancelRequestsForProcess(int host_id); |
| 40 | 40 |
| 41 // SocketStream::Delegate methods. | 41 // SocketStream::Delegate methods. |
| 42 virtual void OnConnected(net::SocketStream* socket, | 42 virtual void OnConnected(net::SocketStream* socket, |
| 43 int max_pending_send_allowed); | 43 int max_pending_send_allowed) OVERRIDE; |
| 44 virtual void OnSentData(net::SocketStream* socket, int amount_sent); | 44 virtual void OnSentData(net::SocketStream* socket, int amount_sent) OVERRIDE; |
| 45 virtual void OnReceivedData(net::SocketStream* socket, | 45 virtual void OnReceivedData(net::SocketStream* socket, |
| 46 const char* data, int len); | 46 const char* data, int len) OVERRIDE; |
| 47 virtual void OnClose(net::SocketStream* socket); | 47 virtual void OnClose(net::SocketStream* socket) OVERRIDE; |
| 48 virtual bool CanGetCookies(net::SocketStream* socket, const GURL& url); | 48 virtual bool CanGetCookies(net::SocketStream* socket, |
| 49 const GURL& url) OVERRIDE; |
| 49 virtual bool CanSetCookie(net::SocketStream* request, | 50 virtual bool CanSetCookie(net::SocketStream* request, |
| 50 const GURL& url, | 51 const GURL& url, |
| 51 const std::string& cookie_line, | 52 const std::string& cookie_line, |
| 52 net::CookieOptions* options); | 53 net::CookieOptions* options) OVERRIDE; |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 // Message handlers called by OnMessageReceived. | 56 // Message handlers called by OnMessageReceived. |
| 56 void OnConnect(const GURL& url, int socket_id); | 57 void OnConnect(const GURL& url, int socket_id); |
| 57 void OnSendData(int socket_id, const std::vector<char>& data); | 58 void OnSendData(int socket_id, const std::vector<char>& data); |
| 58 void OnCloseReq(int socket_id); | 59 void OnCloseReq(int socket_id); |
| 59 | 60 |
| 60 void DeleteSocketStreamHost(int socket_id); | 61 void DeleteSocketStreamHost(int socket_id); |
| 61 | 62 |
| 62 net::URLRequestContext* GetURLRequestContext(); | 63 net::URLRequestContext* GetURLRequestContext(); |
| 63 | 64 |
| 64 IDMap<SocketStreamHost> hosts_; | 65 IDMap<SocketStreamHost> hosts_; |
| 65 const scoped_ptr<ResourceMessageFilter::URLRequestContextSelector> | 66 const scoped_ptr<ResourceMessageFilter::URLRequestContextSelector> |
| 66 url_request_context_selector_; | 67 url_request_context_selector_; |
| 67 const content::ResourceContext* resource_context_; | 68 const content::ResourceContext* resource_context_; |
| 68 | 69 |
| 69 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcherHost); | 70 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcherHost); |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 #endif // CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_ | 73 #endif // CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_ |
| OLD | NEW |