OLD | NEW |
---|---|
(Empty) | |
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 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_READONLY_TOKEN_FETCHER_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_READONLY_TOKEN_FETCHER_H_ | |
7 | |
8 #include <queue> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/callback.h" | |
12 #include "base/threading/thread_checker.h" | |
13 #include "base/time/time.h" | |
14 #include "google_apis/drive/auth_service_interface.h" | |
15 #include "google_apis/gaia/oauth2_token_service.h" | |
16 | |
17 namespace drive { | |
18 | |
19 // OAuthTokenFetcher caches OAuth access tokens and refreshes them as needed. | |
20 class DriveReadonlyTokenFetcher : public OAuth2TokenService::Consumer { | |
kinaba
2014/07/09 06:02:47
This class looks almost functionally identical to
| |
21 public: | |
22 DriveReadonlyTokenFetcher( | |
23 const std::string& account_id, | |
24 OAuth2TokenService* oauth2_token_service, | |
25 const google_apis::AuthStatusCallback& callback); | |
26 virtual ~DriveReadonlyTokenFetcher(); | |
27 | |
28 private: | |
29 // Overridden from OAuth2TokenService::Consumer: | |
30 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | |
31 const std::string& access_token, | |
32 const base::Time& expiration_time) OVERRIDE; | |
33 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | |
34 const GoogleServiceAuthError& error) OVERRIDE; | |
35 | |
36 google_apis::AuthStatusCallback callback_; | |
37 scoped_ptr<OAuth2TokenService::Request> request_; | |
38 base::ThreadChecker thread_checker_; | |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(DriveReadonlyTokenFetcher); | |
41 }; | |
42 | |
43 } // namespace drive | |
44 | |
45 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_READONLY_TOKEN_FETCHER_H_ | |
OLD | NEW |