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

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

Issue 2450843002: Indicate that sync was disabled by administrator. (Closed)
Patch Set: Clean-up (prepare for review) Created 4 years, 1 month 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
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 "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/sync/profile_sync_service_factory.h"
9 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h" 10 #include "chrome/browser/ui/webui/signin/sync_confirmation_handler.h"
10 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
11 #include "chrome/grit/browser_resources.h" 12 #include "chrome/grit/browser_resources.h"
12 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
13 #include "content/public/browser/web_ui.h" 14 #include "content/public/browser/web_ui.h"
14 #include "content/public/browser/web_ui_data_source.h" 15 #include "content/public/browser/web_ui_data_source.h"
15 #include "ui/base/webui/web_ui_util.h" 16 #include "ui/base/webui/web_ui_util.h"
16 17
17 SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui) 18 SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui)
18 : SyncConfirmationUI(web_ui, new SyncConfirmationHandler) {} 19 : SyncConfirmationUI(web_ui, new SyncConfirmationHandler) {}
19 20
20 SyncConfirmationUI::SyncConfirmationUI( 21 SyncConfirmationUI::SyncConfirmationUI(
21 content::WebUI* web_ui, SyncConfirmationHandler* handler) 22 content::WebUI* web_ui, SyncConfirmationHandler* handler)
22 : WebDialogUI(web_ui) { 23 : WebDialogUI(web_ui) {
23 Profile* profile = Profile::FromWebUI(web_ui); 24 Profile* profile = Profile::FromWebUI(web_ui);
25 bool is_sync_allowed = profile->IsSyncAllowed();
26
24 content::WebUIDataSource* source = 27 content::WebUIDataSource* source =
25 content::WebUIDataSource::Create(chrome::kChromeUISyncConfirmationHost); 28 content::WebUIDataSource::Create(chrome::kChromeUISyncConfirmationHost);
26 source->SetJsonPath("strings.js"); 29 source->SetJsonPath("strings.js");
27 source->SetDefaultResource(IDR_SYNC_CONFIRMATION_HTML); 30 source->SetDefaultResource(IDR_SYNC_CONFIRMATION_HTML);
28 source->AddResourcePath("sync_confirmation.css", IDR_SYNC_CONFIRMATION_CSS); 31 source->AddResourcePath("sync_confirmation.css", IDR_SYNC_CONFIRMATION_CSS);
29 source->AddResourcePath("sync_confirmation.js", IDR_SYNC_CONFIRMATION_JS); 32 source->AddResourcePath("sync_confirmation.js", IDR_SYNC_CONFIRMATION_JS);
30 source->AddResourcePath("signin_shared_css.html", IDR_SIGNIN_SHARED_CSS_HTML); 33 source->AddResourcePath("signin_shared_css.html", IDR_SIGNIN_SHARED_CSS_HTML);
34 source->AddBoolean("isSyncAllowed", is_sync_allowed);
31 35
32 source->AddLocalizedString("syncConfirmationTitle",
33 IDS_SYNC_CONFIRMATION_TITLE);
34 source->AddLocalizedString("syncConfirmationChromeSyncTitle", 36 source->AddLocalizedString("syncConfirmationChromeSyncTitle",
35 IDS_SYNC_CONFIRMATION_CHROME_SYNC_TITLE); 37 IDS_SYNC_CONFIRMATION_CHROME_SYNC_TITLE);
36 source->AddLocalizedString("syncConfirmationChromeSyncBody", 38 source->AddLocalizedString("syncConfirmationChromeSyncBody",
37 IDS_SYNC_CONFIRMATION_CHROME_SYNC_MESSAGE); 39 IDS_SYNC_CONFIRMATION_CHROME_SYNC_MESSAGE);
38 source->AddLocalizedString("syncConfirmationPersonalizeServicesTitle", 40 source->AddLocalizedString("syncConfirmationPersonalizeServicesTitle",
39 IDS_SYNC_CONFIRMATION_PERSONALIZE_SERVICES_TITLE); 41 IDS_SYNC_CONFIRMATION_PERSONALIZE_SERVICES_TITLE);
40 source->AddLocalizedString("syncConfirmationPersonalizeServicesBody", 42 source->AddLocalizedString("syncConfirmationPersonalizeServicesBody",
41 IDS_SYNC_CONFIRMATION_PERSONALIZE_SERVICES_BODY); 43 IDS_SYNC_CONFIRMATION_PERSONALIZE_SERVICES_BODY);
42 source->AddLocalizedString("syncConfirmationSyncSettingsLinkBody", 44 source->AddLocalizedString("syncConfirmationSyncSettingsLinkBody",
43 IDS_SYNC_CONFIRMATION_SYNC_SETTINGS_LINK_BODY); 45 IDS_SYNC_CONFIRMATION_SYNC_SETTINGS_LINK_BODY);
44 source->AddLocalizedString("syncConfirmationConfirmLabel", 46 source->AddLocalizedString("syncDisabledConfirmationDetails",
45 IDS_SYNC_CONFIRMATION_CONFIRM_BUTTON_LABEL); 47 IDS_SYNC_DISABLED_CONFIRMATION_DETAILS);
46 source->AddLocalizedString("syncConfirmationUndoLabel", 48
47 IDS_SYNC_CONFIRMATION_UNDO_BUTTON_LABEL); 49 if (is_sync_allowed) {
50 source->AddLocalizedString("syncConfirmationTitle",
51 IDS_SYNC_CONFIRMATION_TITLE);
52 source->AddLocalizedString("syncConfirmationConfirmLabel",
53 IDS_SYNC_CONFIRMATION_CONFIRM_BUTTON_LABEL);
54 source->AddLocalizedString("syncConfirmationUndoLabel",
55 IDS_SYNC_CONFIRMATION_UNDO_BUTTON_LABEL);
56 } else {
57 source->AddLocalizedString(
58 "syncConfirmationTitle",
59 IDS_SYNC_DISABLED_CONFIRMATION_CHROME_SYNC_TITLE);
60 source->AddLocalizedString(
61 "syncConfirmationConfirmLabel",
62 IDS_SYNC_DISABLED_CONFIRMATION_CONFIRM_BUTTON_LABEL);
63 source->AddLocalizedString(
64 "syncConfirmationUndoLabel",
65 IDS_SYNC_DISABLED_CONFIRMATION_UNDO_BUTTON_LABEL);
66 }
Roger Tawa OOO till Jul 10th 2016/10/27 14:18:12 Nit: I think I'd only set three int variables insi
msarda 2016/10/27 14:47:20 Done.
48 67
49 base::DictionaryValue strings; 68 base::DictionaryValue strings;
50 webui::SetLoadTimeDataDefaults( 69 webui::SetLoadTimeDataDefaults(
51 g_browser_process->GetApplicationLocale(), &strings); 70 g_browser_process->GetApplicationLocale(), &strings);
52 source->AddLocalizedStrings(strings); 71 source->AddLocalizedStrings(strings);
53 72
54 content::WebUIDataSource::Add(profile, source); 73 content::WebUIDataSource::Add(profile, source);
55 web_ui->AddMessageHandler(handler); 74 web_ui->AddMessageHandler(handler);
56 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698