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

Unified Diff: chrome/browser/supervised_user/permission_request_creator_apiary.cc

Issue 573753002: Supervised user Apiary permission requests: Use correct API scope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: naming Created 6 years, 3 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/supervised_user/permission_request_creator_apiary.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/supervised_user/permission_request_creator_apiary.cc
diff --git a/chrome/browser/supervised_user/permission_request_creator_apiary.cc b/chrome/browser/supervised_user/permission_request_creator_apiary.cc
index afcb8569a6176ae1df18ab0a38eec859fc8db899..5209262226bd7caaa33252833d78cad5792ea387 100644
--- a/chrome/browser/supervised_user/permission_request_creator_apiary.cc
+++ b/chrome/browser/supervised_user/permission_request_creator_apiary.cc
@@ -69,15 +69,19 @@ void PermissionRequestCreatorApiary::CreatePermissionRequest(
StartFetching();
}
-void PermissionRequestCreatorApiary::StartFetching() {
- OAuth2TokenService::ScopeSet scopes;
+std::string PermissionRequestCreatorApiary::GetApiScopeToUse() const {
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kPermissionRequestApiScope)) {
- scopes.insert(CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kPermissionRequestApiScope));
+ return CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kPermissionRequestApiScope);
} else {
- scopes.insert(signin_wrapper_->GetSyncScopeToUse());
+ return signin_wrapper_->GetSyncScopeToUse();
}
+}
+
+void PermissionRequestCreatorApiary::StartFetching() {
+ OAuth2TokenService::ScopeSet scopes;
+ scopes.insert(GetApiScopeToUse());
access_token_request_ = oauth2_token_service_->StartRequest(
signin_wrapper_->GetAccountIdToUse(), scopes, this);
}
@@ -132,7 +136,7 @@ void PermissionRequestCreatorApiary::OnURLFetchComplete(
if (response_code == net::HTTP_UNAUTHORIZED && !access_token_expired_) {
access_token_expired_ = true;
OAuth2TokenService::ScopeSet scopes;
- scopes.insert(signin_wrapper_->GetSyncScopeToUse());
+ scopes.insert(GetApiScopeToUse());
oauth2_token_service_->InvalidateToken(
signin_wrapper_->GetAccountIdToUse(), scopes, access_token_);
StartFetching();
« no previous file with comments | « chrome/browser/supervised_user/permission_request_creator_apiary.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698