| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/invalidation/profile_invalidation_provider_factory.h" | 5 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/prefs/pref_registry.h" | 8 #include "base/prefs/pref_registry.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/invalidation/ticl_profile_settings_provider.h" | 10 #include "chrome/browser/invalidation/ticl_profile_settings_provider.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 void ProfileInvalidationProviderFactory::RegisterTestingFactory( | 90 void ProfileInvalidationProviderFactory::RegisterTestingFactory( |
| 91 TestingFactoryFunction testing_factory) { | 91 TestingFactoryFunction testing_factory) { |
| 92 testing_factory_ = testing_factory; | 92 testing_factory_ = testing_factory; |
| 93 } | 93 } |
| 94 | 94 |
| 95 KeyedService* ProfileInvalidationProviderFactory::BuildServiceInstanceFor( | 95 KeyedService* ProfileInvalidationProviderFactory::BuildServiceInstanceFor( |
| 96 content::BrowserContext* context) const { | 96 content::BrowserContext* context) const { |
| 97 if (testing_factory_) | 97 if (testing_factory_) |
| 98 return testing_factory_(context); | 98 return testing_factory_(context).release(); |
| 99 | 99 |
| 100 #if defined(OS_ANDROID) | 100 #if defined(OS_ANDROID) |
| 101 return new ProfileInvalidationProvider(scoped_ptr<InvalidationService>( | 101 return new ProfileInvalidationProvider(scoped_ptr<InvalidationService>( |
| 102 new InvalidationServiceAndroid(base::android::GetApplicationContext()))); | 102 new InvalidationServiceAndroid(base::android::GetApplicationContext()))); |
| 103 #else | 103 #else |
| 104 | 104 |
| 105 scoped_ptr<IdentityProvider> identity_provider; | 105 scoped_ptr<IdentityProvider> identity_provider; |
| 106 | 106 |
| 107 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
| 108 policy::BrowserPolicyConnectorChromeOS* connector = | 108 policy::BrowserPolicyConnectorChromeOS* connector = |
| (...skipping 30 matching lines...) Expand all Loading... |
| 139 | 139 |
| 140 void ProfileInvalidationProviderFactory::RegisterProfilePrefs( | 140 void ProfileInvalidationProviderFactory::RegisterProfilePrefs( |
| 141 user_prefs::PrefRegistrySyncable* registry) { | 141 user_prefs::PrefRegistrySyncable* registry) { |
| 142 registry->RegisterBooleanPref( | 142 registry->RegisterBooleanPref( |
| 143 prefs::kInvalidationServiceUseGCMChannel, | 143 prefs::kInvalidationServiceUseGCMChannel, |
| 144 true); // if no value in prefs, use GCM channel. | 144 true); // if no value in prefs, use GCM channel. |
| 145 InvalidatorStorage::RegisterProfilePrefs(registry); | 145 InvalidatorStorage::RegisterProfilePrefs(registry); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace invalidation | 148 } // namespace invalidation |
| OLD | NEW |