Commit 702ef185 authored by Sergio Villar Senin's avatar Sergio Villar Senin Committed by Commit Bot

Convert enterprise_util.cc to IdentityManager

It's currently using the SigninManager API to retrieve the currently
authenticated account's email. Replaced by the IdentityManager
equivalent API so it could eventually use the identity service.

Bug: 890777
Change-Id: Ib2b8b46f529424dd413d843fb89deb5a493a599c
Reviewed-on: https://chromium-review.googlesource.com/c/1280426Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Reviewed-by: default avatarCarlos IL <carlosil@chromium.org>
Commit-Queue: Sergio Villar <svillar@igalia.com>
Cr-Commit-Position: refs/heads/master@{#600329}
parent e8ee8dee
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h" #include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.h"
#include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_factory.h" #include "chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router_factory.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/identity_manager_factory.h"
#include "components/signin/core/browser/signin_manager.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "extensions/buildflags/buildflags.h" #include "extensions/buildflags/buildflags.h"
#include "services/identity/public/cpp/identity_manager.h"
namespace { namespace {
...@@ -32,9 +32,9 @@ extensions::SafeBrowsingPrivateEventRouter* GetEventRouter( ...@@ -32,9 +32,9 @@ extensions::SafeBrowsingPrivateEventRouter* GetEventRouter(
std::string GetUserName(const content::WebContents* web_contents) { std::string GetUserName(const content::WebContents* web_contents) {
Profile* profile = Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext()); Profile::FromBrowserContext(web_contents->GetBrowserContext());
SigninManagerBase* signin_manager = auto* identity_manager =
SigninManagerFactory::GetForProfileIfExists(profile); IdentityManagerFactory::GetForProfileIfExists(profile);
return signin_manager ? signin_manager->GetAuthenticatedAccountInfo().email return identity_manager ? identity_manager->GetPrimaryAccountInfo().email
: std::string(); : std::string();
} }
#endif // BUILDFLAG(ENABLE_EXTENSIONS) #endif // BUILDFLAG(ENABLE_EXTENSIONS)
......
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