summaryrefslogtreecommitdiffstats
path: root/google_apis/gaia/oauth2_access_token_consumer.h
blob: 65d32e85ab119b0db2b345a2d94476fa65f439c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) 2012 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.

#ifndef GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_CONSUMER_H_
#define GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_CONSUMER_H_

#include <string>

class GoogleServiceAuthError;

namespace base {
class Time;
}

// An interface that defines the callbacks for consumers to which
// OAuth2AccessTokenFetcher can return results.
class OAuth2AccessTokenConsumer {
 public:
  // Success callback. |access_token| will contain a valid OAuth2 access token.
  // |expiration_time| is the date until which the token can be used. This
  // value has a built-in safety margin, so it can be used as-is.
  virtual void OnGetTokenSuccess(const std::string& access_token,
                                 const base::Time& expiration_time) {}
  virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) {}

 protected:
  virtual ~OAuth2AccessTokenConsumer() {}
};

#endif  // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_CONSUMER_H_