Eliminate Identity Service interface knowing about CoreAccountInfo

CoreAccountInfo is exposed in the Identity Service mojo interfaces
(via typemapping). However, it is actually part of the browser-side
IdentityManager C++ interfaces, and thus it should not be exposed as
part of the cross-process Identity Service mojo interfaces. This is
a concrete blocker to an upcoming restructuring of //components/signin
that will move account_info.h to
//components/signin/public/identity_manager, which depends on
//services/identity/public:cpp_types.

This CL eliminates this problem by expanding the identity_accessor.mojom
interfaces in question to simply pass the CoreAccountId, gaia ID, and
email address explicitly. I judged that this approach was better than
either using a naked Mojo struct for the Identity Service's
core_account_info.mojom or creating a duplicate CoreAccountInfo C++
type to typemap it to. The former approach is unwieldy and the latter
would introduce unnecessary confusion into the codebase.

Bug: 952788
Change-Id: I27be60cdc95687b201be03069d1e7f41c431d4b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1688840
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676018}
diff --git a/chromeos/components/drivefs/BUILD.gn b/chromeos/components/drivefs/BUILD.gn
index 1410789..16c1846 100644
--- a/chromeos/components/drivefs/BUILD.gn
+++ b/chromeos/components/drivefs/BUILD.gn
@@ -76,6 +76,7 @@
     "//base/test:test_support",
     "//chromeos/components/drivefs/mojom",
     "//chromeos/disks:test_support",
+    "//components/account_id",
     "//components/drive",
     "//components/invalidation/impl:test_support",
     "//mojo/public/cpp/bindings",
diff --git a/chromeos/components/drivefs/drivefs_auth.cc b/chromeos/components/drivefs/drivefs_auth.cc
index 296f0b7..3b5991d 100644
--- a/chromeos/components/drivefs/drivefs_auth.cc
+++ b/chromeos/components/drivefs/drivefs_auth.cc
@@ -59,7 +59,9 @@
       &DriveFsAuth::AccountReady, weak_ptr_factory_.GetWeakPtr()));
 }
 
-void DriveFsAuth::AccountReady(const CoreAccountInfo& info,
+void DriveFsAuth::AccountReady(const CoreAccountId& account_id,
+                               const std::string& gaia,
+                               const std::string& email,
                                const identity::AccountState& state) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   weak_ptr_factory_.InvalidateWeakPtrs();
diff --git a/chromeos/components/drivefs/drivefs_auth.h b/chromeos/components/drivefs/drivefs_auth.h
index 94d4c6cc..8346bf0e 100644
--- a/chromeos/components/drivefs/drivefs_auth.h
+++ b/chromeos/components/drivefs/drivefs_auth.h
@@ -72,7 +72,9 @@
       mojom::DriveFsDelegate::GetAccessTokenCallback callback);
 
  private:
