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

Unified Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 471973003: Make the user manager UI not permit guest mode when preferences dictate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an unneeded header Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/user_manager/user_manager.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
index 485016214c0ad4f49680b449844dc7de05dd1cd4..c8104f767934026b1f38cad2b6f9dca25e9876b5 100644
--- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
+++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
@@ -144,6 +144,12 @@ extensions::ScreenlockPrivateEventRouter* GetScreenlockRouter(
profile);
}
+bool IsGuestModeEnabled() {
+ PrefService* service = g_browser_process->local_state();
+ DCHECK(service);
+ return service->GetBoolean(prefs::kBrowserGuestModeEnabled);
+}
+
} // namespace
// ProfileUpdateObserver ------------------------------------------------------
@@ -280,7 +286,8 @@ void UserManagerScreenHandler::Unlock(const std::string& user_email) {
void UserManagerScreenHandler::HandleInitialize(const base::ListValue* args) {
SendUserList();
- web_ui()->CallJavascriptFunction("cr.ui.Oobe.showUserManagerScreen");
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.showUserManagerScreen",
+ base::FundamentalValue(IsGuestModeEnabled()));
desktop_type_ = chrome::GetHostDesktopTypeForNativeView(
web_ui()->GetWebContents()->GetNativeView());
@@ -368,9 +375,15 @@ void UserManagerScreenHandler::HandleRemoveUser(const base::ListValue* args) {
}
void UserManagerScreenHandler::HandleLaunchGuest(const base::ListValue* args) {
- profiles::SwitchToGuestProfile(desktop_type_,
- base::Bind(&OnSwitchToProfileComplete));
- ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_GUEST);
+ if (IsGuestModeEnabled()) {
+ profiles::SwitchToGuestProfile(desktop_type_,
+ base::Bind(&OnSwitchToProfileComplete));
+ ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_GUEST);
+ } else {
+ // The UI should have prevented the user from allowing the selection of
+ // guest mode.
+ NOTREACHED();
+ }
}
void UserManagerScreenHandler::HandleLaunchUser(const base::ListValue* args) {
@@ -624,7 +637,7 @@ void UserManagerScreenHandler::SendUserList() {
}
web_ui()->CallJavascriptFunction("login.AccountPickerScreen.loadUsers",
- users_list, base::FundamentalValue(true));
+ users_list, base::FundamentalValue(IsGuestModeEnabled()));
}
void UserManagerScreenHandler::ReportAuthenticationResult(
« no previous file with comments | « chrome/browser/resources/user_manager/user_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698