| 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 |
| 11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
| 12 #include "content/browser/browser_message_filter.h" | |
| 13 #include "content/browser/renderer_host/resource_message_filter.h" | 12 #include "content/browser/renderer_host/resource_message_filter.h" |
| 13 #include "content/public/browser/browser_message_filter.h" |
| 14 #include "net/socket_stream/socket_stream.h" | 14 #include "net/socket_stream/socket_stream.h" |
| 15 | 15 |
| 16 class GURL; | 16 class GURL; |
| 17 class SocketStreamHost; | 17 class SocketStreamHost; |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class ResourceContext; | 20 class ResourceContext; |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Dispatches ViewHostMsg_SocketStream_* messages sent from renderer. | 23 // Dispatches ViewHostMsg_SocketStream_* messages sent from renderer. |
| 24 // It also acts as SocketStream::Delegate so that it sends | 24 // It also acts as SocketStream::Delegate so that it sends |
| 25 // ViewMsg_SocketStream_* messages back to renderer. | 25 // ViewMsg_SocketStream_* messages back to renderer. |
| 26 class SocketStreamDispatcherHost : public BrowserMessageFilter, | 26 class SocketStreamDispatcherHost : public content::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 // content::BrowserMessageFilter methods. |
| 35 virtual bool OnMessageReceived(const IPC::Message& message, | 35 virtual bool OnMessageReceived(const IPC::Message& message, |
| 36 bool* message_was_ok) OVERRIDE; | 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) OVERRIDE; | 43 int max_pending_send_allowed) OVERRIDE; |
| 44 virtual void OnSentData(net::SocketStream* socket, int amount_sent) OVERRIDE; | 44 virtual void OnSentData(net::SocketStream* socket, int amount_sent) OVERRIDE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 64 | 64 |
| 65 IDMap<SocketStreamHost> hosts_; | 65 IDMap<SocketStreamHost> hosts_; |
| 66 const scoped_ptr<ResourceMessageFilter::URLRequestContextSelector> | 66 const scoped_ptr<ResourceMessageFilter::URLRequestContextSelector> |
| 67 url_request_context_selector_; | 67 url_request_context_selector_; |
| 68 const content::ResourceContext* resource_context_; | 68 const content::ResourceContext* resource_context_; |
| 69 | 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcherHost); | 70 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcherHost); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 #endif // CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_ | 73 #endif // CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_ |
| OLD | NEW |