-  void AccountReady(const CoreAccountInfo& info,
+  void AccountReady(const CoreAccountId& account_id,
+                    const std::string& gaia,
+                    const std::string& email,
                     const identity::AccountState& state);
 
   void GotChromeAccessToken(const base::Optional<std::string>& access_token,
diff --git a/chromeos/components/drivefs/drivefs_auth_unittest.cc b/chromeos/components/drivefs/drivefs_auth_unittest.cc
index 7eeecdda..075f697 100644
--- a/chromeos/components/drivefs/drivefs_auth_unittest.cc
+++ b/chromeos/components/drivefs/drivefs_auth_unittest.cc
@@ -12,6 +12,7 @@
 #include "base/test/scoped_task_environment.h"
 #include "base/test/simple_test_clock.h"
 #include "base/timer/mock_timer.h"
+#include "components/account_id/account_id.h"
 #include "services/identity/public/mojom/constants.mojom.h"
 #include "services/identity/public/mojom/identity_accessor.mojom-test-utils.h"
 #include "services/network/public/cpp/shared_url_loader_factory.h"
@@ -107,11 +108,9 @@
       return;
     }
     auto account_id = AccountId::FromUserEmailGaiaId("test@example.com", "ID");
-    CoreAccountInfo account_info;
-    account_info.email = account_id.GetUserEmail();
-    account_info.gaia = account_id.GetGaiaId();
-    account_info.account_id = account_id.GetAccountIdKey();
-    std::move(callback).Run(account_info, {});
+    std::move(callback).Run(CoreAccountId(account_id.GetAccountIdKey()),
+                            account_id.GetGaiaId(), account_id.GetUserEmail(),
+                            {});
   }
 
   void GetAccessToken(const CoreAccountId& account_id,
diff --git a/chromeos/components/drivefs/drivefs_host_unittest.cc b/chromeos/components/drivefs/drivefs_host_unittest.cc
index 0cb6c56..93b590c 100644
--- a/chromeos/components/drivefs/drivefs_host_unittest.cc
+++ b/chromeos/components/drivefs/drivefs_host_unittest.cc
@@ -228,11 +228,9 @@
   void GetPrimaryAccountWhenAvailable(
       GetPrimaryAccountWhenAvailableCallback callback) override {
     auto account_id = AccountId::FromUserEmailGaiaId("test@example.com", "ID");
-    CoreAccountInfo account_info;
-    account_info.email = account_id.GetUserEmail();
-    account_info.gaia = account_id.GetGaiaId();
-    account_info.account_id = account_id.GetAccountIdKey();
-    std::move(callback).Run(account_info, {});
+    std::move(callback).Run(CoreAccountId(account_id.GetAccountIdKey()),
+                            account_id.GetGaiaId(), account_id.GetUserEmail(),
+                            {});
   }
 
   void GetAccessToken(const CoreAccountId& account_id,
diff --git a/chromeos/services/assistant/BUILD.gn b/chromeos/services/assistant/BUILD.gn
index 1fb5132..75fdc06 100644
--- a/chromeos/services/assistant/BUILD.gn
+++ b/chromeos/services/assistant/BUILD.gn
@@ -41,6 +41,7 @@
     "//chromeos/dbus/power:power_manager_proto",
     "//chromeos/services/assistant/public/proto",
     "//components/account_id",
+    "//components/user_manager",
     "//services/device/public/mojom",
     "//services/identity/public/mojom",
     "//services/network/public/cpp:cpp",
diff --git a/chromeos/services/assistant/service.cc b/chromeos/services/assistant/service.cc
index 9d8add4..6d62a07 100644
--- a/chromeos/services/assistant/service.cc
+++ b/chromeos/services/assistant/service.cc
@@ -26,6 +26,7 @@
 #include "chromeos/services/assistant/fake_assistant_manager_service_impl.h"
 #include "chromeos/services/assistant/fake_assistant_settings_manager_impl.h"
 #include "chromeos/services/assistant/public/features.h"
+#include "components/user_manager/known_user.h"
 #include "google_apis/gaia/google_service_auth_error.h"
 #include "services/identity/public/cpp/scope_set.h"
 #include "services/identity/public/mojom/constants.mojom.h"
@@ -289,22 +290,30 @@
 }
 
 void Service::GetPrimaryAccountInfoCallback(
-    const base::Optional<CoreAccountInfo>& account_info,
+    const base::Optional<CoreAccountId>& account_id,
+    const base::Optional<std::string>& gaia,
+    const base::Optional<std::string>& email,
     const identity::AccountState& account_state) {
-  if (!account_info.has_value() || !account_state.has_refresh_token ||
-      account_info.value().gaia.empty()) {
+  // Validate the remotely-supplied parameters before using them below: if
+  // |account_id| is non-null, the other two should be non-null as well per
+  // the stated contract of IdentityAccessor::GetPrimaryAccountInfo().
+  CHECK((!account_id.has_value() || (gaia.has_value() && email.has_value())));
+
+  if (!account_id.has_value() || !account_state.has_refresh_token ||
+      gaia->empty()) {
     LOG(ERROR) << "Failed to retrieve primary account info.";
     RetryRefreshToken();
     return;
   }
-  account_id_ = AccountIdFromAccountInfo(account_info.value());
+  account_id_ = user_manager::known_user::GetAccountId(*email, *gaia,
+                                                       AccountType::GOOGLE);
   identity::ScopeSet scopes;
   scopes.insert(kScopeAssistant);
   scopes.insert(kScopeAuthGcm);
   if (features::IsClearCutLogEnabled())
     scopes.insert(kScopeClearCutLog);
   identity_accessor_->GetAccessToken(
-      account_info.value().account_id, scopes, "cros_assistant",
+      *account_id, scopes, "cros_assistant",
       base::BindOnce(&Service::GetAccessTokenCallback, base::Unretained(this)));
 }
 
diff --git a/chromeos/services/assistant/service.h b/chromeos/services/assistant/service.h
index 846a9333..4d1981cf 100644
--- a/chromeos/services/assistant/service.h
+++ b/chromeos/services/assistant/service.h
@@ -148,7 +148,9 @@
   identity::mojom::IdentityAccessor* GetIdentityAccessor();
 
   void GetPrimaryAccountInfoCallback(
-      const base::Optional<CoreAccountInfo>& account_info,
+      const base::Optional<CoreAccountId>& account_id,
+      const base::Optional<std::string>& gaia,
+      const base::Optional<std::string>& email,
       const identity::AccountState& account_state);
 
   void GetAccessTokenCallback(const base::Optional<std::string>& token,
diff --git a/chromeos/services/assistant/service_unittest.cc b/chromeos/services/assistant/service_unittest.cc
index 0e69aa1..7b88a2c 100644
--- a/chromeos/services/assistant/service_unittest.cc
+++ b/chromeos/services/assistant/service_unittest.cc
@@ -57,16 +57,15 @@
  private:
   // identity::mojom::IdentityAccessor:
   void GetPrimaryAccountInfo(GetPrimaryAccountInfoCallback callback) override {
-    CoreAccountInfo account_info;
-    account_info.account_id = "account_id";
-    account_info.gaia = "fakegaiaid";
-    account_info.email = "fake@email";
+    CoreAccountId account_id("account_id");
+    std::string gaia = "fakegaiaid";
+    std::string email = "fake@email";
 
     identity::AccountState account_state;
     account_state.has_refresh_token = true;
     account_state.is_primary_account = true;
 
-    std::move(callback).Run(account_info, account_state);
+    std::move(callback).Run(account_id, gaia, email, account_state);
   }
 
   void GetPrimaryAccountWhenAvailable(
diff --git a/ios/chrome/browser/browser_state/browser_state_services_egtest.mm b/ios/chrome/browser/browser_state/browser_state_services_egtest.mm
index 8b1dbca8..ac82feb 100644
--- a/ios/chrome/browser/browser_state/browser_state_services_egtest.mm
+++ b/ios/chrome/browser/browser_state/browser_state_services_egtest.mm
@@ -28,9 +28,11 @@
 // invoked.
 void OnGotPrimaryAccountInfo(
     bool* get_primary_account_info_callback_called_flag,
-    const base::Optional<CoreAccountInfo>& account_info,
+    const base::Optional<CoreAccountId>& account_id,
+    const base::Optional<std::string>& gaia,
+    const base::Optional<std::string>& email,
     const identity::AccountState& account_state) {
-  GREYAssert(!account_info, @"AccountInfo has unexpected value");
+  GREYAssert(!account_id, @"AccountId has unexpected value");
   *get_primary_account_info_callback_called_flag = true;
 }
 
diff --git a/services/identity/identity_accessor_impl.cc b/services/identity/identity_accessor_impl.cc
index 9b86b2f..f1df1ba9 100644
--- a/services/identity/identity_accessor_impl.cc
+++ b/services/identity/identity_accessor_impl.cc
@@ -10,7 +10,6 @@
 #include "base/time/time.h"
 #include "components/signin/public/identity_manager/access_token_info.h"
 #include "google_apis/gaia/google_service_auth_error.h"
-#include "services/identity/public/mojom/account.mojom.h"
 
 namespace identity {
 
@@ -44,7 +43,8 @@
     GetPrimaryAccountInfoCallback callback) {
   CoreAccountInfo account_info = identity_manager_->GetPrimaryAccountInfo();
   AccountState account_state = GetStateOfAccount(account_info);
-  std::move(callback).Run(account_info, account_state);
+  std::move(callback).Run(account_info.account_id, account_info.gaia,
+                          account_info.email, account_state);
 }
 
 void IdentityAccessorImpl::GetPrimaryAccountWhenAvailable(
@@ -62,7 +62,8 @@
   DCHECK(!account_info.account_id.empty());
   DCHECK(!account_info.email.empty());
   DCHECK(!account_info.gaia.empty());
-  std::move(callback).Run(account_info, account_state);
+  std::move(callback).Run(account_info.account_id, account_info.gaia,
+                          account_info.email, account_state);
 }
 
 void IdentityAccessorImpl::GetAccessToken(const CoreAccountId& account_id,
@@ -115,7 +116,8 @@
       DCHECK(!account_info->gaia.empty());
 
       for (auto&& callback : primary_account_available_callbacks_) {
-        std::move(callback).Run(account_info.value(), account_state);
+        std::move(callback).Run(account_info->account_id, account_info->gaia,
+                                account_info->email, account_state);
       }
       primary_account_available_callbacks_.clear();
     }
diff --git a/services/identity/identity_accessor_impl_unittest.cc b/services/identity/identity_accessor_impl_unittest.cc
index 3ba65d8..a672b68e7 100644
--- a/services/identity/identity_accessor_impl_unittest.cc
+++ b/services/identity/identity_accessor_impl_unittest.cc
@@ -11,7 +11,6 @@
 #include "services/identity/identity_service.h"
 #include "services/identity/public/cpp/account_state.h"
 #include "services/identity/public/cpp/scope_set.h"
-#include "services/identity/public/mojom/account.mojom.h"
 #include "services/identity/public/mojom/constants.mojom.h"
 #include "services/identity/public/mojom/identity_accessor.mojom.h"
 #include "services/service_manager/public/cpp/binder_registry.h"
@@ -44,9 +43,20 @@
 
   void OnReceivedPrimaryAccountInfo(
       base::RepeatingClosure quit_closure,
-      const base::Optional<CoreAccountInfo>& account_info,
+      const base::Optional<CoreAccountId>& account_id,
+      const base::Optional<std::string>& gaia,
+      const base::Optional<std::string>& email,
       const AccountState& account_state) {
-    primary_account_info_ = account_info;
+    base::Optional<CoreAccountInfo> received_info;
+
+    if (account_id) {
+      received_info = CoreAccountInfo();
+      received_info->account_id = account_id.value();
+      received_info->gaia = gaia.value();
+      received_info->email = email.value();
+    }
+
+    primary_account_info_ = received_info;
     primary_account_state_ = account_state;
     quit_closure.Run();
   }
@@ -54,20 +64,17 @@
   void OnPrimaryAccountAvailable(base::RepeatingClosure quit_closure,
                                  CoreAccountInfo* caller_account_info,
                                  AccountState* caller_account_state,
-                                 const CoreAccountInfo& account_info,
+                                 const CoreAccountId& account_id,
+                                 const std::string& gaia,
+                                 const std::string& email,
                                  const AccountState& account_state) {
-    *caller_account_info = account_info;
+    caller_account_info->account_id = account_id;
+    caller_account_info->gaia = gaia;
+    caller_account_info->email = email;
     *caller_account_state = account_state;
     quit_closure.Run();
   }
 
-  void OnGotAccounts(base::RepeatingClosure quit_closure,
-                     std::vector<mojom::AccountPtr>* output,
-                     std::vector<mojom::AccountPtr> accounts) {
-    *output = std::move(accounts);
-    quit_closure.Run();
-  }
-
   void OnReceivedAccessToken(base::RepeatingClosure quit_closure,
                              const base::Optional<std::string>& access_token,
                              base::Time expiration_time,
diff --git a/services/identity/public/cpp/account_info.typemap b/services/identity/public/cpp/account_info.typemap
deleted file mode 100644
index 7b6a947a..0000000
--- a/services/identity/public/cpp/account_info.typemap
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-mojom = "//services/identity/public/mojom/core_account_info.mojom"
-public_headers = [ "//components/signin/core/browser/account_info.h" ]
-traits_headers =
-    [ "//services/identity/public/cpp/core_account_info_mojom_traits.h" ]
-sources = [
-  "//services/identity/public/cpp/core_account_info_mojom_traits.cc",
-]
-public_deps = [
-  # TODO(blundell): In the long term, any files from //components/signin that
-  # are exposed to consumers of the Identity Service should move to be part of
-  # the client library of the Identity Service.
-  "//components/signin/core/browser:shared",
-]
-
-type_mappings = [ "identity.mojom.CoreAccountInfo=::CoreAccountInfo" ]
diff --git a/services/identity/public/cpp/core_account_info_mojom_traits.cc b/services/identity/public/cpp/core_account_info_mojom_traits.cc
deleted file mode 100644
index b388afa..0000000
--- a/services/identity/public/cpp/core_account_info_mojom_traits.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "services/identity/public/cpp/core_account_info_mojom_traits.h"
-
-#include "services/identity/public/cpp/core_account_id_mojom_traits.h"
-
-namespace mojo {
-
-// static
-bool StructTraits<
-    identity::mojom::CoreAccountInfo::DataView,
-    ::CoreAccountInfo>::Read(identity::mojom::CoreAccountInfo::DataView data,
-                             ::CoreAccountInfo* out) {
-  CoreAccountId account_id;
-  std::string gaia;
-  std::string email;
-
-  if (!data.ReadAccountId(&account_id) || !data.ReadGaia(&gaia) ||
-      !data.ReadEmail(&email)) {
-    return false;
-  }
-
-  out->account_id = account_id;
-  out->gaia = gaia;
-  out->email = email;
-
-  return true;
-}
-
-// static
-bool StructTraits<identity::mojom::CoreAccountInfo::DataView,
-                  ::CoreAccountInfo>::IsNull(const ::CoreAccountInfo& input) {
-  // Note that a CoreAccountInfo being null cannot be defined as
-  // CoreAccountInfo::IsEmpty(), as IsEmpty() verifies that *all* fields are
-  // empty, which is not enough to ensure that only valid (i.e. fully filled)
-  // CoreAccountInfo are passed.
-  return input.account_id.empty() || input.gaia.empty() || input.email.empty();
-}
-
-}  // namespace mojo
diff --git a/services/identity/public/cpp/core_account_info_mojom_traits.h b/services/identity/public/cpp/core_account_info_mojom_traits.h
deleted file mode 100644
index 85e4675..0000000
--- a/services/identity/public/cpp/core_account_info_mojom_traits.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SERVICES_IDENTITY_PUBLIC_CPP_CORE_ACCOUNT_INFO_MOJOM_TRAITS_H_
-#define SERVICES_IDENTITY_PUBLIC_CPP_CORE_ACCOUNT_INFO_MOJOM_TRAITS_H_
-
-#include <string>
-
-#include "components/signin/core/browser/account_info.h"
-#include "services/identity/public/mojom/core_account_info.mojom.h"
-
-namespace mojo {
-
-template <>
-struct StructTraits<identity::mojom::CoreAccountInfo::DataView,
-                    ::CoreAccountInfo> {
-  static const CoreAccountId& account_id(const ::CoreAccountInfo& r) {
-    return r.account_id;
-  }
-
-  static const std::string& gaia(const ::CoreAccountInfo& r) { return r.gaia; }
-
-  static const std::string& email(const ::CoreAccountInfo& r) {
-    return r.email;
-  }
-
-  static bool Read(identity::mojom::CoreAccountInfo::DataView data,
-                   ::CoreAccountInfo* out);
-
-  static bool IsNull(const ::CoreAccountInfo& input);
-
-  static void SetToNull(::CoreAccountInfo* output) {
-    *output = CoreAccountInfo();
-  }
-};
-
-}  // namespace mojo
-
-#endif  // SERVICES_IDENTITY_PUBLIC_CPP_CORE_ACCOUNT_INFO_MOJOM_TRAITS_H_
diff --git a/services/identity/public/cpp/typemaps.gni b/services/identity/public/cpp/typemaps.gni
index f9ee1786..8f5a706 100644
--- a/services/identity/public/cpp/typemaps.gni
+++ b/services/identity/public/cpp/typemaps.gni
@@ -1,5 +1,4 @@
 typemaps = [
-  "//services/identity/public/cpp/account_info.typemap",
   "//services/identity/public/cpp/account_state.typemap",
   "//services/identity/public/cpp/core_account_id.typemap",
   "//services/identity/public/cpp/google_service_auth_error.typemap",
diff --git a/services/identity/public/mojom/BUILD.gn b/services/identity/public/mojom/BUILD.gn
index c5b758a..a4dc4fa 100644
--- a/services/identity/public/mojom/BUILD.gn
+++ b/services/identity/public/mojom/BUILD.gn
@@ -6,10 +6,8 @@
 
 mojom("mojom") {
   sources = [
-    "account.mojom",
     "account_state.mojom",
     "core_account_id.mojom",
-    "core_account_info.mojom",
     "google_service_auth_error.mojom",
     "identity_accessor.mojom",
     "scope_set.mojom",
diff --git a/services/identity/public/mojom/account.mojom b/services/identity/public/mojom/account.mojom
deleted file mode 100644
index 33e356e..0000000
--- a/services/identity/public/mojom/account.mojom
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-module identity.mojom;
-
-import "services/identity/public/mojom/core_account_info.mojom";
-import "services/identity/public/mojom/account_state.mojom";
-
-// Represents a user's Google account on this device.
-struct Account {
-  // The details of the account.
-  CoreAccountInfo info;
-
-  // The current state of the account on this device.
-  AccountState state;
-};
diff --git a/services/identity/public/mojom/core_account_info.mojom b/services/identity/public/mojom/core_account_info.mojom
deleted file mode 100644
index a08ce8bc..0000000
--- a/services/identity/public/mojom/core_account_info.mojom
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-module identity.mojom;
-
-import "services/identity/public/mojom/core_account_id.mojom";
-
-// Information about a specific Google account. A valid CoreAccountInfo will
-// always have an account ID, gaia ID, and email address.
-struct CoreAccountInfo {
-  // The account ID used by OAuth2TokenService. This is an opaque identifier
-  // that represents this account within Chrome.
-  CoreAccountId account_id;
-  // The GAIA ID corresponding to this account.
-  string gaia;
-  // The email address corresponding to this account.
-  string email;
-};
diff --git a/services/identity/public/mojom/identity_accessor.mojom b/services/identity/public/mojom/identity_accessor.mojom
index 8974cf6..7007a41 100644
--- a/services/identity/public/mojom/identity_accessor.mojom
+++ b/services/identity/public/mojom/identity_accessor.mojom
@@ -5,29 +5,32 @@
 module identity.mojom;
 
 import "mojo/public/mojom/base/time.mojom";
-import "services/identity/public/mojom/account.mojom";
 import "services/identity/public/mojom/core_account_id.mojom";
-import "services/identity/public/mojom/core_account_info.mojom";
 import "services/identity/public/mojom/account_state.mojom";
 import "services/identity/public/mojom/google_service_auth_error.mojom";
 import "services/identity/public/mojom/scope_set.mojom";
 
 // Gives access to information about the user's Google accounts.
 interface IdentityAccessor {
-  // Returns the CoreAccountInfo for the Google account that serves as the
-  // user's primary account, or null if the user has no primary account (e.g.,
-  // if they are not signed in). |account_state| gives the current state of the
-  // account (relevant only if |account_info| is non-null).
-  GetPrimaryAccountInfo() => (CoreAccountInfo? account_info,
+  // Returns the information for the Google account that serves as the
+  // user's primary account. |account_id|, |gaia|, and |email| will be null if
+  // the user has no primary account (e.g., if they are not signed in).
+  // |account_state| gives the current state of the account (relevant only if
+  // |account_id| is non-null).
+  GetPrimaryAccountInfo() => (CoreAccountId? account_id,
+                              string? gaia,
+                              string? email,
                               AccountState account_state);
 
-  // Returns the CoreAccountInfo for the Google account that serves as the
+  // Returns the information for the Google account that serves as the
   // user's primary account once this account is available (i.e., the user is
   // signed in, a refresh token is available, and the refresh token is in a
   // non-error state). |account_state| gives the current state of the account.
   // Overlapping requests are permitted; all pending requests will be called
   // back when the primary account is available.
-  GetPrimaryAccountWhenAvailable() => (CoreAccountInfo account_info,
+  GetPrimaryAccountWhenAvailable() => (CoreAccountId account_id,
+                                       string gaia,
+                                       string email,
                                        AccountState account_state);
 
   // Returns an access token with the requested scopes for the given