OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/webui/media/media_internals_ui.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
11 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 11 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
12 #include "chrome/browser/ui/webui/media/media_internals_handler.h" | 12 #include "chrome/browser/ui/webui/media/media_internals_handler.h" |
13 #include "chrome/common/jstemplate_builder.h" | 13 #include "chrome/common/jstemplate_builder.h" |
14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "content/browser/webui/web_ui.h" |
15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
16 #include "grit/browser_resources.h" | 17 #include "grit/browser_resources.h" |
17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
18 | 19 |
19 using content::WebContents; | 20 using content::WebContents; |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 ChromeWebUIDataSource* CreateMediaInternalsHTMLSource() { | 24 ChromeWebUIDataSource* CreateMediaInternalsHTMLSource() { |
24 ChromeWebUIDataSource* source = | 25 ChromeWebUIDataSource* source = |
25 new ChromeWebUIDataSource(chrome::kChromeUIMediaInternalsHost); | 26 new ChromeWebUIDataSource(chrome::kChromeUIMediaInternalsHost); |
26 | 27 |
27 source->set_json_path("strings.js"); | 28 source->set_json_path("strings.js"); |
28 source->add_resource_path("media_internals.js", IDR_MEDIA_INTERNALS_JS); | 29 source->add_resource_path("media_internals.js", IDR_MEDIA_INTERNALS_JS); |
29 source->set_default_resource(IDR_MEDIA_INTERNALS_HTML); | 30 source->set_default_resource(IDR_MEDIA_INTERNALS_HTML); |
30 return source; | 31 return source; |
31 } | 32 } |
32 | 33 |
33 } // namespace | 34 } // namespace |
34 | 35 |
35 //////////////////////////////////////////////////////////////////////////////// | 36 //////////////////////////////////////////////////////////////////////////////// |
36 // | 37 // |
37 // MediaInternalsUI | 38 // MediaInternalsUI |
38 // | 39 // |
39 //////////////////////////////////////////////////////////////////////////////// | 40 //////////////////////////////////////////////////////////////////////////////// |
40 | 41 |
41 MediaInternalsUI::MediaInternalsUI(WebContents* contents) | 42 MediaInternalsUI::MediaInternalsUI(WebUI* web_ui) |
42 : WebUI(contents, this) { | 43 : WebUIController(web_ui) { |
43 AddMessageHandler(new MediaInternalsMessageHandler()); | 44 web_ui->AddMessageHandler(new MediaInternalsMessageHandler()); |
44 | 45 |
45 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 46 Profile* profile = Profile::FromBrowserContext( |
| 47 web_ui->web_contents()->GetBrowserContext()); |
46 profile->GetChromeURLDataManager()->AddDataSource( | 48 profile->GetChromeURLDataManager()->AddDataSource( |
47 CreateMediaInternalsHTMLSource()); | 49 CreateMediaInternalsHTMLSource()); |
48 } | 50 } |
OLD | NEW |