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 "chrome/browser/debugger/devtools_http_protocol_handler.h" | 5 #include "chrome/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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "base/stringprintf.h" |
13 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
14 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "chrome/browser/debugger/devtools_client_host.h" | 18 #include "chrome/browser/debugger/devtools_client_host.h" |
18 #include "chrome/browser/debugger/devtools_manager.h" | 19 #include "chrome/browser/debugger/devtools_manager.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
21 #include "chrome/browser/ui/webui/devtools_ui.h" | 22 #include "chrome/browser/ui/webui/devtools_ui.h" |
22 #include "chrome/common/devtools_messages.h" | 23 #include "chrome/common/devtools_messages.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 const base::StringPiece frontend_html( | 146 const base::StringPiece frontend_html( |
146 ResourceBundle::GetSharedInstance().GetRawDataResource( | 147 ResourceBundle::GetSharedInstance().GetRawDataResource( |
147 IDR_DEVTOOLS_FRONTEND_HTML)); | 148 IDR_DEVTOOLS_FRONTEND_HTML)); |
148 std::string response(frontend_html.data(), frontend_html.length()); | 149 std::string response(frontend_html.data(), frontend_html.length()); |
149 server_->Send200(connection_id, response, "text/html; charset=UTF-8"); | 150 server_->Send200(connection_id, response, "text/html; charset=UTF-8"); |
150 return; | 151 return; |
151 } | 152 } |
152 | 153 |
153 net::URLRequest* request; | 154 net::URLRequest* request; |
154 | 155 |
155 if (info.path.find("/devtools/") == 0) | 156 if (info.path.find("/devtools/") == 0) { |
156 request = new net::URLRequest(GURL("chrome-devtools:/" + info.path), this); | 157 request = new net::URLRequest(GURL("chrome-devtools:/" + info.path), this); |
157 else if (info.path.find("/thumb/") == 0) | 158 } else if (info.path.find("/thumb/") == 0) { |
158 request = new net::URLRequest(GURL("chrome:/" + info.path), this); | 159 request = new net::URLRequest(GURL("chrome:/" + info.path), this); |
159 else { | 160 } else { |
160 server_->Send404(connection_id); | 161 server_->Send404(connection_id); |
161 return; | 162 return; |
162 } | 163 } |
163 | 164 |
164 // Make sure DevTools data source is registered. | 165 // Make sure DevTools data source is registered. |
165 DevToolsUI::RegisterDevToolsDataSource(); | 166 DevToolsUI::RegisterDevToolsDataSource(); |
166 Bind(request, connection_id); | 167 Bind(request, connection_id); |
167 request->set_context( | 168 request->set_context( |
168 Profile::GetDefaultRequestContext()->GetURLRequestContext()); | 169 Profile::GetDefaultRequestContext()->GetURLRequestContext()); |
169 request->Start(); | 170 request->Start(); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 for (InspectableTabs::iterator it = inspectable_tabs.begin(); | 523 for (InspectableTabs::iterator it = inspectable_tabs.begin(); |
523 it != inspectable_tabs.end(); ++it) { | 524 it != inspectable_tabs.end(); ++it) { |
524 TabContentsWrapper* tab_contents = *it; | 525 TabContentsWrapper* tab_contents = *it; |
525 NavigationController& controller = | 526 NavigationController& controller = |
526 tab_contents->controller(); | 527 tab_contents->controller(); |
527 if (controller.session_id().id() == session_id) | 528 if (controller.session_id().id() == session_id) |
528 return controller.tab_contents(); | 529 return controller.tab_contents(); |
529 } | 530 } |
530 return NULL; | 531 return NULL; |
531 } | 532 } |
OLD | NEW |