Commit c50dc3a2 authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

Public accounts: Removed HELP_TOPIC_PUBLIC_SESSION reference

Also removed learn-more node handling from the public session pods.
Filed crbug.com/1007193 to get rid of public account pods.

Also Added restart at the end of enrollment if device policy has public
accounts. This should fix most of the cases.

One rare case when WebUI public accounts will be shown: After enterprise
enrollment (w/o public accounts) device policy changes to have public
accounts. This should trigger public session pods on the WebUI login
screen.

Bug: 1000990, 943720
Change-Id: Ib9672821ef8fec303fc83c3d5f57952fb7f90c4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1820800
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Reviewed-by: default avatarDenis Kuznetsov <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699384}
parent db99d60f
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "chromeos/dbus/dbus_method_call_status.h" #include "chromeos/dbus/dbus_method_call_status.h"
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/user_manager/user_manager.h"
#include "google_apis/gaia/gaia_auth_util.h" #include "google_apis/gaia/gaia_auth_util.h"
using policy::EnrollmentConfig; using policy::EnrollmentConfig;
...@@ -83,6 +84,40 @@ std::string GetLicenseIdByType(::policy::LicenseType type) { ...@@ -83,6 +84,40 @@ std::string GetLicenseIdByType(::policy::LicenseType type) {
} }
} }
bool HasPublicUser() {
// Some tests don't initialize the UserManager.
if (!user_manager::UserManager::IsInitialized())
return false;
for (const user_manager::User* user :
user_manager::UserManager::Get()->GetUsers()) {
if (user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT)
return true;
}
return false;
}
bool ShouldAttemptRestart() {
// Restart browser to switch from DeviceCloudPolicyManagerChromeOS to
// DeviceActiveDirectoryPolicyManager.
if (g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->IsActiveDirectoryManaged()) {
// TODO(tnagel): Refactor BrowserPolicyConnectorChromeOS so that device
// policy providers are only registered after enrollment has finished and
// thus the correct one can be picked without restarting the browser.
return true;
}
// Restart browser to switch to Views account picker if we have public
// accounts (which have user pods on the login screen).
// TODO(crbug.com/943720): Switch to Views account without Chrome restart.
if (HasPublicUser())
return true;
return false;
}
} // namespace } // namespace
namespace chromeos { namespace chromeos {
...@@ -320,16 +355,8 @@ void EnrollmentScreen::OnConfirmationClosed() { ...@@ -320,16 +355,8 @@ void EnrollmentScreen::OnConfirmationClosed() {
// either case, passing exit_callback_ directly should be safe. // either case, passing exit_callback_ directly should be safe.
ClearAuth(base::BindRepeating(exit_callback_, Result::COMPLETED)); ClearAuth(base::BindRepeating(exit_callback_, Result::COMPLETED));
// Restart browser to switch from DeviceCloudPolicyManagerChromeOS to if (ShouldAttemptRestart())
// DeviceActiveDirectoryPolicyManager.
if (g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->IsActiveDirectoryManaged()) {
// TODO(tnagel): Refactor BrowserPolicyConnectorChromeOS so that device
// policy providers are only registered after enrollment has finished and
// thus the correct one can be picked without restarting the browser.
chrome::AttemptRestart(); chrome::AttemptRestart();
}
} }
void EnrollmentScreen::OnAuthError(const GoogleServiceAuthError& error) { void EnrollmentScreen::OnAuthError(const GoogleServiceAuthError& error) {
......
...@@ -62,13 +62,6 @@ cr.define('login', function() { ...@@ -62,13 +62,6 @@ cr.define('login', function() {
*/ */
var POD_SWITCH_ANIMATION_DURATION_MS = 180; var POD_SWITCH_ANIMATION_DURATION_MS = 180;
/**
* Public session help topic identifier.
* @type {number}
* @const
*/
var HELP_TOPIC_PUBLIC_SESSION = 3041033;
/** /**
* Tab order for user pods. Update these when adding new controls. * Tab order for user pods. Update these when adding new controls.
* @enum {number} * @enum {number}
...@@ -2469,11 +2462,6 @@ cr.define('login', function() { ...@@ -2469,11 +2462,6 @@ cr.define('login', function() {
} }
}).bind(this)); }).bind(this));
var learnMore = this.querySelector('.learn-more');
learnMore.addEventListener('mousedown', stopEventPropagation);
learnMore.addEventListener('click', this.handleLearnMoreEvent);
learnMore.addEventListener('keydown', this.handleLearnMoreEvent);
var languageSelect = this.querySelector('.language-select'); var languageSelect = this.querySelector('.language-select');
languageSelect.tabIndex = UserPodTabOrder.POD_INPUT; languageSelect.tabIndex = UserPodTabOrder.POD_INPUT;
languageSelect.manuallyChanged = false; languageSelect.manuallyChanged = false;
...@@ -2592,34 +2580,6 @@ cr.define('login', function() { ...@@ -2592,34 +2580,6 @@ cr.define('login', function() {
this.update(); this.update();
}, },
/**
* Handle mouse and keyboard events for the learn more button. Triggering
* the button causes information about public sessions to be shown.
* @param {Event} event Mouse or keyboard event.
*/
handleLearnMoreEvent: function(event) {
switch (event.type) {
// Show informaton on left click. Let any other clicks propagate.
case 'click':
if (event.button != 0)
return;
break;
// Show informaton when <Return> or <Space> is pressed. Let any other
// key presses propagate.
case 'keydown':
switch (event.keyCode) {
case 13: // Return.
case 32: // Space.
break;
default:
return;
}
break;
}
chrome.send('launchHelpApp', [HELP_TOPIC_PUBLIC_SESSION]);
stopEventPropagation(event);
},
/** /**
* Transition the expanded pod from the basic to the advanced view. * Transition the expanded pod from the basic to the advanced view.
*/ */
......
...@@ -76,13 +76,6 @@ cr.define('login', function() { ...@@ -76,13 +76,6 @@ cr.define('login', function() {
*/ */
var POD_ROW_IMAGES_LOAD_TIMEOUT_MS = 3000; var POD_ROW_IMAGES_LOAD_TIMEOUT_MS = 3000;
/**
* Public session help topic identifier.
* @type {number}
* @const
*/
var HELP_TOPIC_PUBLIC_SESSION = 3041033;
/** /**
* Tab order for user pods. Update these when adding new controls. * Tab order for user pods. Update these when adding new controls.
* @enum {number} * @enum {number}
...@@ -2112,15 +2105,6 @@ cr.define('login', function() { ...@@ -2112,15 +2105,6 @@ cr.define('login', function() {
} }
}).bind(this)); }).bind(this));
var learnMore = this.querySelector('.learn-more');
learnMore.addEventListener('mousedown', stopEventPropagation);
learnMore.addEventListener('click', this.handleLearnMoreEvent);
learnMore.addEventListener('keydown', this.handleLearnMoreEvent);
learnMore = this.querySelector('.expanded-pane-learn-more');
learnMore.addEventListener('click', this.handleLearnMoreEvent);
learnMore.addEventListener('keydown', this.handleLearnMoreEvent);
var languageSelect = this.querySelector('.language-select'); var languageSelect = this.querySelector('.language-select');
languageSelect.tabIndex = UserPodTabOrder.POD_INPUT; languageSelect.tabIndex = UserPodTabOrder.POD_INPUT;
languageSelect.manuallyChanged = false; languageSelect.manuallyChanged = false;
...@@ -2233,34 +2217,6 @@ cr.define('login', function() { ...@@ -2233,34 +2217,6 @@ cr.define('login', function() {
this.update(); this.update();
}, },
/**
* Handle mouse and keyboard events for the learn more button. Triggering
* the button causes information about public sessions to be shown.
* @param {Event} event Mouse or keyboard event.
*/
handleLearnMoreEvent: function(event) {
switch (event.type) {
// Show informaton on left click. Let any other clicks propagate.
case 'click':
if (event.button != 0)
return;
break;
// Show informaton when <Return> or <Space> is pressed. Let any other
// key presses propagate.
case 'keydown':
switch (event.keyCode) {
case 13: // Return.
case 32: // Space.
break;
default:
return;
}
break;
}
chrome.send('launchHelpApp', [HELP_TOPIC_PUBLIC_SESSION]);
stopEventPropagation(event);
},
makeSpaceForExpandedPod_: function() { makeSpaceForExpandedPod_: function() {
var width = this.classList.contains('advanced') ? var width = this.classList.contains('advanced') ?
PUBLIC_EXPANDED_ADVANCED_WIDTH : PUBLIC_EXPANDED_BASIC_WIDTH; PUBLIC_EXPANDED_ADVANCED_WIDTH : PUBLIC_EXPANDED_BASIC_WIDTH;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment