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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 return context->http_transaction_factory()->GetSession(); | 171 return context->http_transaction_factory()->GetSession(); |
172 } | 172 } |
173 | 173 |
174 content::WebUIDataSource* CreateNetInternalsHTMLSource() { | 174 content::WebUIDataSource* CreateNetInternalsHTMLSource() { |
175 content::WebUIDataSource* source = | 175 content::WebUIDataSource* source = |
176 content::WebUIDataSource::Create(chrome::kChromeUINetInternalsHost); | 176 content::WebUIDataSource::Create(chrome::kChromeUINetInternalsHost); |
177 | 177 |
178 source->SetDefaultResource(IDR_NET_INTERNALS_INDEX_HTML); | 178 source->SetDefaultResource(IDR_NET_INTERNALS_INDEX_HTML); |
179 source->AddResourcePath("index.js", IDR_NET_INTERNALS_INDEX_JS); | 179 source->AddResourcePath("index.js", IDR_NET_INTERNALS_INDEX_JS); |
180 source->SetJsonPath("strings.js"); | 180 source->SetJsonPath("strings.js"); |
181 source->DisableI18nAndUseGzipForAllPaths(); | 181 source->UseGzip(std::unordered_set<std::string>()); |
182 return source; | 182 return source; |
183 } | 183 } |
184 | 184 |
185 // This class receives javascript messages from the renderer. | 185 // This class receives javascript messages from the renderer. |
186 // Note that the WebUI infrastructure runs on the UI thread, therefore all of | 186 // Note that the WebUI infrastructure runs on the UI thread, therefore all of |
187 // this class's methods are expected to run on the UI thread. | 187 // this class's methods are expected to run on the UI thread. |
188 // | 188 // |
189 // Since the network code we want to run lives on the IO thread, we proxy | 189 // Since the network code we want to run lives on the IO thread, we proxy |
190 // almost everything over to NetInternalsMessageHandler::IOThreadImpl, which | 190 // almost everything over to NetInternalsMessageHandler::IOThreadImpl, which |
191 // runs on the IO thread. | 191 // runs on the IO thread. |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 //////////////////////////////////////////////////////////////////////////////// | 1172 //////////////////////////////////////////////////////////////////////////////// |
1173 | 1173 |
1174 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1174 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1175 : WebUIController(web_ui) { | 1175 : WebUIController(web_ui) { |
1176 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1176 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1177 | 1177 |
1178 // Set up the chrome://net-internals/ source. | 1178 // Set up the chrome://net-internals/ source. |
1179 Profile* profile = Profile::FromWebUI(web_ui); | 1179 Profile* profile = Profile::FromWebUI(web_ui); |
1180 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1180 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1181 } | 1181 } |
OLD | NEW |