| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/signin/android_profile_oauth2_token_service.h" | 5 #include "chrome/browser/signin/android_profile_oauth2_token_service.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // - the expiry time of the token (may be null, indicating that the expiry | 32 // - the expiry time of the token (may be null, indicating that the expiry |
| 33 // time is unknown. | 33 // time is unknown. |
| 34 typedef base::Callback<void( | 34 typedef base::Callback<void( |
| 35 const GoogleServiceAuthError&, const std::string&, const base::Time&)> | 35 const GoogleServiceAuthError&, const std::string&, const base::Time&)> |
| 36 FetchOAuth2TokenCallback; | 36 FetchOAuth2TokenCallback; |
| 37 | 37 |
| 38 class AndroidAccessTokenFetcher : public OAuth2AccessTokenFetcher { | 38 class AndroidAccessTokenFetcher : public OAuth2AccessTokenFetcher { |
| 39 public: | 39 public: |
| 40 AndroidAccessTokenFetcher(OAuth2AccessTokenConsumer* consumer, | 40 AndroidAccessTokenFetcher(OAuth2AccessTokenConsumer* consumer, |
| 41 const std::string& account_id); | 41 const std::string& account_id); |
| 42 virtual ~AndroidAccessTokenFetcher(); | 42 ~AndroidAccessTokenFetcher() override; |
| 43 | 43 |
| 44 // Overrides from OAuth2AccessTokenFetcher: | 44 // Overrides from OAuth2AccessTokenFetcher: |
| 45 virtual void Start(const std::string& client_id, | 45 void Start(const std::string& client_id, |
| 46 const std::string& client_secret, | 46 const std::string& client_secret, |
| 47 const std::vector<std::string>& scopes) override; | 47 const std::vector<std::string>& scopes) override; |
| 48 virtual void CancelRequest() override; | 48 void CancelRequest() override; |
| 49 | 49 |
| 50 // Handles an access token response. | 50 // Handles an access token response. |
| 51 void OnAccessTokenResponse(const GoogleServiceAuthError& error, | 51 void OnAccessTokenResponse(const GoogleServiceAuthError& error, |
| 52 const std::string& access_token, | 52 const std::string& access_token, |
| 53 const base::Time& expiration_time); | 53 const base::Time& expiration_time); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 std::string CombineScopes(const std::vector<std::string>& scopes); | 56 std::string CombineScopes(const std::vector<std::string>& scopes); |
| 57 | 57 |
| 58 std::string account_id_; | 58 std::string account_id_; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 GoogleServiceAuthError err(result ? | 469 GoogleServiceAuthError err(result ? |
| 470 GoogleServiceAuthError::NONE : | 470 GoogleServiceAuthError::NONE : |
| 471 GoogleServiceAuthError::CONNECTION_FAILED); | 471 GoogleServiceAuthError::CONNECTION_FAILED); |
| 472 heap_callback->Run(err, token, base::Time()); | 472 heap_callback->Run(err, token, base::Time()); |
| 473 } | 473 } |
| 474 | 474 |
| 475 // static | 475 // static |
| 476 bool AndroidProfileOAuth2TokenService::Register(JNIEnv* env) { | 476 bool AndroidProfileOAuth2TokenService::Register(JNIEnv* env) { |
| 477 return RegisterNativesImpl(env); | 477 return RegisterNativesImpl(env); |
| 478 } | 478 } |
| OLD | NEW |