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/hung_renderer_dialog_ui.h" | 5 #include "chrome/browser/ui/webui/hung_renderer_dialog_ui.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 8 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
9 #include "chrome/browser/ui/webui/theme_source.h" | 9 #include "chrome/browser/ui/webui/theme_source.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 #include "content/browser/webui/web_ui.h" |
11 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
12 #include "grit/browser_resources.h" | 13 #include "grit/browser_resources.h" |
13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
14 | 15 |
15 using content::WebContents; | 16 HungRendererDialogUI::HungRendererDialogUI(WebUI* web_ui) |
16 | 17 : HtmlDialogUI(web_ui) { |
17 HungRendererDialogUI::HungRendererDialogUI(WebContents* contents) | |
18 : HtmlDialogUI(contents) { | |
19 ChromeWebUIDataSource* source = | 18 ChromeWebUIDataSource* source = |
20 new ChromeWebUIDataSource(chrome::kChromeUIHungRendererDialogHost); | 19 new ChromeWebUIDataSource(chrome::kChromeUIHungRendererDialogHost); |
21 | 20 |
22 source->AddLocalizedString("title", IDS_BROWSER_HANGMONITOR_RENDERER_TITLE); | 21 source->AddLocalizedString("title", IDS_BROWSER_HANGMONITOR_RENDERER_TITLE); |
23 source->AddLocalizedString("explanation", IDS_BROWSER_HANGMONITOR_RENDERER); | 22 source->AddLocalizedString("explanation", IDS_BROWSER_HANGMONITOR_RENDERER); |
24 source->AddLocalizedString("kill", IDS_BROWSER_HANGMONITOR_RENDERER_END); | 23 source->AddLocalizedString("kill", IDS_BROWSER_HANGMONITOR_RENDERER_END); |
25 source->AddLocalizedString("wait", IDS_BROWSER_HANGMONITOR_RENDERER_WAIT); | 24 source->AddLocalizedString("wait", IDS_BROWSER_HANGMONITOR_RENDERER_WAIT); |
26 | 25 |
27 // Set the json path. | 26 // Set the json path. |
28 source->set_json_path("strings.js"); | 27 source->set_json_path("strings.js"); |
29 | 28 |
30 // Add required resources. | 29 // Add required resources. |
31 source->add_resource_path("hung_renderer_dialog.js", | 30 source->add_resource_path("hung_renderer_dialog.js", |
32 IDR_HUNG_RENDERER_DIALOG_JS); | 31 IDR_HUNG_RENDERER_DIALOG_JS); |
33 source->add_resource_path("hung_renderer_dialog.css", | 32 source->add_resource_path("hung_renderer_dialog.css", |
34 IDR_HUNG_RENDERER_DIALOG_CSS); | 33 IDR_HUNG_RENDERER_DIALOG_CSS); |
35 | 34 |
36 // Set default resource. | 35 // Set default resource. |
37 source->set_default_resource(IDR_HUNG_RENDERER_DIALOG_HTML); | 36 source->set_default_resource(IDR_HUNG_RENDERER_DIALOG_HTML); |
38 | 37 |
39 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 38 Profile* profile = Profile::FromBrowserContext( |
| 39 web_ui->web_contents()->GetBrowserContext()); |
40 profile->GetChromeURLDataManager()->AddDataSource(source); | 40 profile->GetChromeURLDataManager()->AddDataSource(source); |
41 | 41 |
42 // Set up the chrome://theme/ source. | 42 // Set up the chrome://theme/ source. |
43 ThemeSource* theme = new ThemeSource(profile); | 43 ThemeSource* theme = new ThemeSource(profile); |
44 profile->GetChromeURLDataManager()->AddDataSource(theme); | 44 profile->GetChromeURLDataManager()->AddDataSource(theme); |
45 } | 45 } |
46 | 46 |
47 HungRendererDialogUI::~HungRendererDialogUI() { | 47 HungRendererDialogUI::~HungRendererDialogUI() { |
48 } | 48 } |
OLD | NEW |