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

Unified Diff: components/proximity_auth/cryptauth/cryptauth_access_token_fetcher_impl.cc

Issue 2502343003: Moved //components/proximity_auth/cryptauth to //components/cryptauth. (Closed)
Patch Set: Fixed proto #includes. Created 4 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
Index: components/proximity_auth/cryptauth/cryptauth_access_token_fetcher_impl.cc
diff --git a/components/proximity_auth/cryptauth/cryptauth_access_token_fetcher_impl.cc b/components/proximity_auth/cryptauth/cryptauth_access_token_fetcher_impl.cc
deleted file mode 100644
index 294b2ba80f49cfb1602694974a696ff503ca4af2..0000000000000000000000000000000000000000
--- a/components/proximity_auth/cryptauth/cryptauth_access_token_fetcher_impl.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher_impl.h"
-
-namespace proximity_auth {
-
-namespace {
-
-// Returns the set of OAuth2 scopes that CryptAuth uses.
-OAuth2TokenService::ScopeSet GetScopes() {
- OAuth2TokenService::ScopeSet scopes;
- scopes.insert("https://www.googleapis.com/auth/cryptauth");
- return scopes;
-}
-
-} // namespace
-
-CryptAuthAccessTokenFetcherImpl::CryptAuthAccessTokenFetcherImpl(
- OAuth2TokenService* token_service,
- const std::string& account_id)
- : OAuth2TokenService::Consumer("cryptauth_access_token_fetcher"),
- token_service_(token_service),
- account_id_(account_id),
- fetch_started_(false) {
-}
-
-CryptAuthAccessTokenFetcherImpl::~CryptAuthAccessTokenFetcherImpl() {
-}
-
-void CryptAuthAccessTokenFetcherImpl::FetchAccessToken(
- const AccessTokenCallback& callback) {
- if (fetch_started_) {
- LOG(WARNING) << "Create an instance for each token fetched. Do not reuse.";
- callback.Run(std::string());
- return;
- }
-
- fetch_started_ = true;
- callback_ = callback;
- // This request will return a cached result if it is available, saving a
- // network round trip every time we fetch the access token.
- token_request_ = token_service_->StartRequest(account_id_, GetScopes(), this);
-}
-
-void CryptAuthAccessTokenFetcherImpl::OnGetTokenSuccess(
- const OAuth2TokenService::Request* request,
- const std::string& access_token,
- const base::Time& expiration_time) {
- callback_.Run(access_token);
-}
-
-void CryptAuthAccessTokenFetcherImpl::OnGetTokenFailure(
- const OAuth2TokenService::Request* request,
- const GoogleServiceAuthError& error) {
- callback_.Run(std::string());
-}
-
-} // namespace proximity_auth

Powered by Google App Engine
This is Rietveld 408576698