| 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 "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide
r_impl.h" | 5 #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide
r_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 return; | 300 return; |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 | 303 |
| 304 if (!device_invalidation_service_) { | 304 if (!device_invalidation_service_) { |
| 305 // If no other connected invalidation service was found and no device-global | 305 // If no other connected invalidation service was found and no device-global |
| 306 // invalidation service exists, create one. | 306 // invalidation service exists, create one. |
| 307 device_invalidation_service_.reset( | 307 device_invalidation_service_.reset( |
| 308 new invalidation::TiclInvalidationService( | 308 new invalidation::TiclInvalidationService( |
| 309 GetUserAgent(), | 309 GetUserAgent(), |
| 310 scoped_ptr<IdentityProvider>(new chromeos::DeviceIdentityProvider( | 310 std::unique_ptr<IdentityProvider>( |
| 311 chromeos::DeviceOAuth2TokenServiceFactory::Get())), | 311 new chromeos::DeviceIdentityProvider( |
| 312 scoped_ptr<invalidation::TiclSettingsProvider>( | 312 chromeos::DeviceOAuth2TokenServiceFactory::Get())), |
| 313 std::unique_ptr<invalidation::TiclSettingsProvider>( |
| 313 new TiclDeviceSettingsProvider), | 314 new TiclDeviceSettingsProvider), |
| 314 g_browser_process->gcm_driver(), | 315 g_browser_process->gcm_driver(), |
| 315 g_browser_process->system_request_context())); | 316 g_browser_process->system_request_context())); |
| 316 device_invalidation_service_->Init( | 317 device_invalidation_service_->Init( |
| 317 scoped_ptr<syncer::InvalidationStateTracker>( | 318 std::unique_ptr<syncer::InvalidationStateTracker>( |
| 318 new invalidation::InvalidatorStorage( | 319 new invalidation::InvalidatorStorage( |
| 319 g_browser_process->local_state()))); | 320 g_browser_process->local_state()))); |
| 320 device_invalidation_service_observer_.reset( | 321 device_invalidation_service_observer_.reset( |
| 321 new InvalidationServiceObserver( | 322 new InvalidationServiceObserver( |
| 322 this, | 323 this, |
| 323 device_invalidation_service_.get())); | 324 device_invalidation_service_.get())); |
| 324 } | 325 } |
| 325 | 326 |
| 326 if (device_invalidation_service_observer_->IsServiceConnected()) { | 327 if (device_invalidation_service_observer_->IsServiceConnected()) { |
| 327 // If the device-global invalidation service is connected already, make it | 328 // If the device-global invalidation service is connected already, make it |
| 328 // available to consumers immediately. Otherwise, the invalidation service | 329 // available to consumers immediately. Otherwise, the invalidation service |
| 329 // will be made available to clients when it successfully connects. | 330 // will be made available to clients when it successfully connects. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 340 OnInvalidationServiceSet(invalidation_service_)); | 341 OnInvalidationServiceSet(invalidation_service_)); |
| 341 } | 342 } |
| 342 | 343 |
| 343 void | 344 void |
| 344 AffiliatedInvalidationServiceProviderImpl::DestroyDeviceInvalidationService() { | 345 AffiliatedInvalidationServiceProviderImpl::DestroyDeviceInvalidationService() { |
| 345 device_invalidation_service_observer_.reset(); | 346 device_invalidation_service_observer_.reset(); |
| 346 device_invalidation_service_.reset(); | 347 device_invalidation_service_.reset(); |
| 347 } | 348 } |
| 348 | 349 |
| 349 } // namespace policy | 350 } // namespace policy |
| OLD | NEW |