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

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

Issue 337423002: Enable identity.email permission and chrome.identity.getProfileUserInfo API in stable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update permission string, getProfileUserInfo without email permission Created 6 years, 6 months 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 | « chrome/app/generated_resources.grd ('k') | 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 79a66f31f1bc5156c30b579cfe81c6ecc7829a23..aea33c62065be1b7f9c15f3c2552eb455e121c3d 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -31,6 +31,8 @@
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/common/extension.h"
+#include "extensions/common/permissions/permission_set.h"
+#include "extensions/common/permissions/permissions_data.h"
#include "google_apis/gaia/gaia_urls.h"
#include "url/gurl.h"
@@ -774,8 +776,11 @@ ExtensionFunction::ResponseAction IdentityGetProfileUserInfoFunction::Run() {
}
api::identity::ProfileUserInfo profile_user_info;
- profile_user_info.email =
- GetProfile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername);
+ if (GetExtension()->permissions_data()->HasAPIPermission(
+ APIPermission::kIdentityEmail)) {
+ profile_user_info.email =
+ GetProfile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername);
+ }
profile_user_info.id =
GetProfile()->GetPrefs()->GetString(prefs::kGoogleServicesUserAccountId);
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/extensions/api/identity/identity_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698