| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_cloud_policy_invalidator_factory.h" | 5 #include "chrome/browser/policy/cloud/user_cloud_policy_invalidator_factory.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 8 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 9 #include "chrome/browser/policy/cloud/user_cloud_policy_invalidator.h" | 9 #include "chrome/browser/policy/cloud/user_cloud_policy_invalidator.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #endif | 37 #endif |
| 38 } | 38 } |
| 39 | 39 |
| 40 UserCloudPolicyInvalidatorFactory::~UserCloudPolicyInvalidatorFactory() {} | 40 UserCloudPolicyInvalidatorFactory::~UserCloudPolicyInvalidatorFactory() {} |
| 41 | 41 |
| 42 KeyedService* UserCloudPolicyInvalidatorFactory::BuildServiceInstanceFor( | 42 KeyedService* UserCloudPolicyInvalidatorFactory::BuildServiceInstanceFor( |
| 43 content::BrowserContext* context) const { | 43 content::BrowserContext* context) const { |
| 44 Profile* profile = static_cast<Profile*>(context); | 44 Profile* profile = static_cast<Profile*>(context); |
| 45 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
| 46 CloudPolicyManager* policy_manager = | 46 CloudPolicyManager* policy_manager = |
| 47 UserCloudPolicyManagerFactoryChromeOS::GetForProfile(profile); | 47 UserCloudPolicyManagerFactoryChromeOS::GetCloudPolicyManagerForProfile( |
| 48 profile); |
| 48 #else | 49 #else |
| 49 CloudPolicyManager* policy_manager = | 50 CloudPolicyManager* policy_manager = |
| 50 UserCloudPolicyManagerFactory::GetForBrowserContext(context); | 51 UserCloudPolicyManagerFactory::GetForBrowserContext(context); |
| 51 #endif | 52 #endif |
| 52 if (!policy_manager) | 53 if (!policy_manager) |
| 53 return NULL; | 54 return NULL; |
| 54 | 55 |
| 55 return new UserCloudPolicyInvalidator(profile, policy_manager); | 56 return new UserCloudPolicyInvalidator(profile, policy_manager); |
| 56 } | 57 } |
| 57 | 58 |
| 58 bool UserCloudPolicyInvalidatorFactory:: | 59 bool UserCloudPolicyInvalidatorFactory:: |
| 59 ServiceIsCreatedWithBrowserContext() const { | 60 ServiceIsCreatedWithBrowserContext() const { |
| 60 // Must be automatically created to enable user policy invalidations. | 61 // Must be automatically created to enable user policy invalidations. |
| 61 return true; | 62 return true; |
| 62 } | 63 } |
| 63 | 64 |
| 64 bool UserCloudPolicyInvalidatorFactory::ServiceIsNULLWhileTesting() const { | 65 bool UserCloudPolicyInvalidatorFactory::ServiceIsNULLWhileTesting() const { |
| 65 // Not used in tests. | 66 // Not used in tests. |
| 66 return true; | 67 return true; |
| 67 } | 68 } |
| 68 | 69 |
| 69 } // namespace policy | 70 } // namespace policy |
| OLD | NEW |