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 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1533 EasyUnlockKeyManager* key_manager = GetEasyUnlockKeyManager(); | 1533 EasyUnlockKeyManager* key_manager = GetEasyUnlockKeyManager(); |
1534 running_easy_unlock_key_ops_ = true; | 1534 running_easy_unlock_key_ops_ = true; |
1535 key_manager->RefreshKeys( | 1535 key_manager->RefreshKeys( |
1536 user_context, *device_list, | 1536 user_context, *device_list, |
1537 base::Bind(&UserSessionManager::OnEasyUnlockKeyOpsFinished, AsWeakPtr(), | 1537 base::Bind(&UserSessionManager::OnEasyUnlockKeyOpsFinished, AsWeakPtr(), |
1538 user_context.GetAccountId().GetUserEmail())); | 1538 user_context.GetAccountId().GetUserEmail())); |
1539 } | 1539 } |
1540 | 1540 |
1541 net::URLRequestContextGetter* | 1541 net::URLRequestContextGetter* |
1542 UserSessionManager::GetAuthRequestContext() const { | 1542 UserSessionManager::GetAuthRequestContext() const { |
1543 net::URLRequestContextGetter* auth_request_context = nullptr; | 1543 net::URLRequestContextGetter* auth_request_context = nullptr; |
achuithb
2016/04/07 18:39:48
Get rid of auth_request_context
jdufault
2016/12/07 00:27:55
Done.
| |
1544 | 1544 |
1545 if (StartupUtils::IsWebviewSigninEnabled()) { | 1545 content::StoragePartition* signin_partition = login::GetSigninPartition(); |
1546 // Webview uses different partition storage than iframe. We need to get | 1546 if (signin_partition) |
achuithb
2016/04/07 18:39:48
invert and return nullptr
jdufault
2016/12/07 00:27:55
Done.
| |
1547 // cookies from the right storage for url request to get auth token into | 1547 auth_request_context = signin_partition->GetURLRequestContext(); |
achuithb
2016/04/07 18:39:48
return
jdufault
2016/12/07 00:27:55
Done.
| |
1548 // session. | 1548 |
1549 content::StoragePartition* signin_partition = login::GetSigninPartition(); | |
1550 if (signin_partition) | |
1551 auth_request_context = signin_partition->GetURLRequestContext(); | |
1552 } else if (authenticator_.get() && authenticator_->authentication_context()) { | |
1553 auth_request_context = | |
1554 authenticator_->authentication_context()->GetRequestContext(); | |
1555 } | |
1556 return auth_request_context; | 1549 return auth_request_context; |
1557 } | 1550 } |
1558 | 1551 |
1559 void UserSessionManager::AttemptRestart(Profile* profile) { | 1552 void UserSessionManager::AttemptRestart(Profile* profile) { |
1560 // Restart unconditionally in case if we are stuck somewhere in a session | 1553 // Restart unconditionally in case if we are stuck somewhere in a session |
1561 // restore process. http://crbug.com/520346. | 1554 // restore process. http://crbug.com/520346. |
1562 base::MessageLoop::current()->PostDelayedTask( | 1555 base::MessageLoop::current()->PostDelayedTask( |
1563 FROM_HERE, base::Bind(RestartOnTimeout), | 1556 FROM_HERE, base::Bind(RestartOnTimeout), |
1564 base::TimeDelta::FromSeconds(kMaxRestartDelaySeconds)); | 1557 base::TimeDelta::FromSeconds(kMaxRestartDelaySeconds)); |
1565 | 1558 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1749 if (is_enterprise_managed) | 1742 if (is_enterprise_managed) |
1750 display = USER_PODS_DISPLAY_DISABLED_MANAGED; | 1743 display = USER_PODS_DISPLAY_DISABLED_MANAGED; |
1751 else | 1744 else |
1752 display = USER_PODS_DISPLAY_DISABLED_REGULAR; | 1745 display = USER_PODS_DISPLAY_DISABLED_REGULAR; |
1753 } | 1746 } |
1754 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, | 1747 UMA_HISTOGRAM_ENUMERATION("UserSessionManager.UserPodsDisplay", display, |
1755 NUM_USER_PODS_DISPLAY); | 1748 NUM_USER_PODS_DISPLAY); |
1756 } | 1749 } |
1757 | 1750 |
1758 void UserSessionManager::OnOAuth2TokensFetched(UserContext context) { | 1751 void UserSessionManager::OnOAuth2TokensFetched(UserContext context) { |
1759 if (StartupUtils::IsWebviewSigninEnabled() && TokenHandlesEnabled()) { | 1752 if (TokenHandlesEnabled()) { |
achuithb
2016/04/07 18:39:48
Invert and return early
jdufault
2016/12/07 00:27:55
Done.
| |
1760 CreateTokenUtilIfMissing(); | 1753 CreateTokenUtilIfMissing(); |
1761 if (token_handle_util_->ShouldObtainHandle(context.GetAccountId())) { | 1754 if (token_handle_util_->ShouldObtainHandle(context.GetAccountId())) { |
1762 token_handle_fetcher_.reset(new TokenHandleFetcher( | 1755 token_handle_fetcher_.reset(new TokenHandleFetcher( |
1763 token_handle_util_.get(), context.GetAccountId())); | 1756 token_handle_util_.get(), context.GetAccountId())); |
1764 token_handle_fetcher_->FillForNewUser( | 1757 token_handle_fetcher_->FillForNewUser( |
1765 context.GetAccessToken(), | 1758 context.GetAccessToken(), |
1766 base::Bind(&UserSessionManager::OnTokenHandleObtained, | 1759 base::Bind(&UserSessionManager::OnTokenHandleObtained, |
1767 weak_factory_.GetWeakPtr())); | 1760 weak_factory_.GetWeakPtr())); |
1768 } | 1761 } |
1769 } | 1762 } |
(...skipping 29 matching lines...) Expand all Loading... | |
1799 token_handle_util_.reset(); | 1792 token_handle_util_.reset(); |
1800 first_run::GoodiesDisplayer::Delete(); | 1793 first_run::GoodiesDisplayer::Delete(); |
1801 } | 1794 } |
1802 | 1795 |
1803 void UserSessionManager::CreateTokenUtilIfMissing() { | 1796 void UserSessionManager::CreateTokenUtilIfMissing() { |
1804 if (!token_handle_util_.get()) | 1797 if (!token_handle_util_.get()) |
1805 token_handle_util_.reset(new TokenHandleUtil()); | 1798 token_handle_util_.reset(new TokenHandleUtil()); |
1806 } | 1799 } |
1807 | 1800 |
1808 } // namespace chromeos | 1801 } // namespace chromeos |
OLD | NEW |