OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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/signin/sync_confirmation_ui.h" |
| 6 |
| 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h" |
| 10 #include "chrome/common/url_constants.h" |
| 11 #include "chrome/grit/generated_resources.h" |
| 12 #include "content/public/browser/web_ui.h" |
| 13 #include "content/public/browser/web_ui_data_source.h" |
| 14 #include "grit/browser_resources.h" |
| 15 #include "ui/base/webui/web_ui_util.h" |
| 16 |
| 17 SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui) |
| 18 : SyncConfirmationUI(web_ui, new SyncConfirmationHandler) {} |
| 19 |
| 20 SyncConfirmationUI::SyncConfirmationUI( |
| 21 content::WebUI* web_ui, SyncConfirmationHandler* handler) |
| 22 : WebDialogUI(web_ui){ |
| 23 Profile* profile = Profile::FromWebUI(web_ui); |
| 24 content::WebUIDataSource* source = |
| 25 content::WebUIDataSource::Create(chrome::kChromeUISyncConfirmationHost); |
| 26 source->SetJsonPath("strings.js"); |
| 27 source->SetDefaultResource(IDR_SYNC_CONFIRMATION_HTML); |
| 28 source->AddResourcePath("sync_confirmation.css", IDR_SYNC_CONFIRMATION_CSS); |
| 29 source->AddResourcePath("sync_confirmation.js", IDR_SYNC_CONFIRMATION_JS); |
| 30 |
| 31 source->AddLocalizedString("syncConfirmationTitle", |
| 32 IDS_SYNC_CONFIRMATION_TITLE); |
| 33 source->AddLocalizedString("syncConfirmationBody", |
| 34 IDS_SYNC_CONFIRMATION_BODY); |
| 35 source->AddLocalizedString("syncConfirmationConfirmLabel", |
| 36 IDS_SYNC_CONFIRMATION_CONFIRM_BUTTON_LABEL); |
| 37 source->AddLocalizedString("syncConfirmationUndoLabel", |
| 38 IDS_SYNC_CONFIRMATION_UNDO_BUTTON_LABEL); |
| 39 |
| 40 base::DictionaryValue strings; |
| 41 webui::SetLoadTimeDataDefaults( |
| 42 g_browser_process->GetApplicationLocale(), &strings); |
| 43 source->AddLocalizedStrings(strings); |
| 44 |
| 45 content::WebUIDataSource::Add(profile, source); |
| 46 web_ui->AddMessageHandler(handler); |
| 47 } |
OLD | NEW |