Commit b38bb1df authored by Jochen Eisinger's avatar Jochen Eisinger Committed by Commit Bot

Use IdentityManager to get profile signin state during first run

BUG=797948
R=msarda@chromium.org

Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ibf031e86d4e7a9385e01ac872566f63bb4564f9a
Reviewed-on: https://chromium-review.googlesource.com/1163668Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581507}
parent 52f6db43
......@@ -18,7 +18,7 @@
#include "chrome/browser/policy/profile_policy_connector_factory.h"
#include "chrome/browser/prefs/pref_service_syncable_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/extensions/app_launch_params.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/webui/chromeos/assistant_optin/assistant_optin_ui.h"
......@@ -33,7 +33,6 @@
#include "components/prefs/pref_service.h"
#include "components/signin/core/browser/account_info.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/notification_observer.h"
......@@ -42,6 +41,7 @@
#include "content/public/common/content_switches.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/constants.h"
#include "services/identity/public/cpp/identity_manager.h"
#include "ui/gfx/geometry/rect.h"
namespace chromeos {
......@@ -124,14 +124,15 @@ class DialogLauncher : public content::NotificationObserver {
// Whether the account is supported for voice interaction.
bool account_supported = false;
SigninManagerBase* signin_manager =
SigninManagerFactory::GetForProfile(profile_);
if (signin_manager) {
identity::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(profile_);
if (identity_manager) {
std::string hosted_domain =
signin_manager->GetAuthenticatedAccountInfo().hosted_domain;
identity_manager->GetPrimaryAccountInfo().hosted_domain;
if (hosted_domain == AccountTrackerService::kNoHostedDomainFound ||
hosted_domain == "google.com")
hosted_domain == "google.com") {
account_supported = true;
}
}
#if BUILDFLAG(ENABLE_CROS_LIBASSISTANT)
......
......@@ -35,7 +35,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
......@@ -51,7 +50,6 @@
#include "chrome/installer/util/master_preferences_constants.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
......
......@@ -48,6 +48,7 @@ source_set("first_run") {
"//ios/third_party/material_components_ios",
"//ios/third_party/material_roboto_font_loader_ios",
"//ios/web",
"//services/identity/public/cpp:cpp",
"//ui/base",
"//ui/gfx",
"//url",
......
......@@ -11,19 +11,19 @@
#include "base/strings/sys_string_conversions.h"
#include "base/task/post_task.h"
#include "base/time/time.h"
#include "components/signin/core/browser/signin_manager.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/crash_report/breakpad_helper.h"
#include "ios/chrome/browser/first_run/first_run.h"
#import "ios/chrome/browser/first_run/first_run_configuration.h"
#include "ios/chrome/browser/first_run/first_run_metrics.h"
#include "ios/chrome/browser/signin/signin_manager_factory.h"
#include "ios/chrome/browser/signin/identity_manager_factory.h"
#include "ios/chrome/browser/tabs/tab.h"
#include "ios/chrome/browser/ui/first_run/first_run_histograms.h"
#import "ios/chrome/browser/ui/settings/settings_utils.h"
#import "ios/chrome/browser/ui/settings/sync_utils/sync_util.h"
#include "ios/chrome/browser/ui/ui_util.h"
#include "ios/web/public/web_thread.h"
#include "services/identity/public/cpp/identity_manager.h"
#import "ui/gfx/ios/NSString+CrStringDrawing.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
......@@ -94,9 +94,8 @@ void RecordFirstRunMetricsInternal(ios::ChromeBrowserState* browserState,
bool sign_in_attempted,
bool has_sso_accounts) {
first_run::SignInStatus sign_in_status;
bool user_signed_in =
ios::SigninManagerFactory::GetForBrowserState(browserState)
->IsAuthenticated();
bool user_signed_in = IdentityManagerFactory::GetForBrowserState(browserState)
->HasPrimaryAccount();
if (user_signed_in) {
sign_in_status = has_sso_accounts
? first_run::HAS_SSO_ACCOUNT_SIGNIN_SUCCESSFUL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment