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

Unified Diff: chrome/browser/extensions/permissions_updater.cc

Issue 11066125: Check that the user is signed in and the app has oauth2 section before recording an aouth2 grant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/permissions_updater.cc
===================================================================
--- chrome/browser/extensions/permissions_updater.cc (revision 161131)
+++ chrome/browser/extensions/permissions_updater.cc (working copy)
@@ -138,8 +138,19 @@
extension->location() != Extension::INTERNAL)
Evan Stade 2012/10/16 04:33:21 ^
return;
- if (record_oauth2_grant)
- new OAuth2GrantRecorder(profile_, extension);
+ if (record_oauth2_grant) {
+ // Only record OAuth grant if:
+ // 1. The extension has client id and scopes.
+ // 2. The user is signed in to Chrome.
+ const Extension::OAuth2Info& oauth2_info = extension->oauth2_info();
+ if (!oauth2_info.client_id.empty() && !oauth2_info.scopes.empty()) {
+ TokenService* token_service = TokenServiceFactory::GetForProfile(
+ profile_);
+ if (token_service && token_service->HasOAuthLoginToken()) {
Evan Stade 2012/10/16 01:21:26 no curlies :(
+ new OAuth2GrantRecorder(profile_, extension);
+ }
+ }
+ }
GetExtensionPrefs()->AddGrantedPermissions(extension->id(),
extension->GetActivePermissions());
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698