| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 if (exit_after_session_restore_ && | 794 if (exit_after_session_restore_ && |
| 795 (state == OAuth2LoginManager::SESSION_RESTORE_DONE || | 795 (state == OAuth2LoginManager::SESSION_RESTORE_DONE || |
| 796 state == OAuth2LoginManager::SESSION_RESTORE_FAILED || | 796 state == OAuth2LoginManager::SESSION_RESTORE_FAILED || |
| 797 state == OAuth2LoginManager::SESSION_RESTORE_CONNECTION_FAILED)) { | 797 state == OAuth2LoginManager::SESSION_RESTORE_CONNECTION_FAILED)) { |
| 798 LOG(WARNING) << "Restarting Chrome after session restore finishes, " | 798 LOG(WARNING) << "Restarting Chrome after session restore finishes, " |
| 799 << "most likely due to custom flags."; | 799 << "most likely due to custom flags."; |
| 800 | 800 |
| 801 // We need to restart cleanly in this case to make sure OAuth2 RT is | 801 // We need to restart cleanly in this case to make sure OAuth2 RT is |
| 802 // actually saved. | 802 // actually saved. |
| 803 chrome::AttemptRestart(); | 803 chrome::AttemptRestart(); |
| 804 } else { |
| 805 // Schedule another flush after session restore for non-ephemeral profile |
| 806 // if not restarting. |
| 807 if (!ProfileHelper::IsEphemeralUserProfile(user_profile)) |
| 808 ProfileHelper::Get()->FlushProfile(user_profile); |
| 804 } | 809 } |
| 805 } | 810 } |
| 806 | 811 |
| 807 void UserSessionManager::OnConnectionTypeChanged( | 812 void UserSessionManager::OnConnectionTypeChanged( |
| 808 net::NetworkChangeNotifier::ConnectionType type) { | 813 net::NetworkChangeNotifier::ConnectionType type) { |
| 809 bool is_running_test = | 814 bool is_running_test = |
| 810 base::CommandLine::ForCurrentProcess()->HasSwitch( | 815 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 811 ::switches::kTestName) || | 816 ::switches::kTestName) || |
| 812 base::CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType); | 817 base::CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType); |
| 813 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 818 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 } | 1173 } |
| 1169 } | 1174 } |
| 1170 | 1175 |
| 1171 // Now that profile is ready, proceed to either alternative login flows or | 1176 // Now that profile is ready, proceed to either alternative login flows or |
| 1172 // launch browser. | 1177 // launch browser. |
| 1173 bool browser_launched = InitializeUserSession(profile); | 1178 bool browser_launched = InitializeUserSession(profile); |
| 1174 | 1179 |
| 1175 // If needed, create browser observer to display first run OOBE Goodies page. | 1180 // If needed, create browser observer to display first run OOBE Goodies page. |
| 1176 first_run::GoodiesDisplayer::Init(); | 1181 first_run::GoodiesDisplayer::Init(); |
| 1177 | 1182 |
| 1183 // Schedule a flush if profile is not ephemeral. |
| 1184 if (!ProfileHelper::IsEphemeralUserProfile(profile)) |
| 1185 ProfileHelper::Get()->FlushProfile(profile); |
| 1186 |
| 1178 // TODO(nkostylev): This pointer should probably never be NULL, but it looks | 1187 // TODO(nkostylev): This pointer should probably never be NULL, but it looks |
| 1179 // like OnProfileCreated() may be getting called before | 1188 // like OnProfileCreated() may be getting called before |
| 1180 // UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is | 1189 // UserSessionManager::PrepareProfile() has set |delegate_| when Chrome is |
| 1181 // killed during shutdown in tests -- see http://crosbug.com/18269. Replace | 1190 // killed during shutdown in tests -- see http://crosbug.com/18269. Replace |
| 1182 // this 'if' statement with a CHECK(delegate_) once the underlying issue is | 1191 // this 'if' statement with a CHECK(delegate_) once the underlying issue is |
| 1183 // resolved. | 1192 // resolved. |
| 1184 if (delegate_) | 1193 if (delegate_) |
| 1185 delegate_->OnProfilePrepared(profile, browser_launched); | 1194 delegate_->OnProfilePrepared(profile, browser_launched); |
| 1186 } | 1195 } |
| 1187 | 1196 |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 token_handle_util_.reset(); | 1808 token_handle_util_.reset(); |
| 1800 first_run::GoodiesDisplayer::Delete(); | 1809 first_run::GoodiesDisplayer::Delete(); |
| 1801 } | 1810 } |
| 1802 | 1811 |
| 1803 void UserSessionManager::CreateTokenUtilIfMissing() { | 1812 void UserSessionManager::CreateTokenUtilIfMissing() { |
| 1804 if (!token_handle_util_.get()) | 1813 if (!token_handle_util_.get()) |
| 1805 token_handle_util_.reset(new TokenHandleUtil()); | 1814 token_handle_util_.reset(new TokenHandleUtil()); |
| 1806 } | 1815 } |
| 1807 | 1816 |
| 1808 } // namespace chromeos | 1817 } // namespace chromeos |
| OLD | NEW |