| 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 "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 invalidation::ProfileInvalidationProviderFactory::GetForProfile(profile); | 151 invalidation::ProfileInvalidationProviderFactory::GetForProfile(profile); |
| 152 if (!invalidation_provider) { | 152 if (!invalidation_provider) { |
| 153 // If the Profile does not support invalidation (e.g. guest, incognito), | 153 // If the Profile does not support invalidation (e.g. guest, incognito), |
| 154 // ignore it. | 154 // ignore it. |
| 155 return; | 155 return; |
| 156 } | 156 } |
| 157 const user_manager::User* user = | 157 const user_manager::User* user = |
| 158 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 158 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
| 159 if (!user || | 159 if (!user || |
| 160 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> | 160 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> |
| 161 GetUserAffiliation(user->email()) != USER_AFFILIATION_MANAGED) { | 161 GetUserAffiliation(user->GetUserID()) != USER_AFFILIATION_MANAGED) { |
| 162 // If the Profile belongs to a user who is not affiliated with the device's | 162 // If the Profile belongs to a user who is not affiliated with the device's |
| 163 // enrollment domain, ignore it. | 163 // enrollment domain, ignore it. |
| 164 return; | 164 return; |
| 165 } | 165 } |
| 166 | 166 |
| 167 // Create a state observer for the user's invalidation service. | 167 // Create a state observer for the user's invalidation service. |
| 168 invalidation::InvalidationService* invalidation_service = | 168 invalidation::InvalidationService* invalidation_service = |
| 169 invalidation_provider->GetInvalidationService(); | 169 invalidation_provider->GetInvalidationService(); |
| 170 profile_invalidation_service_observers_.push_back( | 170 profile_invalidation_service_observers_.push_back( |
| 171 new InvalidationServiceObserver(this, invalidation_service)); | 171 new InvalidationServiceObserver(this, invalidation_service)); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 OnInvalidationServiceSet(invalidation_service_)); | 341 OnInvalidationServiceSet(invalidation_service_)); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void | 344 void |
| 345 AffiliatedInvalidationServiceProviderImpl::DestroyDeviceInvalidationService() { | 345 AffiliatedInvalidationServiceProviderImpl::DestroyDeviceInvalidationService() { |
| 346 device_invalidation_service_observer_.reset(); | 346 device_invalidation_service_observer_.reset(); |
| 347 device_invalidation_service_.reset(); | 347 device_invalidation_service_.reset(); |
| 348 } | 348 } |
| 349 | 349 |
| 350 } // namespace policy | 350 } // namespace policy |
| OLD | NEW |