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.
5 #include "extensions/shell/browser/shell_oauth2_token_service.h"
7 #include "base/logging.h"
8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/browser_thread.h"
10 #include "extensions/shell/browser/shell_oauth2_token_service_delegate.h"
12 namespace extensions
{
15 ShellOAuth2TokenService
* g_instance
= nullptr;
19 ShellOAuth2TokenService::ShellOAuth2TokenService(
20 content::BrowserContext
* browser_context
,
21 std::string account_id
,
22 std::string refresh_token
)
23 : OAuth2TokenService(new ShellOAuth2TokenServiceDelegate(browser_context
,
26 DCHECK_CURRENTLY_ON(content::BrowserThread::UI
);
31 ShellOAuth2TokenService::~ShellOAuth2TokenService() {
32 DCHECK_CURRENTLY_ON(content::BrowserThread::UI
);
38 ShellOAuth2TokenService
* ShellOAuth2TokenService::GetInstance() {
43 void ShellOAuth2TokenService::SetRefreshToken(
44 const std::string
& account_id
,
45 const std::string
& refresh_token
) {
46 GetDelegate()->UpdateCredentials(account_id
, refresh_token
);
49 std::string
ShellOAuth2TokenService::AccountId() const {
50 return GetAccounts()[0];
53 } // namespace extensions