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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 // explicitly disabled for it. | 542 // explicitly disabled for it. |
543 if (!user_manager->IsUserLoggedIn() || | 543 if (!user_manager->IsUserLoggedIn() || |
544 !user_manager->IsLoggedInAsUserWithGaiaAccount() || | 544 !user_manager->IsLoggedInAsUserWithGaiaAccount() || |
545 user_manager->IsLoggedInAsStub()) { | 545 user_manager->IsLoggedInAsStub()) { |
546 return; | 546 return; |
547 } | 547 } |
548 | 548 |
549 const user_manager::User* user = | 549 const user_manager::User* user = |
550 ProfileHelper::Get()->GetUserByProfile(user_profile); | 550 ProfileHelper::Get()->GetUserByProfile(user_profile); |
551 DCHECK(user); | 551 DCHECK(user); |
| 552 |
| 553 if (user_manager->GetPrimaryUser() == user) { |
| 554 DCHECK(user->HasGaiaAccount()); |
| 555 SigninManagerBase* signin_manager = |
| 556 SigninManagerFactory::GetForProfile(user_profile); |
| 557 if (signin_manager->GetAuthenticatedAccountId().empty()) { |
| 558 signin_manager->SetAuthenticatedAccountInfo( |
| 559 user->GetAccountId().GetGaiaId(), |
| 560 user->GetAccountId().GetUserEmail()); |
| 561 } |
| 562 } |
| 563 |
552 if (!net::NetworkChangeNotifier::IsOffline()) { | 564 if (!net::NetworkChangeNotifier::IsOffline()) { |
553 pending_signin_restore_sessions_.erase(user->GetAccountId().GetUserEmail()); | 565 pending_signin_restore_sessions_.erase(user->GetAccountId().GetUserEmail()); |
554 RestoreAuthSessionImpl(user_profile, false /* has_auth_cookies */); | 566 RestoreAuthSessionImpl(user_profile, false /* has_auth_cookies */); |
555 } else { | 567 } else { |
556 // Even if we're online we should wait till initial | 568 // Even if we're online we should wait till initial |
557 // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may | 569 // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may |
558 // end up canceling all request when initial network connection type is | 570 // end up canceling all request when initial network connection type is |
559 // processed. See http://crbug.com/121643. | 571 // processed. See http://crbug.com/121643. |
560 pending_signin_restore_sessions_.insert( | 572 pending_signin_restore_sessions_.insert( |
561 user->GetAccountId().GetUserEmail()); | 573 user->GetAccountId().GetUserEmail()); |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 ->browser_policy_connector_chromeos() | 1926 ->browser_policy_connector_chromeos() |
1915 ->IsEnterpriseManaged()) { | 1927 ->IsEnterpriseManaged()) { |
1916 return false; | 1928 return false; |
1917 } | 1929 } |
1918 | 1930 |
1919 // Do not show end of life notification if this is a guest session | 1931 // Do not show end of life notification if this is a guest session |
1920 return !profile->IsGuestSession(); | 1932 return !profile->IsGuestSession(); |
1921 } | 1933 } |
1922 | 1934 |
1923 } // namespace chromeos | 1935 } // namespace chromeos |
OLD | NEW |