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/input_window_dialog_ui.h" | 5 #include "chrome/browser/ui/webui/input_window_dialog_ui.h" |
6 | 6 |
7 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 7 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "content/browser/webui/web_ui.h" |
10 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
11 #include "grit/browser_resources.h" | 12 #include "grit/browser_resources.h" |
12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
13 | 14 |
14 using content::WebContents; | 15 InputWindowDialogUI::InputWindowDialogUI(WebUI* web_ui) |
15 | 16 : HtmlDialogUI(web_ui) { |
16 InputWindowDialogUI::InputWindowDialogUI(WebContents* contents) | |
17 : HtmlDialogUI(contents) { | |
18 ChromeWebUIDataSource* source = | 17 ChromeWebUIDataSource* source = |
19 new ChromeWebUIDataSource(chrome::kChromeUIInputWindowDialogHost); | 18 new ChromeWebUIDataSource(chrome::kChromeUIInputWindowDialogHost); |
20 | 19 |
21 source->AddLocalizedString("ok", IDS_OK); | 20 source->AddLocalizedString("ok", IDS_OK); |
22 source->AddLocalizedString("cancel", IDS_CANCEL); | 21 source->AddLocalizedString("cancel", IDS_CANCEL); |
23 | 22 |
24 // Set the json path. | 23 // Set the json path. |
25 source->set_json_path("strings.js"); | 24 source->set_json_path("strings.js"); |
26 | 25 |
27 // Set default resource. | 26 // Set default resource. |
28 source->set_default_resource(IDR_INPUT_WINDOW_DIALOG_HTML); | 27 source->set_default_resource(IDR_INPUT_WINDOW_DIALOG_HTML); |
29 | 28 |
30 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 29 Profile* profile = Profile::FromBrowserContext( |
| 30 web_ui->web_contents()->GetBrowserContext()); |
31 profile->GetChromeURLDataManager()->AddDataSource(source); | 31 profile->GetChromeURLDataManager()->AddDataSource(source); |
32 } | 32 } |
33 | 33 |
34 InputWindowDialogUI::~InputWindowDialogUI() { | 34 InputWindowDialogUI::~InputWindowDialogUI() { |
35 } | 35 } |
OLD | NEW |