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 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 18 matching lines...) Expand all Loading... |
29 // It also acts as SocketStream::Delegate so that it sends | 29 // It also acts as SocketStream::Delegate so that it sends |
30 // ViewMsg_SocketStream_* messages back to renderer. | 30 // ViewMsg_SocketStream_* messages back to renderer. |
31 class SocketStreamDispatcherHost : public content::BrowserMessageFilter, | 31 class SocketStreamDispatcherHost : public content::BrowserMessageFilter, |
32 public net::SocketStream::Delegate, | 32 public net::SocketStream::Delegate, |
33 public SSLErrorHandler::Delegate { | 33 public SSLErrorHandler::Delegate { |
34 public: | 34 public: |
35 SocketStreamDispatcherHost( | 35 SocketStreamDispatcherHost( |
36 int render_process_id, | 36 int render_process_id, |
37 ResourceMessageFilter::URLRequestContextSelector* selector, | 37 ResourceMessageFilter::URLRequestContextSelector* selector, |
38 content::ResourceContext* resource_context); | 38 content::ResourceContext* resource_context); |
39 virtual ~SocketStreamDispatcherHost(); | |
40 | 39 |
41 // content::BrowserMessageFilter: | 40 // content::BrowserMessageFilter: |
42 virtual bool OnMessageReceived(const IPC::Message& message, | 41 virtual bool OnMessageReceived(const IPC::Message& message, |
43 bool* message_was_ok) OVERRIDE; | 42 bool* message_was_ok) OVERRIDE; |
44 | 43 |
45 // The object died, so cancel and detach all requests associated with it. | 44 // The object died, so cancel and detach all requests associated with it. |
46 void CancelRequestsForProcess(int host_id); | 45 void CancelRequestsForProcess(int host_id); |
47 | 46 |
48 // SocketStream::Delegate: | 47 // SocketStream::Delegate: |
49 virtual void OnConnected(net::SocketStream* socket, | 48 virtual void OnConnected(net::SocketStream* socket, |
(...skipping 11 matching lines...) Expand all Loading... |
61 const GURL& url, | 60 const GURL& url, |
62 const std::string& cookie_line, | 61 const std::string& cookie_line, |
63 net::CookieOptions* options) OVERRIDE; | 62 net::CookieOptions* options) OVERRIDE; |
64 | 63 |
65 // SSLErrorHandler::Delegate methods: | 64 // SSLErrorHandler::Delegate methods: |
66 virtual void CancelSSLRequest(const content::GlobalRequestID& id, | 65 virtual void CancelSSLRequest(const content::GlobalRequestID& id, |
67 int error, | 66 int error, |
68 const net::SSLInfo* ssl_info) OVERRIDE; | 67 const net::SSLInfo* ssl_info) OVERRIDE; |
69 virtual void ContinueSSLRequest(const content::GlobalRequestID& id) OVERRIDE; | 68 virtual void ContinueSSLRequest(const content::GlobalRequestID& id) OVERRIDE; |
70 | 69 |
| 70 protected: |
| 71 virtual ~SocketStreamDispatcherHost(); |
| 72 |
71 private: | 73 private: |
72 // Message handlers called by OnMessageReceived. | 74 // Message handlers called by OnMessageReceived. |
73 void OnConnect(int render_view_id, const GURL& url, int socket_id); | 75 void OnConnect(int render_view_id, const GURL& url, int socket_id); |
74 void OnSendData(int socket_id, const std::vector<char>& data); | 76 void OnSendData(int socket_id, const std::vector<char>& data); |
75 void OnCloseReq(int socket_id); | 77 void OnCloseReq(int socket_id); |
76 | 78 |
77 void DeleteSocketStreamHost(int socket_id); | 79 void DeleteSocketStreamHost(int socket_id); |
78 | 80 |
79 net::URLRequestContext* GetURLRequestContext(); | 81 net::URLRequestContext* GetURLRequestContext(); |
80 | 82 |
81 IDMap<SocketStreamHost> hosts_; | 83 IDMap<SocketStreamHost> hosts_; |
82 int render_process_id_; | 84 int render_process_id_; |
83 const scoped_ptr<ResourceMessageFilter::URLRequestContextSelector> | 85 const scoped_ptr<ResourceMessageFilter::URLRequestContextSelector> |
84 url_request_context_selector_; | 86 url_request_context_selector_; |
85 content::ResourceContext* resource_context_; | 87 content::ResourceContext* resource_context_; |
86 | 88 |
87 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcherHost); | 89 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcherHost); |
88 }; | 90 }; |
89 | 91 |
90 #endif // CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_ | 92 #endif // CONTENT_BROWSER_RENDERER_HOST_SOCKET_STREAM_DISPATCHER_HOST_H_ |
OLD | NEW |