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/policy/cloud/user_policy_signin_service_factory.h" | 5 #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/policy/browser_policy_connector.h" | 9 #include "chrome/browser/policy/browser_policy_connector.h" |
10 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 10 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
12 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
14 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 15 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
15 #include "components/user_prefs/pref_registry_syncable.h" | 16 #include "components/user_prefs/pref_registry_syncable.h" |
16 | 17 |
17 #if defined(OS_ANDROID) | 18 #if defined(OS_ANDROID) |
18 #include "chrome/browser/policy/cloud/user_policy_signin_service_android.h" | 19 #include "chrome/browser/policy/cloud/user_policy_signin_service_android.h" |
19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | |
20 #else | 20 #else |
21 #include "chrome/browser/policy/cloud/user_policy_signin_service.h" | 21 #include "chrome/browser/policy/cloud/user_policy_signin_service.h" |
22 #include "chrome/browser/signin/token_service_factory.h" | |
23 #endif | 22 #endif |
24 | 23 |
25 namespace policy { | 24 namespace policy { |
26 | 25 |
27 namespace { | 26 namespace { |
28 | 27 |
29 // Used only for testing. | 28 // Used only for testing. |
30 DeviceManagementService* g_device_management_service = NULL; | 29 DeviceManagementService* g_device_management_service = NULL; |
31 | 30 |
32 } // namespace | 31 } // namespace |
33 | 32 |
34 UserPolicySigninServiceFactory::UserPolicySigninServiceFactory() | 33 UserPolicySigninServiceFactory::UserPolicySigninServiceFactory() |
35 : BrowserContextKeyedServiceFactory( | 34 : BrowserContextKeyedServiceFactory( |
36 "UserPolicySigninService", | 35 "UserPolicySigninService", |
37 BrowserContextDependencyManager::GetInstance()) { | 36 BrowserContextDependencyManager::GetInstance()) { |
38 #if defined(OS_ANDROID) | |
39 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 37 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
40 #else | |
41 DependsOn(TokenServiceFactory::GetInstance()); | |
42 #endif | |
43 DependsOn(SigninManagerFactory::GetInstance()); | 38 DependsOn(SigninManagerFactory::GetInstance()); |
44 DependsOn(UserCloudPolicyManagerFactory::GetInstance()); | 39 DependsOn(UserCloudPolicyManagerFactory::GetInstance()); |
45 } | 40 } |
46 | 41 |
47 UserPolicySigninServiceFactory::~UserPolicySigninServiceFactory() {} | 42 UserPolicySigninServiceFactory::~UserPolicySigninServiceFactory() {} |
48 | 43 |
49 // static | 44 // static |
50 UserPolicySigninService* UserPolicySigninServiceFactory::GetForProfile( | 45 UserPolicySigninService* UserPolicySigninServiceFactory::GetForProfile( |
51 Profile* profile) { | 46 Profile* profile) { |
52 return static_cast<UserPolicySigninService*>( | 47 return static_cast<UserPolicySigninService*>( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 87 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
93 #if defined(OS_ANDROID) | 88 #if defined(OS_ANDROID) |
94 user_prefs->RegisterInt64Pref( | 89 user_prefs->RegisterInt64Pref( |
95 prefs::kLastPolicyCheckTime, | 90 prefs::kLastPolicyCheckTime, |
96 0, | 91 0, |
97 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 92 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
98 #endif | 93 #endif |
99 } | 94 } |
100 | 95 |
101 } // namespace policy | 96 } // namespace policy |
OLD | NEW |