OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/invalidation/ticl_invalidation_service.h" | 5 #include "chrome/browser/invalidation/ticl_invalidation_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/invalidation/gcm_invalidation_bridge.h" | 10 #include "chrome/browser/invalidation/gcm_invalidation_bridge.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 identity_provider_->RemoveActiveAccountRefreshTokenObserver(this); | 320 identity_provider_->RemoveActiveAccountRefreshTokenObserver(this); |
321 identity_provider_->RemoveObserver(this); | 321 identity_provider_->RemoveObserver(this); |
322 if (IsStarted()) { | 322 if (IsStarted()) { |
323 StopInvalidator(); | 323 StopInvalidator(); |
324 } | 324 } |
325 invalidation_state_tracker_.reset(); | 325 invalidation_state_tracker_.reset(); |
326 invalidator_registrar_.reset(); | 326 invalidator_registrar_.reset(); |
327 } | 327 } |
328 | 328 |
329 bool TiclInvalidationService::IsReadyToStart() { | 329 bool TiclInvalidationService::IsReadyToStart() { |
330 if (profile_->IsManaged()) { | |
331 DVLOG(2) << "Not starting TiclInvalidationService: User is managed."; | |
332 return false; | |
333 } | |
334 | |
335 if (identity_provider_->GetActiveAccountId().empty()) { | 330 if (identity_provider_->GetActiveAccountId().empty()) { |
336 DVLOG(2) << "Not starting TiclInvalidationService: User is not signed in."; | 331 DVLOG(2) << "Not starting TiclInvalidationService: User is not signed in."; |
337 return false; | 332 return false; |
338 } | 333 } |
339 | 334 |
340 OAuth2TokenService* token_service = identity_provider_->GetTokenService(); | 335 OAuth2TokenService* token_service = identity_provider_->GetTokenService(); |
341 if (!token_service) { | 336 if (!token_service) { |
342 DVLOG(2) | 337 DVLOG(2) |
343 << "Not starting TiclInvalidationService: " | 338 << "Not starting TiclInvalidationService: " |
344 << "OAuth2TokenService unavailable."; | 339 << "OAuth2TokenService unavailable."; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 } | 450 } |
456 | 451 |
457 void TiclInvalidationService::StopInvalidator() { | 452 void TiclInvalidationService::StopInvalidator() { |
458 DCHECK(invalidator_); | 453 DCHECK(invalidator_); |
459 gcm_invalidation_bridge_.reset(); | 454 gcm_invalidation_bridge_.reset(); |
460 invalidator_->UnregisterHandler(this); | 455 invalidator_->UnregisterHandler(this); |
461 invalidator_.reset(); | 456 invalidator_.reset(); |
462 } | 457 } |
463 | 458 |
464 } // namespace invalidation | 459 } // namespace invalidation |
OLD | NEW |