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 "chrome/browser/chromeos/settings/token_encryptor.h" |
9 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
10 | 11 |
11 namespace chromeos { | 12 namespace chromeos { |
12 | 13 |
13 static DeviceOAuth2TokenService* g_device_oauth2_token_service_ = NULL; | 14 static DeviceOAuth2TokenService* g_device_oauth2_token_service_ = NULL; |
14 | 15 |
15 DeviceOAuth2TokenServiceFactory::DeviceOAuth2TokenServiceFactory() { | 16 DeviceOAuth2TokenServiceFactory::DeviceOAuth2TokenServiceFactory() { |
16 } | 17 } |
17 | 18 |
18 // static | 19 // static |
19 DeviceOAuth2TokenService* DeviceOAuth2TokenServiceFactory::Get() { | 20 DeviceOAuth2TokenService* DeviceOAuth2TokenServiceFactory::Get() { |
20 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 21 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
21 return g_device_oauth2_token_service_; | 22 return g_device_oauth2_token_service_; |
22 } | 23 } |
23 | 24 |
24 // static | 25 // static |
25 void DeviceOAuth2TokenServiceFactory::Initialize() { | 26 void DeviceOAuth2TokenServiceFactory::Initialize() { |
26 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 27 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
27 DCHECK(!g_device_oauth2_token_service_); | 28 DCHECK(!g_device_oauth2_token_service_); |
28 g_device_oauth2_token_service_ = new DeviceOAuth2TokenService( | 29 g_device_oauth2_token_service_ = new DeviceOAuth2TokenService( |
29 g_browser_process->system_request_context(), | 30 g_browser_process->system_request_context(), |
30 g_browser_process->local_state()); | 31 g_browser_process->local_state(), |
| 32 new CryptohomeTokenEncryptor); |
31 } | 33 } |
32 | 34 |
33 // static | 35 // static |
34 void DeviceOAuth2TokenServiceFactory::Shutdown() { | 36 void DeviceOAuth2TokenServiceFactory::Shutdown() { |
35 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 37 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
36 if (g_device_oauth2_token_service_) { | 38 if (g_device_oauth2_token_service_) { |
37 delete g_device_oauth2_token_service_; | 39 delete g_device_oauth2_token_service_; |
38 g_device_oauth2_token_service_ = NULL; | 40 g_device_oauth2_token_service_ = NULL; |
39 } | 41 } |
40 } | 42 } |
41 | 43 |
42 } // namespace chromeos | 44 } // namespace chromeos |
OLD | NEW |