| 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 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" | 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return context->http_transaction_factory()->GetSession(); | 168 return context->http_transaction_factory()->GetSession(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 content::WebUIDataSource* CreateNetInternalsHTMLSource() { | 171 content::WebUIDataSource* CreateNetInternalsHTMLSource() { |
| 172 content::WebUIDataSource* source = | 172 content::WebUIDataSource* source = |
| 173 content::WebUIDataSource::Create(chrome::kChromeUINetInternalsHost); | 173 content::WebUIDataSource::Create(chrome::kChromeUINetInternalsHost); |
| 174 | 174 |
| 175 source->SetDefaultResource(IDR_NET_INTERNALS_INDEX_HTML); | 175 source->SetDefaultResource(IDR_NET_INTERNALS_INDEX_HTML); |
| 176 source->AddResourcePath("index.js", IDR_NET_INTERNALS_INDEX_JS); | 176 source->AddResourcePath("index.js", IDR_NET_INTERNALS_INDEX_JS); |
| 177 source->SetJsonPath("strings.js"); | 177 source->SetJsonPath("strings.js"); |
| 178 source->UseGzipForAllPaths(); |
| 178 return source; | 179 return source; |
| 179 } | 180 } |
| 180 | 181 |
| 181 // This class receives javascript messages from the renderer. | 182 // This class receives javascript messages from the renderer. |
| 182 // Note that the WebUI infrastructure runs on the UI thread, therefore all of | 183 // Note that the WebUI infrastructure runs on the UI thread, therefore all of |
| 183 // this class's methods are expected to run on the UI thread. | 184 // this class's methods are expected to run on the UI thread. |
| 184 // | 185 // |
| 185 // Since the network code we want to run lives on the IO thread, we proxy | 186 // Since the network code we want to run lives on the IO thread, we proxy |
| 186 // almost everything over to NetInternalsMessageHandler::IOThreadImpl, which | 187 // almost everything over to NetInternalsMessageHandler::IOThreadImpl, which |
| 187 // runs on the IO thread. | 188 // runs on the IO thread. |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 //////////////////////////////////////////////////////////////////////////////// | 1175 //////////////////////////////////////////////////////////////////////////////// |
| 1175 | 1176 |
| 1176 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1177 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1177 : WebUIController(web_ui) { | 1178 : WebUIController(web_ui) { |
| 1178 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1179 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1179 | 1180 |
| 1180 // Set up the chrome://net-internals/ source. | 1181 // Set up the chrome://net-internals/ source. |
| 1181 Profile* profile = Profile::FromWebUI(web_ui); | 1182 Profile* profile = Profile::FromWebUI(web_ui); |
| 1182 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1183 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
| 1183 } | 1184 } |
| OLD | NEW |