Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: chrome/browser/extensions/api/identity/identity_api.cc

Issue 759823002: Identity API: Use AccountTrackerService for account details (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Aaand update tests again to shut down properly. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/identity/identity_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/identity/identity_api.cc
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
index b00c414d6dad478dd6c061a68005fcf2f29ea9d6..c513036534cf23165900eacc94798a45d6beac61 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -11,7 +11,6 @@
#include "base/debug/trace_event.h"
#include "base/lazy_instance.h"
-#include "base/prefs/pref_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -20,13 +19,14 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/account_tracker_service_factory.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/common/extensions/api/identity.h"
-#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/common/profile_management_switches.h"
@@ -845,14 +845,15 @@ ExtensionFunction::ResponseAction IdentityGetProfileUserInfoFunction::Run() {
return RespondNow(Error(identity_constants::kOffTheRecord));
}
+ AccountTrackerService::AccountInfo account =
+ AccountTrackerServiceFactory::GetForProfile(GetProfile())
+ ->GetAccountInfo(GetPrimaryAccountId(GetProfile()));
api::identity::ProfileUserInfo profile_user_info;
if (extension()->permissions_data()->HasAPIPermission(
APIPermission::kIdentityEmail)) {
- profile_user_info.email =
- GetProfile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername);
+ profile_user_info.email = account.email;
}
- profile_user_info.id =
- GetProfile()->GetPrefs()->GetString(prefs::kGoogleServicesUserAccountId);
+ profile_user_info.id = account.gaia;
return RespondNow(OneArgument(profile_user_info.ToValue().release()));
}
« no previous file with comments | « no previous file | chrome/browser/extensions/api/identity/identity_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698