Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors |
[email protected] | 64ccac3 | 2013-01-29 21:40:04 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
mcasas | 6b8c0c8 | 2016-07-29 23:04:35 | [diff] [blame] | 5 | #include "content/browser/webrtc/webrtc_internals_ui.h" |
[email protected] | 64ccac3 | 2013-01-29 21:40:04 | [diff] [blame] | 6 | |
Christopher Grant | 898f684 | 2019-10-24 17:03:06 | [diff] [blame] | 7 | #include "content/browser/webrtc/resources/grit/webrtc_internals_resources.h" |
rbpotter | 5796b00 | 2021-03-10 18:49:21 | [diff] [blame] | 8 | #include "content/browser/webrtc/resources/grit/webrtc_internals_resources_map.h" |
mcasas | 6b8c0c8 | 2016-07-29 23:04:35 | [diff] [blame] | 9 | #include "content/browser/webrtc/webrtc_internals_message_handler.h" |
[email protected] | 64ccac3 | 2013-01-29 21:40:04 | [diff] [blame] | 10 | #include "content/public/browser/web_contents.h" |
11 | #include "content/public/browser/web_ui.h" | ||||
12 | #include "content/public/browser/web_ui_data_source.h" | ||||
13 | #include "content/public/common/url_constants.h" | ||||
[email protected] | 64ccac3 | 2013-01-29 21:40:04 | [diff] [blame] | 14 | |
15 | namespace content { | ||||
16 | namespace { | ||||
17 | |||||
Lei Zhang | 4fcf840 | 2023-03-17 22:58:51 | [diff] [blame] | 18 | void CreateAndAddWebRTCInternalsHTMLSource(BrowserContext* browser_context) { |
19 | WebUIDataSource* source = WebUIDataSource::CreateAndAdd( | ||||
20 | browser_context, kChromeUIWebRTCInternalsHost); | ||||
[email protected] | 64ccac3 | 2013-01-29 21:40:04 | [diff] [blame] | 21 | |
Dan Beam | e9f4007f | 2019-08-17 00:59:10 | [diff] [blame] | 22 | source->UseStringsJs(); |
Peter Kasting | 5f6928c | 2024-11-29 21:25:11 | [diff] [blame] | 23 | source->AddResourcePaths(kWebrtcInternalsResources); |
rbpotter | 5796b00 | 2021-03-10 18:49:21 | [diff] [blame] | 24 | source->SetDefaultResource(IDR_WEBRTC_INTERNALS_WEBRTC_INTERNALS_HTML); |
[email protected] | 64ccac3 | 2013-01-29 21:40:04 | [diff] [blame] | 25 | } |
26 | |||||
27 | } // namespace | ||||
28 | |||||
29 | //////////////////////////////////////////////////////////////////////////////// | ||||
30 | // | ||||
31 | // WebRTCInternalsUI | ||||
32 | // | ||||
33 | //////////////////////////////////////////////////////////////////////////////// | ||||
34 | |||||
35 | WebRTCInternalsUI::WebRTCInternalsUI(WebUI* web_ui) | ||||
36 | : WebUIController(web_ui) { | ||||
Jeremy Roman | 04f27c37 | 2017-10-27 15:20:55 | [diff] [blame] | 37 | web_ui->AddMessageHandler(std::make_unique<WebRTCInternalsMessageHandler>()); |
[email protected] | 64ccac3 | 2013-01-29 21:40:04 | [diff] [blame] | 38 | |
Lei Zhang | 4fcf840 | 2023-03-17 22:58:51 | [diff] [blame] | 39 | CreateAndAddWebRTCInternalsHTMLSource( |
40 | web_ui->GetWebContents()->GetBrowserContext()); | ||||
[email protected] | 64ccac3 | 2013-01-29 21:40:04 | [diff] [blame] | 41 | } |
42 | |||||
43 | } // namespace content |