This source file includes following definitions.
- Get
- Initialize
- Shutdown
#include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
#include "chrome/browser/chromeos/settings/token_encryptor.h"
#include "chromeos/cryptohome/system_salt_getter.h"
#include "content/public/browser/browser_thread.h"
namespace chromeos {
namespace {
static DeviceOAuth2TokenService* g_device_oauth2_token_service_ = NULL;
}
DeviceOAuth2TokenService* DeviceOAuth2TokenServiceFactory::Get() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
return g_device_oauth2_token_service_;
}
void DeviceOAuth2TokenServiceFactory::Initialize() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK(!g_device_oauth2_token_service_);
g_device_oauth2_token_service_ = new DeviceOAuth2TokenService(
g_browser_process->system_request_context(),
g_browser_process->local_state());
}
void DeviceOAuth2TokenServiceFactory::Shutdown() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (g_device_oauth2_token_service_) {
delete g_device_oauth2_token_service_;
g_device_oauth2_token_service_ = NULL;
}
}
}