• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "content/browser/media/webrtc_internals_ui.h"
6 
7 #include "content/browser/media/webrtc_internals_message_handler.h"
8 #include "content/grit/content_resources.h"
9 #include "content/public/browser/web_contents.h"
10 #include "content/public/browser/web_ui.h"
11 #include "content/public/browser/web_ui_data_source.h"
12 #include "content/public/common/url_constants.h"
13 
14 namespace content {
15 namespace {
16 
CreateWebRTCInternalsHTMLSource()17 WebUIDataSource* CreateWebRTCInternalsHTMLSource() {
18   WebUIDataSource* source =
19       WebUIDataSource::Create(kChromeUIWebRTCInternalsHost);
20 
21   source->SetJsonPath("strings.js");
22   source->AddResourcePath("webrtc_internals.js", IDR_WEBRTC_INTERNALS_JS);
23   source->SetDefaultResource(IDR_WEBRTC_INTERNALS_HTML);
24   return source;
25 }
26 
27 }  // namespace
28 
29 ////////////////////////////////////////////////////////////////////////////////
30 //
31 // WebRTCInternalsUI
32 //
33 ////////////////////////////////////////////////////////////////////////////////
34 
WebRTCInternalsUI(WebUI * web_ui)35 WebRTCInternalsUI::WebRTCInternalsUI(WebUI* web_ui)
36     : WebUIController(web_ui) {
37   web_ui->AddMessageHandler(new WebRTCInternalsMessageHandler());
38 
39   BrowserContext* browser_context =
40       web_ui->GetWebContents()->GetBrowserContext();
41   WebUIDataSource::Add(browser_context, CreateWebRTCInternalsHTMLSource());
42 }
43 
44 }  // namespace content
45