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/media/media_internals_ui.h" | 5 #include "content/browser/media/media_internals_ui.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "content/browser/media/media_internals_handler.h" |
8 #include "chrome/browser/profiles/profile.h" | |
9 #include "chrome/browser/ui/webui/media/media_internals_handler.h" | |
10 #include "chrome/common/url_constants.h" | |
11 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
12 #include "content/public/browser/web_ui.h" | 9 #include "content/public/browser/web_ui.h" |
13 #include "content/public/browser/web_ui_data_source.h" | 10 #include "content/public/browser/web_ui_data_source.h" |
14 #include "grit/browser_resources.h" | 11 #include "content/public/common/url_constants.h" |
15 #include "ui/base/resource/resource_bundle.h" | 12 #include "grit/content_resources.h" |
16 | 13 |
17 using content::WebContents; | 14 namespace content { |
18 | |
19 namespace { | 15 namespace { |
20 | 16 |
21 content::WebUIDataSource* CreateMediaInternalsHTMLSource() { | 17 WebUIDataSource* CreateMediaInternalsHTMLSource() { |
22 content::WebUIDataSource* source = | 18 WebUIDataSource* source = |
23 content::WebUIDataSource::Create(chrome::kChromeUIMediaInternalsHost); | 19 WebUIDataSource::Create(chrome::kChromeUIMediaInternalsHost); |
24 | 20 |
25 source->SetJsonPath("strings.js"); | 21 source->SetJsonPath("strings.js"); |
26 source->AddResourcePath("media_internals.js", IDR_MEDIA_INTERNALS_JS); | 22 source->AddResourcePath("media_internals.js", IDR_MEDIA_INTERNALS_JS); |
27 source->SetDefaultResource(IDR_MEDIA_INTERNALS_HTML); | 23 source->SetDefaultResource(IDR_MEDIA_INTERNALS_HTML); |
28 return source; | 24 return source; |
29 } | 25 } |
30 | 26 |
31 } // namespace | 27 } // namespace |
32 | 28 |
33 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
34 // | 30 // |
35 // MediaInternalsUI | 31 // MediaInternalsUI |
36 // | 32 // |
37 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
38 | 34 |
39 MediaInternalsUI::MediaInternalsUI(content::WebUI* web_ui) | 35 MediaInternalsUI::MediaInternalsUI(WebUI* web_ui) |
40 : WebUIController(web_ui) { | 36 : WebUIController(web_ui) { |
41 web_ui->AddMessageHandler(new MediaInternalsMessageHandler()); | 37 web_ui->AddMessageHandler(new MediaInternalsMessageHandler()); |
42 | 38 |
43 Profile* profile = Profile::FromWebUI(web_ui); | 39 BrowserContext* browser_context = |
44 content::WebUIDataSource::Add(profile, CreateMediaInternalsHTMLSource()); | 40 web_ui->GetWebContents()->GetBrowserContext(); |
| 41 WebUIDataSource::Add(browser_context, CreateMediaInternalsHTMLSource()); |
45 } | 42 } |
| 43 |
| 44 } // namespace content |
OLD | NEW |