Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.cc

Issue 1306183007: Switch to id-based affiliation determination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 Profile* profile = content::Details<Profile>(details).ptr(); 149 Profile* profile = content::Details<Profile>(details).ptr();
150 invalidation::ProfileInvalidationProvider* invalidation_provider = 150 invalidation::ProfileInvalidationProvider* invalidation_provider =
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 || !user->is_affiliated()) {
160 g_browser_process->platform_part()->browser_policy_connector_chromeos()-> 160 // If the Profile belongs to a user who is not affiliated on the device,
Andrew T Wilson (Slow) 2015/09/16 15:02:05 nit: this is OK, but I think the old comment was m
peletskyi 2015/09/21 14:17:24 I would say that the phrase "enrollment domain" in
161 GetUserAffiliation(user->email()) != USER_AFFILIATION_MANAGED) { 161 // ignore it.
162 // If the Profile belongs to a user who is not affiliated with the device's
163 // enrollment domain, ignore it.
164 return; 162 return;
165 } 163 }
166 164
167 // Create a state observer for the user's invalidation service. 165 // Create a state observer for the user's invalidation service.
168 invalidation::InvalidationService* invalidation_service = 166 invalidation::InvalidationService* invalidation_service =
169 invalidation_provider->GetInvalidationService(); 167 invalidation_provider->GetInvalidationService();
170 profile_invalidation_service_observers_.push_back( 168 profile_invalidation_service_observers_.push_back(
171 new InvalidationServiceObserver(this, invalidation_service)); 169 new InvalidationServiceObserver(this, invalidation_service));
172 170
173 if (profile_invalidation_service_observers_.back()->IsServiceConnected()) { 171 if (profile_invalidation_service_observers_.back()->IsServiceConnected()) {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 OnInvalidationServiceSet(invalidation_service_)); 339 OnInvalidationServiceSet(invalidation_service_));
342 } 340 }
343 341
344 void 342 void
345 AffiliatedInvalidationServiceProviderImpl::DestroyDeviceInvalidationService() { 343 AffiliatedInvalidationServiceProviderImpl::DestroyDeviceInvalidationService() {
346 device_invalidation_service_observer_.reset(); 344 device_invalidation_service_observer_.reset();
347 device_invalidation_service_.reset(); 345 device_invalidation_service_.reset();
348 } 346 }
349 347
350 } // namespace policy 348 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698