OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/edit_search_engine_dialog_ui.h" |
| 6 |
| 7 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 8 #include "chrome/common/url_constants.h" |
| 9 #include "content/browser/tab_contents/tab_contents.h" |
| 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "grit/browser_resources.h" |
| 12 #include "grit/generated_resources.h" |
| 13 |
| 14 EditSearchEngineDialogUI::EditSearchEngineDialogUI(TabContents* contents) |
| 15 : HtmlDialogUI(contents) { |
| 16 ChromeWebUIDataSource* source = |
| 17 new ChromeWebUIDataSource(chrome::kChromeUIEditSearchEngineDialogHost); |
| 18 |
| 19 source->AddLocalizedString("titleNew", |
| 20 IDS_SEARCH_ENGINES_EDITOR_NEW_WINDOW_TITLE); |
| 21 source->AddLocalizedString("titleEdit", |
| 22 IDS_SEARCH_ENGINES_EDITOR_EDIT_WINDOW_TITLE); |
| 23 source->AddLocalizedString("descriptionLabel", |
| 24 IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_LABEL); |
| 25 source->AddLocalizedString("keywordLabel", |
| 26 IDS_SEARCH_ENGINES_EDITOR_KEYWORD_LABEL); |
| 27 source->AddLocalizedString("urlLabel", IDS_SEARCH_ENGINES_EDITOR_URL_LABEL); |
| 28 source->AddLocalizedString("urlDescriptionLabel", |
| 29 IDS_SEARCH_ENGINES_EDITOR_URL_DESCRIPTION_LABEL); |
| 30 source->AddLocalizedString("invalidTitle", |
| 31 IDS_SEARCH_ENGINES_INVALID_TITLE_TT); |
| 32 source->AddLocalizedString("invalidKeyword", |
| 33 IDS_SEARCH_ENGINES_INVALID_KEYWORD_TT); |
| 34 source->AddLocalizedString("invalidUrl", IDS_SEARCH_ENGINES_INVALID_URL_TT); |
| 35 source->AddLocalizedString("cancel", IDS_CANCEL); |
| 36 source->AddLocalizedString("save", IDS_SAVE); |
| 37 |
| 38 // Set the json path. |
| 39 source->set_json_path("strings.js"); |
| 40 |
| 41 // Add required resources. |
| 42 source->add_resource_path("edit_search_engine_dialog.js", |
| 43 IDR_EDIT_SEARCH_ENGINE_DIALOG_JS); |
| 44 source->add_resource_path("edit_search_engine_dialog.css", |
| 45 IDR_EDIT_SEARCH_ENGINE_DIALOG_CSS); |
| 46 |
| 47 // Set default resource. |
| 48 source->set_default_resource(IDR_EDIT_SEARCH_ENGINE_DIALOG_HTML); |
| 49 |
| 50 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
| 51 profile->GetChromeURLDataManager()->AddDataSource(source); |
| 52 } |
| 53 |
| 54 EditSearchEngineDialogUI::~EditSearchEngineDialogUI() { |
| 55 } |
OLD | NEW |