| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/signin/sync_confirmation_ui.h" | 5 #include "chrome/browser/ui/webui/signin/sync_confirmation_ui.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h" | 9 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
| 12 #include "content/public/browser/web_ui.h" | 12 #include "content/public/browser/web_ui.h" |
| 13 #include "content/public/browser/web_ui_data_source.h" | 13 #include "content/public/browser/web_ui_data_source.h" |
| 14 #include "grit/browser_resources.h" | 14 #include "grit/browser_resources.h" |
| 15 #include "ui/base/webui/web_ui_util.h" | 15 #include "ui/base/webui/web_ui_util.h" |
| 16 | 16 |
| 17 SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui) | 17 SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui) |
| 18 : SyncConfirmationUI(web_ui, new SyncConfirmationHandler) {} | 18 : SyncConfirmationUI(web_ui, new SyncConfirmationHandler) {} |
| 19 | 19 |
| 20 SyncConfirmationUI::SyncConfirmationUI( | 20 SyncConfirmationUI::SyncConfirmationUI( |
| 21 content::WebUI* web_ui, SyncConfirmationHandler* handler) | 21 content::WebUI* web_ui, SyncConfirmationHandler* handler) |
| 22 : WebDialogUI(web_ui) { | 22 : WebDialogUI(web_ui) { |
| 23 Profile* profile = Profile::FromWebUI(web_ui); | 23 Profile* profile = Profile::FromWebUI(web_ui); |
| 24 content::WebUIDataSource* source = | 24 content::WebUIDataSource* source = |
| 25 content::WebUIDataSource::Create(chrome::kChromeUISyncConfirmationHost); | 25 content::WebUIDataSource::Create(chrome::kChromeUISyncConfirmationHost); |
| 26 source->SetJsonPath("strings.js"); | 26 source->SetJsonPath("strings.js"); |
| 27 source->SetDefaultResource(IDR_SYNC_CONFIRMATION_HTML); | 27 source->SetDefaultResource(IDR_SYNC_CONFIRMATION_HTML); |
| 28 source->AddResourcePath("sync_confirmation.css", IDR_SYNC_CONFIRMATION_CSS); | 28 source->AddResourcePath("sync_confirmation.css", IDR_SYNC_CONFIRMATION_CSS); |
| 29 source->AddResourcePath("sync_confirmation.js", IDR_SYNC_CONFIRMATION_JS); | 29 source->AddResourcePath("sync_confirmation.js", IDR_SYNC_CONFIRMATION_JS); |
| 30 source->AddResourcePath("signin_shared_css.html", IDR_SIGNIN_SHARED_CSS_HTML); |
| 30 | 31 |
| 31 source->AddLocalizedString("syncConfirmationTitle", | 32 source->AddLocalizedString("syncConfirmationTitle", |
| 32 IDS_SYNC_CONFIRMATION_TITLE); | 33 IDS_SYNC_CONFIRMATION_TITLE); |
| 33 source->AddLocalizedString("syncConfirmationChromeSyncTitle", | 34 source->AddLocalizedString("syncConfirmationChromeSyncTitle", |
| 34 IDS_SYNC_CONFIRMATION_CHROME_SYNC_TITLE); | 35 IDS_SYNC_CONFIRMATION_CHROME_SYNC_TITLE); |
| 35 source->AddLocalizedString("syncConfirmationChromeSyncBody", | 36 source->AddLocalizedString("syncConfirmationChromeSyncBody", |
| 36 IDS_SYNC_CONFIRMATION_CHROME_SYNC_MESSAGE); | 37 IDS_SYNC_CONFIRMATION_CHROME_SYNC_MESSAGE); |
| 37 source->AddLocalizedString("syncConfirmationPersonalizeServicesTitle", | 38 source->AddLocalizedString("syncConfirmationPersonalizeServicesTitle", |
| 38 IDS_SYNC_CONFIRMATION_PERSONALIZE_SERVICES_TITLE); | 39 IDS_SYNC_CONFIRMATION_PERSONALIZE_SERVICES_TITLE); |
| 39 source->AddLocalizedString("syncConfirmationPersonalizeServicesBody", | 40 source->AddLocalizedString("syncConfirmationPersonalizeServicesBody", |
| 40 IDS_SYNC_CONFIRMATION_PERSONALIZE_SERVICES_BODY); | 41 IDS_SYNC_CONFIRMATION_PERSONALIZE_SERVICES_BODY); |
| 41 source->AddLocalizedString("syncConfirmationSyncSettingsLinkBody", | 42 source->AddLocalizedString("syncConfirmationSyncSettingsLinkBody", |
| 42 IDS_SYNC_CONFIRMATION_SYNC_SETTINGS_LINK_BODY); | 43 IDS_SYNC_CONFIRMATION_SYNC_SETTINGS_LINK_BODY); |
| 43 source->AddLocalizedString("syncConfirmationConfirmLabel", | 44 source->AddLocalizedString("syncConfirmationConfirmLabel", |
| 44 IDS_SYNC_CONFIRMATION_CONFIRM_BUTTON_LABEL); | 45 IDS_SYNC_CONFIRMATION_CONFIRM_BUTTON_LABEL); |
| 45 source->AddLocalizedString("syncConfirmationUndoLabel", | 46 source->AddLocalizedString("syncConfirmationUndoLabel", |
| 46 IDS_SYNC_CONFIRMATION_UNDO_BUTTON_LABEL); | 47 IDS_SYNC_CONFIRMATION_UNDO_BUTTON_LABEL); |
| 47 | 48 |
| 48 base::DictionaryValue strings; | 49 base::DictionaryValue strings; |
| 49 webui::SetLoadTimeDataDefaults( | 50 webui::SetLoadTimeDataDefaults( |
| 50 g_browser_process->GetApplicationLocale(), &strings); | 51 g_browser_process->GetApplicationLocale(), &strings); |
| 51 source->AddLocalizedStrings(strings); | 52 source->AddLocalizedStrings(strings); |
| 52 | 53 |
| 53 content::WebUIDataSource::Add(profile, source); | 54 content::WebUIDataSource::Add(profile, source); |
| 54 web_ui->AddMessageHandler(handler); | 55 web_ui->AddMessageHandler(handler); |
| 55 } | 56 } |
| OLD | NEW |