| Index: chrome/browser/chromeos/login/session/user_session_manager.cc
|
| diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc
|
| index 246f4880e0b3262da320c88309bf6d33c15c55fb..ea046ca444a42cf901b4dd8e1dbfa9390a8922a8 100644
|
| --- a/chrome/browser/chromeos/login/session/user_session_manager.cc
|
| +++ b/chrome/browser/chromeos/login/session/user_session_manager.cc
|
| @@ -65,6 +65,8 @@
|
| #include "chrome/browser/signin/account_tracker_service_factory.h"
|
| #include "chrome/browser/signin/easy_unlock_service.h"
|
| #include "chrome/browser/signin/signin_manager_factory.h"
|
| +#include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
|
| +#include "chrome/browser/supervised_user/child_accounts/child_account_service_factory.h"
|
| #include "chrome/browser/ui/app_list/start_page_service.h"
|
| #include "chrome/browser/ui/startup/startup_browser_creator.h"
|
| #include "chrome/common/chrome_switches.h"
|
| @@ -100,6 +102,10 @@ namespace chromeos {
|
|
|
| namespace {
|
|
|
| +// Milliseconds until we timeout our attempt to fetch flags from Child Account
|
| +// Service.
|
| +static const int kFlagsFetchingLoginTimeoutMs = 1000;
|
| +
|
| // ChromeVox tutorial URL (used in place of "getting started" url when
|
| // accessibility is enabled).
|
| const char kChromeVoxTutorialURLPattern[] =
|
| @@ -313,6 +319,7 @@ void UserSessionManager::OverrideHomedir() {
|
| void UserSessionManager::RegisterPrefs(PrefRegistrySimple* registry) {
|
| registry->RegisterStringPref(prefs::kRLZBrand, std::string());
|
| registry->RegisterBooleanPref(prefs::kRLZDisabled, false);
|
| + registry->RegisterBooleanPref(prefs::kChildAccountStatusKnown, false);
|
| }
|
|
|
| UserSessionManager::UserSessionManager()
|
| @@ -325,7 +332,10 @@ UserSessionManager::UserSessionManager()
|
| session_restore_strategy_(
|
| OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN),
|
| running_easy_unlock_key_ops_(false),
|
| - should_launch_browser_(true) {
|
| + should_launch_browser_(true),
|
| + init_start_urls_was_postponed_(false),
|
| + profile_fetching_flags_(nullptr),
|
| + weak_factory_(this) {
|
| net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
|
| user_manager::UserManager::Get()->AddSessionStateObserver(this);
|
| }
|
| @@ -779,6 +789,25 @@ void UserSessionManager::OnProfilePrepared(Profile* profile,
|
| RestorePendingUserSessions();
|
| }
|
|
|
| +void UserSessionManager::OnChildAccountStatusChanged() {
|
| + StopStatusObserving();
|
| +}
|
| +
|
| +void UserSessionManager::StopStatusObserving() {
|
| + if (!profile_fetching_flags_)
|
| + return;
|
| + ChildAccountService* child_service =
|
| + ChildAccountServiceFactory::GetForProfile(profile_fetching_flags_);
|
| + if (child_service)
|
| + child_service->RemoveStatusObserver(this);
|
| + profile_fetching_flags_ = nullptr;
|
| +
|
| + if (init_start_urls_was_postponed_) {
|
| + InitializeStartUrls();
|
| + init_start_urls_was_postponed_ = false;
|
| + }
|
| +}
|
| +
|
| void UserSessionManager::CreateUserSession(const UserContext& user_context,
|
| bool has_auth_cookies) {
|
| user_context_ = user_context;
|
| @@ -1045,10 +1074,12 @@ void UserSessionManager::InitializeStartUrls() const {
|
| std::vector<std::string> start_urls;
|
|
|
| user_manager::UserManager* user_manager = user_manager::UserManager::Get();
|
| +
|
| bool can_show_getstarted_guide =
|
| user_manager->GetActiveUser()->GetType() ==
|
| user_manager::USER_TYPE_REGULAR &&
|
| !user_manager->IsCurrentUserNonCryptohomeDataEphemeral();
|
| +
|
| // Skip the default first-run behavior for public accounts.
|
| if (!user_manager->IsLoggedInAsPublicAccount()) {
|
| if (AccessibilityManager::Get()->IsSpokenFeedbackEnabled()) {
|
| @@ -1080,6 +1111,17 @@ void UserSessionManager::InitializeStartUrls() const {
|
| }
|
|
|
| bool UserSessionManager::InitializeUserSession(Profile* profile) {
|
| + ChildAccountService* child_service =
|
| + ChildAccountServiceFactory::GetForProfile(profile);
|
| + if (child_service)
|
| + child_service->AddStatusObserver(this);
|
| + base::MessageLoopProxy::current()->PostDelayedTask(
|
| + FROM_HERE,
|
| + base::Bind(&UserSessionManager::StopStatusObserving,
|
| + weak_factory_.GetWeakPtr()),
|
| + base::TimeDelta::FromMilliseconds(kFlagsFetchingLoginTimeoutMs));
|
| + profile_fetching_flags_ = profile;
|
| +
|
| user_manager::UserManager* user_manager = user_manager::UserManager::Get();
|
|
|
| // Kiosk apps has their own session initialization pipeline.
|
| @@ -1098,8 +1140,12 @@ bool UserSessionManager::InitializeUserSession(Profile* profile) {
|
| if (user_manager->IsCurrentUserNew() && !skip_post_login_screens) {
|
| // Don't specify start URLs if the administrator has configured the start
|
| // URLs via policy.
|
| - if (!SessionStartupPref::TypeIsManaged(profile->GetPrefs()))
|
| - InitializeStartUrls();
|
| + if (!SessionStartupPref::TypeIsManaged(profile->GetPrefs())) {
|
| + if (child_service && child_service->IsChildAccountStatusKnown())
|
| + InitializeStartUrls();
|
| + else
|
| + init_start_urls_was_postponed_ = true;
|
| + }
|
|
|
| // Mark the device as registered., i.e. the second part of OOBE as
|
| // completed.
|
|
|