| 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/edit_search_engine_dialog_ui_webui.h" | 5 #include "chrome/browser/ui/webui/edit_search_engine_dialog_ui_webui.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/common/url_constants.h" | 9 #include "chrome/common/url_constants.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 EditSearchEngineDialogUI::EditSearchEngineDialogUI(WebUI* web_ui) |
| 15 | 16 : HtmlDialogUI(web_ui) { |
| 16 EditSearchEngineDialogUI::EditSearchEngineDialogUI(WebContents* contents) | |
| 17 : HtmlDialogUI(contents) { | |
| 18 ChromeWebUIDataSource* source = | 17 ChromeWebUIDataSource* source = |
| 19 new ChromeWebUIDataSource(chrome::kChromeUIEditSearchEngineDialogHost); | 18 new ChromeWebUIDataSource(chrome::kChromeUIEditSearchEngineDialogHost); |
| 20 | 19 |
| 21 source->AddLocalizedString("titleNew", | 20 source->AddLocalizedString("titleNew", |
| 22 IDS_SEARCH_ENGINES_EDITOR_NEW_WINDOW_TITLE); | 21 IDS_SEARCH_ENGINES_EDITOR_NEW_WINDOW_TITLE); |
| 23 source->AddLocalizedString("titleEdit", | 22 source->AddLocalizedString("titleEdit", |
| 24 IDS_SEARCH_ENGINES_EDITOR_EDIT_WINDOW_TITLE); | 23 IDS_SEARCH_ENGINES_EDITOR_EDIT_WINDOW_TITLE); |
| 25 source->AddLocalizedString("descriptionLabel", | 24 source->AddLocalizedString("descriptionLabel", |
| 26 IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_LABEL); | 25 IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_LABEL); |
| 27 source->AddLocalizedString("keywordLabel", | 26 source->AddLocalizedString("keywordLabel", |
| (...skipping 14 matching lines...) Expand all Loading... |
| 42 | 41 |
| 43 // Add required resources. | 42 // Add required resources. |
| 44 source->add_resource_path("edit_search_engine_dialog.js", | 43 source->add_resource_path("edit_search_engine_dialog.js", |
| 45 IDR_EDIT_SEARCH_ENGINE_DIALOG_JS); | 44 IDR_EDIT_SEARCH_ENGINE_DIALOG_JS); |
| 46 source->add_resource_path("edit_search_engine_dialog.css", | 45 source->add_resource_path("edit_search_engine_dialog.css", |
| 47 IDR_EDIT_SEARCH_ENGINE_DIALOG_CSS); | 46 IDR_EDIT_SEARCH_ENGINE_DIALOG_CSS); |
| 48 | 47 |
| 49 // Set default resource. | 48 // Set default resource. |
| 50 source->set_default_resource(IDR_EDIT_SEARCH_ENGINE_DIALOG_HTML); | 49 source->set_default_resource(IDR_EDIT_SEARCH_ENGINE_DIALOG_HTML); |
| 51 | 50 |
| 52 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 51 Profile* profile = Profile::FromBrowserContext( |
| 52 web_ui->web_contents()->GetBrowserContext()); |
| 53 profile->GetChromeURLDataManager()->AddDataSource(source); | 53 profile->GetChromeURLDataManager()->AddDataSource(source); |
| 54 } | 54 } |
| 55 | 55 |
| 56 EditSearchEngineDialogUI::~EditSearchEngineDialogUI() { | 56 EditSearchEngineDialogUI::~EditSearchEngineDialogUI() { |
| 57 } | 57 } |
| OLD | NEW |