EME test page application.
[chromium-blink-merge.git] / chrome / browser / chromeos / settings / device_oauth2_token_service_factory.cc
blob8cc874667b287a2072de1c2d1664e0d23c4b0ba0
1 // Copyright (c) 2012 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 "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h"
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
9 #include "chrome/browser/chromeos/settings/token_encryptor.h"
10 #include "chromeos/cryptohome/system_salt_getter.h"
11 #include "content/public/browser/browser_thread.h"
13 namespace chromeos {
15 namespace {
17 static DeviceOAuth2TokenService* g_device_oauth2_token_service_ = NULL;
19 } // namespace
21 // static
22 DeviceOAuth2TokenService* DeviceOAuth2TokenServiceFactory::Get() {
23 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
24 return g_device_oauth2_token_service_;
27 // static
28 void DeviceOAuth2TokenServiceFactory::Initialize() {
29 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
30 DCHECK(!g_device_oauth2_token_service_);
31 g_device_oauth2_token_service_ = new DeviceOAuth2TokenService(
32 g_browser_process->system_request_context(),
33 g_browser_process->local_state());
36 // static
37 void DeviceOAuth2TokenServiceFactory::Shutdown() {
38 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
39 if (g_device_oauth2_token_service_) {
40 delete g_device_oauth2_token_service_;
41 g_device_oauth2_token_service_ = NULL;
45 } // namespace chromeos