OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/invalidation/ios_chrome_profile_invalidation_provid
er_factory.h" | 5 #include "ios/chrome/browser/invalidation/ios_chrome_profile_invalidation_provid
er_factory.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <utility> | 8 #include <utility> |
8 | 9 |
9 #include "base/callback.h" | 10 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/ptr_util.h" |
11 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
12 #include "components/gcm_driver/gcm_profile_service.h" | 13 #include "components/gcm_driver/gcm_profile_service.h" |
13 #include "components/invalidation/impl/invalidator_storage.h" | 14 #include "components/invalidation/impl/invalidator_storage.h" |
14 #include "components/invalidation/impl/profile_invalidation_provider.h" | 15 #include "components/invalidation/impl/profile_invalidation_provider.h" |
15 #include "components/invalidation/impl/ticl_invalidation_service.h" | 16 #include "components/invalidation/impl/ticl_invalidation_service.h" |
16 #include "components/invalidation/impl/ticl_profile_settings_provider.h" | 17 #include "components/invalidation/impl/ticl_profile_settings_provider.h" |
17 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | 18 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
18 #include "components/pref_registry/pref_registry_syncable.h" | 19 #include "components/pref_registry/pref_registry_syncable.h" |
19 #include "components/prefs/pref_registry.h" | 20 #include "components/prefs/pref_registry.h" |
20 #include "components/signin/core/browser/profile_identity_provider.h" | 21 #include "components/signin/core/browser/profile_identity_provider.h" |
(...skipping 29 matching lines...) Expand all Loading... |
50 "InvalidationService", | 51 "InvalidationService", |
51 BrowserStateDependencyManager::GetInstance()) { | 52 BrowserStateDependencyManager::GetInstance()) { |
52 DependsOn(ios::SigninManagerFactory::GetInstance()); | 53 DependsOn(ios::SigninManagerFactory::GetInstance()); |
53 DependsOn(IOSChromeGCMProfileServiceFactory::GetInstance()); | 54 DependsOn(IOSChromeGCMProfileServiceFactory::GetInstance()); |
54 DependsOn(OAuth2TokenServiceFactory::GetInstance()); | 55 DependsOn(OAuth2TokenServiceFactory::GetInstance()); |
55 } | 56 } |
56 | 57 |
57 IOSChromeProfileInvalidationProviderFactory:: | 58 IOSChromeProfileInvalidationProviderFactory:: |
58 ~IOSChromeProfileInvalidationProviderFactory() {} | 59 ~IOSChromeProfileInvalidationProviderFactory() {} |
59 | 60 |
60 scoped_ptr<KeyedService> | 61 std::unique_ptr<KeyedService> |
61 IOSChromeProfileInvalidationProviderFactory::BuildServiceInstanceFor( | 62 IOSChromeProfileInvalidationProviderFactory::BuildServiceInstanceFor( |
62 web::BrowserState* context) const { | 63 web::BrowserState* context) const { |
63 ios::ChromeBrowserState* browser_state = | 64 ios::ChromeBrowserState* browser_state = |
64 ios::ChromeBrowserState::FromBrowserState(context); | 65 ios::ChromeBrowserState::FromBrowserState(context); |
65 | 66 |
66 scoped_ptr<IdentityProvider> identity_provider(new ProfileIdentityProvider( | 67 std::unique_ptr<IdentityProvider> identity_provider( |
67 ios::SigninManagerFactory::GetForBrowserState(browser_state), | 68 new ProfileIdentityProvider( |
68 OAuth2TokenServiceFactory::GetForBrowserState(browser_state), | 69 ios::SigninManagerFactory::GetForBrowserState(browser_state), |
69 // LoginUIServiceFactory is not built on iOS. | 70 OAuth2TokenServiceFactory::GetForBrowserState(browser_state), |
70 base::Closure())); | 71 // LoginUIServiceFactory is not built on iOS. |
| 72 base::Closure())); |
71 | 73 |
72 scoped_ptr<TiclInvalidationService> service(new TiclInvalidationService( | 74 std::unique_ptr<TiclInvalidationService> service(new TiclInvalidationService( |
73 web::GetWebClient()->GetUserAgent(false), std::move(identity_provider), | 75 web::GetWebClient()->GetUserAgent(false), std::move(identity_provider), |
74 make_scoped_ptr(new invalidation::TiclProfileSettingsProvider( | 76 base::WrapUnique(new invalidation::TiclProfileSettingsProvider( |
75 browser_state->GetPrefs())), | 77 browser_state->GetPrefs())), |
76 IOSChromeGCMProfileServiceFactory::GetForBrowserState(browser_state) | 78 IOSChromeGCMProfileServiceFactory::GetForBrowserState(browser_state) |
77 ->driver(), | 79 ->driver(), |
78 browser_state->GetRequestContext())); | 80 browser_state->GetRequestContext())); |
79 service->Init( | 81 service->Init( |
80 make_scoped_ptr(new InvalidatorStorage(browser_state->GetPrefs()))); | 82 base::WrapUnique(new InvalidatorStorage(browser_state->GetPrefs()))); |
81 | 83 |
82 return make_scoped_ptr(new ProfileInvalidationProvider(std::move(service))); | 84 return base::WrapUnique(new ProfileInvalidationProvider(std::move(service))); |
83 } | 85 } |
84 | 86 |
85 void IOSChromeProfileInvalidationProviderFactory::RegisterBrowserStatePrefs( | 87 void IOSChromeProfileInvalidationProviderFactory::RegisterBrowserStatePrefs( |
86 user_prefs::PrefRegistrySyncable* registry) { | 88 user_prefs::PrefRegistrySyncable* registry) { |
87 ProfileInvalidationProvider::RegisterProfilePrefs(registry); | 89 ProfileInvalidationProvider::RegisterProfilePrefs(registry); |
88 InvalidatorStorage::RegisterProfilePrefs(registry); | 90 InvalidatorStorage::RegisterProfilePrefs(registry); |
89 } | 91 } |
OLD | NEW |