sync_auth_provider.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SYNC_ENGINE_SYNC_AUTH_PROVIDER_H_
  5. #define COMPONENTS_SYNC_ENGINE_SYNC_AUTH_PROVIDER_H_
  6. #include <string>
  7. #include "base/callback.h"
  8. class GoogleServiceAuthError;
  9. namespace syncer {
  10. // SyncAuthProvider is interface to access token related functions from sync
  11. // engine.
  12. class SyncAuthProvider {
  13. public:
  14. using RequestTokenCallback =
  15. base::OnceCallback<void(const GoogleServiceAuthError& error,
  16. const std::string& token)>;
  17. virtual ~SyncAuthProvider() = default;
  18. // Request access token for sync. Callback will be called with error and
  19. // access token. If error is anything other than NONE then token is invalid.
  20. virtual void RequestAccessToken(RequestTokenCallback callback) = 0;
  21. // Invalidate access token that was rejected by sync server.
  22. virtual void InvalidateAccessToken(const std::string& token) = 0;
  23. };
  24. } // namespace syncer
  25. #endif // COMPONENTS_SYNC_ENGINE_SYNC_AUTH_PROVIDER_H_