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