OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ios/chrome/browser/signin/signin_capability.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "components/signin/core/browser/signin_error_controller.h" |
| 9 #include "components/signin/core/browser/signin_manager.h" |
| 10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 11 #include "ios/chrome/browser/signin/signin_error_controller_factory.h" |
| 12 #include "ios/chrome/browser/signin/signin_manager_factory.h" |
| 13 |
| 14 bool CanPresentAutoLogin(ios::ChromeBrowserState* browser_state) { |
| 15 // User must be signed in and not have an error. |
| 16 SigninManager* signin = |
| 17 ios::SigninManagerFactory::GetForBrowserState(browser_state); |
| 18 DCHECK(signin); |
| 19 std::string username = signin->GetAuthenticatedAccountInfo().email; |
| 20 if (!username.length()) |
| 21 return false; |
| 22 SigninErrorController* error_controller = |
| 23 ios::SigninErrorControllerFactory::GetForBrowserState(browser_state); |
| 24 DCHECK(error_controller); |
| 25 return !error_controller->HasError(); |
| 26 } |
OLD | NEW |