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_DEBUGGER_DEVTOOLS_HTTP_HANDLER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DEBUGGER_DEVTOOLS_HTTP_HANDLER_IMPL_H_ |
6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_HTTP_HANDLER_IMPL_H_ | 6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_HTTP_HANDLER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const std::string& frontend_url, | 46 const std::string& frontend_url, |
47 net::URLRequestContextGetter* request_context_getter, | 47 net::URLRequestContextGetter* request_context_getter, |
48 DevToolsHttpHandlerDelegate* delegate); | 48 DevToolsHttpHandlerDelegate* delegate); |
49 virtual ~DevToolsHttpHandlerImpl(); | 49 virtual ~DevToolsHttpHandlerImpl(); |
50 void Start(); | 50 void Start(); |
51 | 51 |
52 // DevToolsHttpHandler implementation. | 52 // DevToolsHttpHandler implementation. |
53 virtual void Stop() OVERRIDE; | 53 virtual void Stop() OVERRIDE; |
54 virtual void SetRenderViewHostBinding( | 54 virtual void SetRenderViewHostBinding( |
55 RenderViewHostBinding* binding) OVERRIDE; | 55 RenderViewHostBinding* binding) OVERRIDE; |
| 56 virtual GURL GetFrontendURL(RenderViewHost* render_view_host) OVERRIDE; |
56 | 57 |
57 // net::HttpServer::Delegate implementation. | 58 // net::HttpServer::Delegate implementation. |
58 virtual void OnHttpRequest(int connection_id, | 59 virtual void OnHttpRequest(int connection_id, |
59 const net::HttpServerRequestInfo& info) OVERRIDE; | 60 const net::HttpServerRequestInfo& info) OVERRIDE; |
60 virtual void OnWebSocketRequest( | 61 virtual void OnWebSocketRequest( |
61 int connection_id, | 62 int connection_id, |
62 const net::HttpServerRequestInfo& info) OVERRIDE; | 63 const net::HttpServerRequestInfo& info) OVERRIDE; |
63 virtual void OnWebSocketMessage(int connection_id, | 64 virtual void OnWebSocketMessage(int connection_id, |
64 const std::string& data) OVERRIDE; | 65 const std::string& data) OVERRIDE; |
65 virtual void OnClose(int connection_id) OVERRIDE; | 66 virtual void OnClose(int connection_id) OVERRIDE; |
66 | 67 |
67 PageList GeneratePageList(); | 68 void OnJsonRequestUI(int connection_id, |
68 | 69 const net::HttpServerRequestInfo& info); |
69 virtual void OnJsonRequestUI(int connection_id, | 70 void OnWebSocketRequestUI(int connection_id, |
70 const net::HttpServerRequestInfo& info); | 71 const net::HttpServerRequestInfo& info); |
71 virtual void OnWebSocketRequestUI(int connection_id, | 72 void OnWebSocketMessageUI(int connection_id, const std::string& data); |
72 const net::HttpServerRequestInfo& info); | 73 void OnCloseUI(int connection_id); |
73 virtual void OnWebSocketMessageUI(int connection_id, | |
74 const std::string& data); | |
75 virtual void OnCloseUI(int connection_id); | |
76 | 74 |
77 // net::URLRequest::Delegate implementation. | 75 // net::URLRequest::Delegate implementation. |
78 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; | 76 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; |
79 virtual void OnReadCompleted(net::URLRequest* request, | 77 virtual void OnReadCompleted(net::URLRequest* request, |
80 int bytes_read) OVERRIDE; | 78 int bytes_read) OVERRIDE; |
81 | 79 |
82 void Init(); | 80 void Init(); |
83 void TeardownAndRelease(); | 81 void TeardownAndRelease(); |
84 void Bind(net::URLRequest* request, int connection_id); | 82 void Bind(net::URLRequest* request, int connection_id); |
85 void RequestCompleted(net::URLRequest* request); | 83 void RequestCompleted(net::URLRequest* request); |
86 | 84 |
87 void Send200(int connection_id, | 85 void Send200(int connection_id, |
88 const std::string& data, | 86 const std::string& data, |
89 const std::string& mime_type = "text/html"); | 87 const std::string& mime_type = "text/html"); |
90 void Send404(int connection_id); | 88 void Send404(int connection_id); |
91 void Send500(int connection_id, | 89 void Send500(int connection_id, |
92 const std::string& message); | 90 const std::string& message); |
93 void AcceptWebSocket(int connection_id, | 91 void AcceptWebSocket(int connection_id, |
94 const net::HttpServerRequestInfo& request); | 92 const net::HttpServerRequestInfo& request); |
95 | 93 |
| 94 PageList GeneratePageList(); |
| 95 |
| 96 // Returns the front end url without the host at the beginning. |
| 97 std::string GetFrontendURLInternal(const std::string rvh_id, |
| 98 const std::string& host); |
| 99 |
96 std::string overridden_frontend_url_; | 100 std::string overridden_frontend_url_; |
97 scoped_ptr<const net::StreamListenSocketFactory> socket_factory_; | 101 scoped_ptr<const net::StreamListenSocketFactory> socket_factory_; |
98 scoped_refptr<net::HttpServer> server_; | 102 scoped_refptr<net::HttpServer> server_; |
99 typedef std::map<net::URLRequest*, int> | 103 typedef std::map<net::URLRequest*, int> |
100 RequestToSocketMap; | 104 RequestToSocketMap; |
101 RequestToSocketMap request_to_connection_io_; | 105 RequestToSocketMap request_to_connection_io_; |
102 typedef std::map<int, std::set<net::URLRequest*> > | 106 typedef std::map<int, std::set<net::URLRequest*> > |
103 ConnectionToRequestsMap; | 107 ConnectionToRequestsMap; |
104 ConnectionToRequestsMap connection_to_requests_io_; | 108 ConnectionToRequestsMap connection_to_requests_io_; |
105 typedef std::map<net::URLRequest*, scoped_refptr<net::IOBuffer> > | 109 typedef std::map<net::URLRequest*, scoped_refptr<net::IOBuffer> > |
106 BuffersMap; | 110 BuffersMap; |
107 BuffersMap request_to_buffer_io_; | 111 BuffersMap request_to_buffer_io_; |
108 typedef std::map<int, content::DevToolsClientHost*> | 112 typedef std::map<int, content::DevToolsClientHost*> |
109 ConnectionToClientHostMap; | 113 ConnectionToClientHostMap; |
110 ConnectionToClientHostMap connection_to_client_host_ui_; | 114 ConnectionToClientHostMap connection_to_client_host_ui_; |
111 net::URLRequestContextGetter* request_context_getter_; | 115 net::URLRequestContextGetter* request_context_getter_; |
112 scoped_ptr<DevToolsHttpHandlerDelegate> delegate_; | 116 scoped_ptr<DevToolsHttpHandlerDelegate> delegate_; |
113 RenderViewHostBinding* binding_; | 117 RenderViewHostBinding* binding_; |
114 scoped_ptr<RenderViewHostBinding> default_binding_; | 118 scoped_ptr<RenderViewHostBinding> default_binding_; |
115 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpHandlerImpl); | 119 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpHandlerImpl); |
116 }; | 120 }; |
117 | 121 |
118 } // namespace content | 122 } // namespace content |
119 | 123 |
120 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_HTTP_HANDLER_IMPL_H_ | 124 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_HTTP_HANDLER_IMPL_H_ |
OLD | NEW |