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 #include "google_apis/gaia/dummy_identity_provider.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "google_apis/gaia/oauth2_token_service.h" |
| 10 |
| 11 class DummyIdentityProvider::DummyOAuth2TokenService |
| 12 : public OAuth2TokenService { |
| 13 public: |
| 14 DummyOAuth2TokenService(); |
| 15 virtual ~DummyOAuth2TokenService(); |
| 16 |
| 17 // OAuth2TokenService: |
| 18 virtual bool RefreshTokenIsAvailable( |
| 19 const std::string& account_id) const OVERRIDE; |
| 20 virtual void FetchOAuth2Token(RequestImpl* request, |
| 21 const std::string& account_id, |
| 22 net::URLRequestContextGetter* getter, |
| 23 const std::string& client_id, |
| 24 const std::string& client_secret, |
| 25 const ScopeSet& scopes) OVERRIDE; |
| 26 virtual OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( |
| 27 const std::string& account_id, |
| 28 net::URLRequestContextGetter* getter, |
| 29 OAuth2AccessTokenConsumer* consumer) OVERRIDE; |
| 30 |
| 31 private: |
| 32 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
| 33 |
| 34 DISALLOW_COPY_AND_ASSIGN(DummyOAuth2TokenService); |
| 35 }; |
| 36 |
| 37 |
| 38 DummyIdentityProvider::DummyOAuth2TokenService::DummyOAuth2TokenService() { |
| 39 } |
| 40 |
| 41 DummyIdentityProvider::DummyOAuth2TokenService::~DummyOAuth2TokenService() { |
| 42 } |
| 43 |
| 44 bool DummyIdentityProvider::DummyOAuth2TokenService::RefreshTokenIsAvailable( |
| 45 const std::string& account_id) const { |
| 46 return false; |
| 47 } |
| 48 |
| 49 void DummyIdentityProvider::DummyOAuth2TokenService::FetchOAuth2Token( |
| 50 RequestImpl* request, |
| 51 const std::string& account_id, |
| 52 net::URLRequestContextGetter* getter, |
| 53 const std::string& client_id, |
| 54 const std::string& client_secret, |
| 55 const ScopeSet& scopes) { |
| 56 // Ignore the fetch request. |
| 57 } |
| 58 |
| 59 OAuth2AccessTokenFetcher* |
| 60 DummyIdentityProvider::DummyOAuth2TokenService::CreateAccessTokenFetcher( |
| 61 const std::string& account_id, |
| 62 net::URLRequestContextGetter* getter, |
| 63 OAuth2AccessTokenConsumer* consumer) { |
| 64 return NULL; |
| 65 } |
| 66 |
| 67 net::URLRequestContextGetter* |
| 68 DummyIdentityProvider::DummyOAuth2TokenService::GetRequestContext() { |
| 69 return NULL; |
| 70 } |
| 71 |
| 72 DummyIdentityProvider::DummyIdentityProvider() |
| 73 : oauth2_token_service_(new DummyOAuth2TokenService) { |
| 74 } |
| 75 |
| 76 DummyIdentityProvider::~DummyIdentityProvider() { |
| 77 } |
| 78 |
| 79 std::string DummyIdentityProvider::GetActiveUsername() { |
| 80 return std::string(); |
| 81 } |
| 82 |
| 83 std::string DummyIdentityProvider::GetActiveAccountId() { |
| 84 return std::string(); |
| 85 } |
| 86 |
| 87 OAuth2TokenService* DummyIdentityProvider::GetTokenService() { |
| 88 return oauth2_token_service_.get(); |
| 89 } |
| 90 |
| 91 bool DummyIdentityProvider::RequestLogin() { |
| 92 return false; |
| 93 } |
OLD | NEW |