Index: extensions/shell/browser/shell_oauth2_token_service.cc |
diff --git a/extensions/shell/browser/shell_oauth2_token_service.cc b/extensions/shell/browser/shell_oauth2_token_service.cc |
index a7422559c44b6142d385415c2d1f73d7f2d83fc2..b2a7c4ccebe1efa5ca9b3a919b2119684ac5b4d9 100644 |
--- a/extensions/shell/browser/shell_oauth2_token_service.cc |
+++ b/extensions/shell/browser/shell_oauth2_token_service.cc |
@@ -7,7 +7,7 @@ |
#include "base/logging.h" |
#include "content/public/browser/browser_context.h" |
#include "content/public/browser/browser_thread.h" |
-#include "google_apis/gaia/oauth2_access_token_fetcher_impl.h" |
+#include "extensions/shell/browser/shell_oauth2_token_service_delegate.h" |
namespace extensions { |
namespace { |
@@ -20,9 +20,9 @@ ShellOAuth2TokenService::ShellOAuth2TokenService( |
content::BrowserContext* browser_context, |
std::string account_id, |
std::string refresh_token) |
- : browser_context_(browser_context), |
- account_id_(account_id), |
- refresh_token_(refresh_token) { |
+ : OAuth2TokenService(new ShellOAuth2TokenServiceDelegate(browser_context, |
+ account_id, |
+ refresh_token)) { |
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
DCHECK(!g_instance); |
g_instance = this; |
@@ -43,28 +43,11 @@ ShellOAuth2TokenService* ShellOAuth2TokenService::GetInstance() { |
void ShellOAuth2TokenService::SetRefreshToken( |
const std::string& account_id, |
const std::string& refresh_token) { |
- account_id_ = account_id; |
- refresh_token_ = refresh_token; |
+ GetDelegate()->UpdateCredentials(account_id, refresh_token); |
} |
-bool ShellOAuth2TokenService::RefreshTokenIsAvailable( |
- const std::string& account_id) const { |
- if (account_id != account_id_) |
- return false; |
- |
- return !refresh_token_.empty(); |
-} |
- |
-OAuth2AccessTokenFetcher* ShellOAuth2TokenService::CreateAccessTokenFetcher( |
- const std::string& account_id, |
- net::URLRequestContextGetter* getter, |
- OAuth2AccessTokenConsumer* consumer) { |
- DCHECK(!refresh_token_.empty()); |
- return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token_); |
-} |
- |
-net::URLRequestContextGetter* ShellOAuth2TokenService::GetRequestContext() { |
- return browser_context_->GetRequestContext(); |
+std::string ShellOAuth2TokenService::AccountId() const { |
+ return GetAccounts()[0]; |
} |
} // namespace extensions |