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 #include "content/browser/debugger/devtools_http_protocol_handler.h" | 5 #include "content/browser/debugger/devtools_http_protocol_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 BrowserThread::UI, | 131 BrowserThread::UI, |
132 FROM_HERE, | 132 FROM_HERE, |
133 NewRunnableMethod(this, | 133 NewRunnableMethod(this, |
134 &DevToolsHttpProtocolHandler::OnJsonRequestUI, | 134 &DevToolsHttpProtocolHandler::OnJsonRequestUI, |
135 connection_id, | 135 connection_id, |
136 info)); | 136 info)); |
137 return; | 137 return; |
138 } | 138 } |
139 | 139 |
140 // Proxy static files from chrome-devtools://devtools/*. | 140 // Proxy static files from chrome-devtools://devtools/*. |
141 if (!Profile::GetDefaultRequestContext()) { | 141 if (!Profile::Deprecated::GetDefaultRequestContext()) { |
142 server_->Send404(connection_id); | 142 server_->Send404(connection_id); |
143 return; | 143 return; |
144 } | 144 } |
145 | 145 |
146 if (info.path == "" || info.path == "/") { | 146 if (info.path == "" || info.path == "/") { |
147 const base::StringPiece frontend_html( | 147 const base::StringPiece frontend_html( |
148 ResourceBundle::GetSharedInstance().GetRawDataResource( | 148 ResourceBundle::GetSharedInstance().GetRawDataResource( |
149 IDR_DEVTOOLS_FRONTEND_HTML)); | 149 IDR_DEVTOOLS_FRONTEND_HTML)); |
150 std::string response(frontend_html.data(), frontend_html.length()); | 150 std::string response(frontend_html.data(), frontend_html.length()); |
151 server_->Send200(connection_id, response, "text/html; charset=UTF-8"); | 151 server_->Send200(connection_id, response, "text/html; charset=UTF-8"); |
152 return; | 152 return; |
153 } | 153 } |
154 | 154 |
155 net::URLRequest* request; | 155 net::URLRequest* request; |
156 | 156 |
157 if (info.path.find("/devtools/") == 0) { | 157 if (info.path.find("/devtools/") == 0) { |
158 request = new net::URLRequest(GURL("chrome-devtools:/" + info.path), this); | 158 request = new net::URLRequest(GURL("chrome-devtools:/" + info.path), this); |
159 } else if (info.path.find("/thumb/") == 0) { | 159 } else if (info.path.find("/thumb/") == 0) { |
160 request = new net::URLRequest(GURL("chrome:/" + info.path), this); | 160 request = new net::URLRequest(GURL("chrome:/" + info.path), this); |
161 } else { | 161 } else { |
162 server_->Send404(connection_id); | 162 server_->Send404(connection_id); |
163 return; | 163 return; |
164 } | 164 } |
165 | 165 |
166 // Make sure DevTools data source is registered. | 166 // Make sure DevTools data source is registered. |
167 DevToolsUI::RegisterDevToolsDataSource(); | 167 DevToolsUI::RegisterDevToolsDataSource(); |
168 Bind(request, connection_id); | 168 Bind(request, connection_id); |
169 request->set_context( | 169 request->set_context( |
170 Profile::GetDefaultRequestContext()->GetURLRequestContext()); | 170 Profile::Deprecated::GetDefaultRequestContext()->GetURLRequestContext()); |
171 request->Start(); | 171 request->Start(); |
172 } | 172 } |
173 | 173 |
174 void DevToolsHttpProtocolHandler::OnWebSocketRequest( | 174 void DevToolsHttpProtocolHandler::OnWebSocketRequest( |
175 int connection_id, | 175 int connection_id, |
176 const net::HttpServerRequestInfo& request) { | 176 const net::HttpServerRequestInfo& request) { |
177 BrowserThread::PostTask( | 177 BrowserThread::PostTask( |
178 BrowserThread::UI, | 178 BrowserThread::UI, |
179 FROM_HERE, | 179 FROM_HERE, |
180 NewRunnableMethod( | 180 NewRunnableMethod( |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 tab_contents_provider_->GetInspectableTabs(); | 522 tab_contents_provider_->GetInspectableTabs(); |
523 | 523 |
524 for (InspectableTabs::iterator it = inspectable_tabs.begin(); | 524 for (InspectableTabs::iterator it = inspectable_tabs.begin(); |
525 it != inspectable_tabs.end(); ++it) { | 525 it != inspectable_tabs.end(); ++it) { |
526 TabContentsWrapper* tab = *it; | 526 TabContentsWrapper* tab = *it; |
527 if (tab->restore_tab_helper()->session_id().id() == session_id) | 527 if (tab->restore_tab_helper()->session_id().id() == session_id) |
528 return tab->tab_contents(); | 528 return tab->tab_contents(); |
529 } | 529 } |
530 return NULL; | 530 return NULL; |
531 } | 531 } |
OLD | NEW |