OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/session/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/about_flags.h" | 25 #include "chrome/browser/about_flags.h" |
26 #include "chrome/browser/app_mode/app_mode_utils.h" | 26 #include "chrome/browser/app_mode/app_mode_utils.h" |
27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
28 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 28 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
29 #include "chrome/browser/browser_shutdown.h" | 29 #include "chrome/browser/browser_shutdown.h" |
30 #include "chrome/browser/chrome_notification_types.h" | 30 #include "chrome/browser/chrome_notification_types.h" |
31 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 31 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
32 #include "chrome/browser/chromeos/base/locale_util.h" | 32 #include "chrome/browser/chromeos/base/locale_util.h" |
33 #include "chrome/browser/chromeos/boot_times_recorder.h" | 33 #include "chrome/browser/chromeos/boot_times_recorder.h" |
34 #include "chrome/browser/chromeos/first_run/first_run.h" | 34 #include "chrome/browser/chromeos/first_run/first_run.h" |
| 35 #include "chrome/browser/chromeos/first_run/goodies_displayer.h" |
35 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 36 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
36 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" | 37 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" |
37 #include "chrome/browser/chromeos/login/chrome_restart_request.h" | 38 #include "chrome/browser/chromeos/login/chrome_restart_request.h" |
38 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 39 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
39 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" | 40 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" |
40 #include "chrome/browser/chromeos/login/helper.h" | 41 #include "chrome/browser/chromeos/login/helper.h" |
41 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 42 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
42 #include "chrome/browser/chromeos/login/profile_auth_data.h" | 43 #include "chrome/browser/chromeos/login/profile_auth_data.h" |
43 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" | 44 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter.h" |
44 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory
.h" | 45 #include "chrome/browser/chromeos/login/saml/saml_offline_signin_limiter_factory
.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 true /* path is absolute */, | 344 true /* path is absolute */, |
344 false /* don't create */); | 345 false /* don't create */); |
345 } | 346 } |
346 } | 347 } |
347 } | 348 } |
348 | 349 |
349 // static | 350 // static |
350 void UserSessionManager::RegisterPrefs(PrefRegistrySimple* registry) { | 351 void UserSessionManager::RegisterPrefs(PrefRegistrySimple* registry) { |
351 registry->RegisterStringPref(prefs::kRLZBrand, std::string()); | 352 registry->RegisterStringPref(prefs::kRLZBrand, std::string()); |
352 registry->RegisterBooleanPref(prefs::kRLZDisabled, false); | 353 registry->RegisterBooleanPref(prefs::kRLZDisabled, false); |
| 354 registry->RegisterBooleanPref(prefs::kCanShowOobeGoodiesPage, true); |
353 } | 355 } |
354 | 356 |
355 UserSessionManager::UserSessionManager() | 357 UserSessionManager::UserSessionManager() |
356 : delegate_(nullptr), | 358 : delegate_(nullptr), |
357 authenticator_(nullptr), | 359 authenticator_(nullptr), |
358 has_auth_cookies_(false), | 360 has_auth_cookies_(false), |
359 user_sessions_restored_(false), | 361 user_sessions_restored_(false), |
360 user_sessions_restore_in_progress_(false), | 362 user_sessions_restore_in_progress_(false), |
361 exit_after_session_restore_(false), | 363 exit_after_session_restore_(false), |
362 session_restore_strategy_( | 364 session_restore_strategy_( |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 profile, base::Bind(&UserSessionManager::OnTokenHandleObtained, | 1132 profile, base::Bind(&UserSessionManager::OnTokenHandleObtained, |
1131 weak_factory_.GetWeakPtr())); | 1133 weak_factory_.GetWeakPtr())); |
1132 } | 1134 } |
1133 } | 1135 } |
1134 } | 1136 } |
1135 | 1137 |
1136 // Now that profile is ready, proceed to either alternative login flows or | 1138 // Now that profile is ready, proceed to either alternative login flows or |
1137 // launch browser. | 1139 // launch browser. |
1138 bool browser_launched = InitializeUserSession(profile); | 1140 bool browser_launched = InitializeUserSession(profile); |
1139 | 1141 |
| 1142 // Check whether to, then set up for, display OOBE Goodies page on first run. |
| 1143 first_run::GoodiesDisplayer::Init(); |
| 1144 |
1140 // TODO(nkostylev): This pointer should probably never be NULL, but it looks | 1145 // TODO(nkostylev): This pointer should probably never be NULL, but it looks |
1141 // like OnProfileCreated() may be getting called before | 1146 // like OnProfileCreated() may be getting called before |
1142 // UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is | 1147 // UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is |
1143 // killed during shutdown in tests -- see http://crosbug.com/18269. Replace | 1148 // killed during shutdown in tests -- see http://crosbug.com/18269. Replace |
1144 // this 'if' statement with a CHECK(delegate_) once the underlying issue is | 1149 // this 'if' statement with a CHECK(delegate_) once the underlying issue is |
1145 // resolved. | 1150 // resolved. |
1146 if (delegate_) | 1151 if (delegate_) |
1147 delegate_->OnProfilePrepared(profile, browser_launched); | 1152 delegate_->OnProfilePrepared(profile, browser_launched); |
1148 } | 1153 } |
1149 | 1154 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 content::StoragePartition* signin_partition = login::GetSigninPartition(); | 1516 content::StoragePartition* signin_partition = login::GetSigninPartition(); |
1512 if (signin_partition) | 1517 if (signin_partition) |
1513 auth_request_context = signin_partition->GetURLRequestContext(); | 1518 auth_request_context = signin_partition->GetURLRequestContext(); |
1514 } else if (authenticator_.get() && authenticator_->authentication_context()) { | 1519 } else if (authenticator_.get() && authenticator_->authentication_context()) { |
1515 auth_request_context = | 1520 auth_request_context = |
1516 authenticator_->authentication_context()->GetRequestContext(); | 1521 authenticator_->authentication_context()->GetRequestContext(); |
1517 } | 1522 } |
1518 return auth_request_context; | 1523 return auth_request_context; |
1519 } | 1524 } |
1520 | 1525 |
| 1526 void UserSessionManager::CreateGoodiesDisplayer() { |
| 1527 if (goodies_displayer_ == nullptr) |
| 1528 goodies_displayer_.reset(new first_run::GoodiesDisplayer); |
| 1529 } |
| 1530 |
| 1531 void UserSessionManager::DestroyGoodiesDisplayer() { |
| 1532 goodies_displayer_.reset(); |
| 1533 } |
| 1534 |
1521 void UserSessionManager::AttemptRestart(Profile* profile) { | 1535 void UserSessionManager::AttemptRestart(Profile* profile) { |
1522 // Restart unconditionally in case if we are stuck somewhere in a session | 1536 // Restart unconditionally in case if we are stuck somewhere in a session |
1523 // restore process. http://crbug.com/520346. | 1537 // restore process. http://crbug.com/520346. |
1524 base::MessageLoop::current()->PostDelayedTask( | 1538 base::MessageLoop::current()->PostDelayedTask( |
1525 FROM_HERE, base::Bind(RestartOnTimeout), | 1539 FROM_HERE, base::Bind(RestartOnTimeout), |
1526 base::TimeDelta::FromSeconds(kMaxRestartDelaySeconds)); | 1540 base::TimeDelta::FromSeconds(kMaxRestartDelaySeconds)); |
1527 | 1541 |
1528 if (CheckEasyUnlockKeyOps(base::Bind(&UserSessionManager::AttemptRestart, | 1542 if (CheckEasyUnlockKeyOps(base::Bind(&UserSessionManager::AttemptRestart, |
1529 AsWeakPtr(), profile))) { | 1543 AsWeakPtr(), profile))) { |
1530 return; | 1544 return; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled, | 1761 cros_settings->GetBoolean(kAccountsPrefEphemeralUsersEnabled, |
1748 &ephemeral_users_enabled); | 1762 &ephemeral_users_enabled); |
1749 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, | 1763 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, |
1750 &show_names_on_signin); | 1764 &show_names_on_signin); |
1751 return show_names_on_signin && !ephemeral_users_enabled; | 1765 return show_names_on_signin && !ephemeral_users_enabled; |
1752 } | 1766 } |
1753 | 1767 |
1754 void UserSessionManager::Shutdown() { | 1768 void UserSessionManager::Shutdown() { |
1755 token_handle_fetcher_.reset(); | 1769 token_handle_fetcher_.reset(); |
1756 token_handle_util_.reset(); | 1770 token_handle_util_.reset(); |
| 1771 goodies_displayer_.reset(); |
1757 } | 1772 } |
1758 | 1773 |
1759 void UserSessionManager::CreateTokenUtilIfMissing() { | 1774 void UserSessionManager::CreateTokenUtilIfMissing() { |
1760 if (!token_handle_util_.get()) | 1775 if (!token_handle_util_.get()) |
1761 token_handle_util_.reset( | 1776 token_handle_util_.reset( |
1762 new TokenHandleUtil(user_manager::UserManager::Get())); | 1777 new TokenHandleUtil(user_manager::UserManager::Get())); |
1763 } | 1778 } |
1764 | 1779 |
1765 } // namespace chromeos | 1780 } // namespace chromeos |
OLD | NEW |