Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / browser / media / media_internals_ui.cc
blob3a5ac605234b20a0b5812f7556834cdf3025cf64
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
3 // found in the LICENSE file.
5 #include "content/browser/media/media_internals_ui.h"
7 #include "base/command_line.h"
8 #include "content/browser/media/media_internals_handler.h"
9 #include "content/grit/content_resources.h"
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/content_switches.h"
14 #include "content/public/common/url_constants.h"
16 namespace content {
17 namespace {
19 WebUIDataSource* CreateMediaInternalsHTMLSource() {
20 WebUIDataSource* source =
21 WebUIDataSource::Create(kChromeUIMediaInternalsHost);
23 source->SetJsonPath("strings.js");
25 source->AddResourcePath("media_internals.js", IDR_MEDIA_INTERNALS_JS);
26 source->SetDefaultResource(IDR_MEDIA_INTERNALS_HTML);
27 return source;
30 } // namespace
32 ////////////////////////////////////////////////////////////////////////////////
34 // MediaInternalsUI
36 ////////////////////////////////////////////////////////////////////////////////
38 MediaInternalsUI::MediaInternalsUI(WebUI* web_ui)
39 : WebUIController(web_ui) {
40 web_ui->AddMessageHandler(new MediaInternalsMessageHandler());
42 BrowserContext* browser_context =
43 web_ui->GetWebContents()->GetBrowserContext();
44 WebUIDataSource::Add(browser_context, CreateMediaInternalsHTMLSource());
47 } // namespace content