Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: chrome/browser/ui/webui/signin/sync_confirmation_ui.cc

Issue 2784823002: Reland "Use the same browser instance in the sync confirmation dialog. (Closed)
Patch Set: Rebase and fix conflicts Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/signin/sync_confirmation_ui.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sync/profile_sync_service_factory.h" 10 #include "chrome/browser/sync/profile_sync_service_factory.h"
11 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h" 11 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h"
12 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
13 #include "chrome/grit/browser_resources.h" 13 #include "chrome/grit/browser_resources.h"
14 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
15 #include "content/public/browser/web_ui.h" 15 #include "content/public/browser/web_ui.h"
16 #include "content/public/browser/web_ui_data_source.h" 16 #include "content/public/browser/web_ui_data_source.h"
17 #include "ui/base/webui/web_ui_util.h" 17 #include "ui/base/webui/web_ui_util.h"
18 18
19 SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui) 19 SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui)
20 : SyncConfirmationUI(web_ui, base::MakeUnique<SyncConfirmationHandler>()) {}
21
22 SyncConfirmationUI::SyncConfirmationUI(
23 content::WebUI* web_ui,
24 std::unique_ptr<SyncConfirmationHandler> handler)
25 : WebDialogUI(web_ui) { 20 : WebDialogUI(web_ui) {
26 Profile* profile = Profile::FromWebUI(web_ui); 21 Profile* profile = Profile::FromWebUI(web_ui);
27 bool is_sync_allowed = profile->IsSyncAllowed(); 22 bool is_sync_allowed = profile->IsSyncAllowed();
28 23
29 content::WebUIDataSource* source = 24 content::WebUIDataSource* source =
30 content::WebUIDataSource::Create(chrome::kChromeUISyncConfirmationHost); 25 content::WebUIDataSource::Create(chrome::kChromeUISyncConfirmationHost);
31 source->SetJsonPath("strings.js"); 26 source->SetJsonPath("strings.js");
32 source->SetDefaultResource(IDR_SYNC_CONFIRMATION_HTML); 27 source->SetDefaultResource(IDR_SYNC_CONFIRMATION_HTML);
33 source->AddResourcePath("sync_confirmation.css", IDR_SYNC_CONFIRMATION_CSS); 28 source->AddResourcePath("sync_confirmation.css", IDR_SYNC_CONFIRMATION_CSS);
34 source->AddResourcePath("sync_confirmation.js", IDR_SYNC_CONFIRMATION_JS); 29 source->AddResourcePath("sync_confirmation.js", IDR_SYNC_CONFIRMATION_JS);
(...skipping 25 matching lines...) Expand all
60 source->AddLocalizedString("syncConfirmationConfirmLabel", 55 source->AddLocalizedString("syncConfirmationConfirmLabel",
61 confirm_button_ids); 56 confirm_button_ids);
62 source->AddLocalizedString("syncConfirmationUndoLabel", undo_button_ids); 57 source->AddLocalizedString("syncConfirmationUndoLabel", undo_button_ids);
63 58
64 base::DictionaryValue strings; 59 base::DictionaryValue strings;
65 webui::SetLoadTimeDataDefaults( 60 webui::SetLoadTimeDataDefaults(
66 g_browser_process->GetApplicationLocale(), &strings); 61 g_browser_process->GetApplicationLocale(), &strings);
67 source->AddLocalizedStrings(strings); 62 source->AddLocalizedStrings(strings);
68 63
69 content::WebUIDataSource::Add(profile, source); 64 content::WebUIDataSource::Add(profile, source);
70 web_ui->AddMessageHandler(std::move(handler));
71 } 65 }
66
67 void SyncConfirmationUI::InitializeMessageHandlerWithBrowser(Browser* browser) {
68 web_ui()->AddMessageHandler(
69 base::MakeUnique<SyncConfirmationHandler>(browser));
70 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/sync_confirmation_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698