OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 5 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 8 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 | 10 |
11 namespace chromeos { | 11 namespace chromeos { |
12 | 12 |
13 static DeviceOAuth2TokenService* g_device_oauth2_token_service_ = NULL; | 13 static DeviceOAuth2TokenService* g_device_oauth2_token_service_ = NULL; |
14 | 14 |
15 DeviceOAuth2TokenServiceFactory::DeviceOAuth2TokenServiceFactory() { | 15 DeviceOAuth2TokenServiceFactory::DeviceOAuth2TokenServiceFactory() { |
16 } | 16 } |
17 | 17 |
18 // static | 18 // static |
19 DeviceOAuth2TokenService* DeviceOAuth2TokenServiceFactory::Get() { | 19 DeviceOAuth2TokenService* DeviceOAuth2TokenServiceFactory::Get() { |
20 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 20 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
21 return g_device_oauth2_token_service_; | 21 return g_device_oauth2_token_service_; |
22 } | 22 } |
23 | 23 |
24 // static | 24 // static |
25 void DeviceOAuth2TokenServiceFactory::Initialize() { | 25 void DeviceOAuth2TokenServiceFactory::Initialize() { |
26 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 26 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
27 DCHECK(!g_device_oauth2_token_service_); | 27 DCHECK(!g_device_oauth2_token_service_); |
28 g_device_oauth2_token_service_ = new DeviceOAuth2TokenService( | 28 g_device_oauth2_token_service_ = new DeviceOAuth2TokenService( |
29 g_browser_process->system_request_context(), | 29 g_browser_process->system_request_context(), |
30 g_browser_process->local_state()); | 30 g_browser_process->local_state(), |
| 31 new CryptohomeTokenEncryptor); |
31 } | 32 } |
32 | 33 |
33 // static | 34 // static |
34 void DeviceOAuth2TokenServiceFactory::Shutdown() { | 35 void DeviceOAuth2TokenServiceFactory::Shutdown() { |
35 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 36 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
36 if (g_device_oauth2_token_service_) { | 37 if (g_device_oauth2_token_service_) { |
37 delete g_device_oauth2_token_service_; | 38 delete g_device_oauth2_token_service_; |
38 g_device_oauth2_token_service_ = NULL; | 39 g_device_oauth2_token_service_ = NULL; |
39 } | 40 } |
40 } | 41 } |
41 | 42 |
42 } // namespace chromeos | 43 } // namespace chromeos |
OLD | NEW |