Commit 48cafafc authored by Yue Li's avatar Yue Li Committed by Commit Bot

Use SignInManager to get AccountInfo in first run

There seems to be a regression on M70 head that get AccountInfo using
identity_manager->GetPrimaryAccountInfo() always return empty
hosted_domain field. Using signin_manager->GetAuthenticatedAccountInfo()
seems to be a more stable way.

Bug: b/116746192
Test: Local build
Change-Id: I8369787b4f8d33e63d4029705d9f3f02c1a0376d
Reviewed-on: https://chromium-review.googlesource.com/c/1278526Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599348}
parent cdef2348
......@@ -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/identity_manager_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/extensions/app_launch_params.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/common/chrome_switches.h"
......@@ -31,6 +31,7 @@
#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_base.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/notification_observer.h"
......@@ -39,7 +40,6 @@
#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 {
......@@ -122,11 +122,11 @@ class DialogLauncher : public content::NotificationObserver {
// Whether the account is supported for voice interaction.
bool account_supported = false;
identity::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(profile_);
if (identity_manager) {
SigninManagerBase* signin_manager =
SigninManagerFactory::GetForProfileIfExists(profile_);
if (signin_manager) {
std::string hosted_domain =
identity_manager->GetPrimaryAccountInfo().hosted_domain;
signin_manager->GetAuthenticatedAccountInfo().hosted_domain;
if (hosted_domain == AccountTrackerService::kNoHostedDomainFound ||
hosted_domain == "google.com") {
account_supported = true;
......
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