OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/cloud/user_policy_signin_service.h" | 5 #include "chrome/browser/policy/cloud/user_policy_signin_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 local_state, | 35 local_state, |
36 device_management_service, | 36 device_management_service, |
37 policy_manager, | 37 policy_manager, |
38 signin_manager, | 38 signin_manager, |
39 system_request_context), | 39 system_request_context), |
40 profile_(profile), | 40 profile_(profile), |
41 oauth2_token_service_(token_service) { | 41 oauth2_token_service_(token_service) { |
42 // ProfileOAuth2TokenService should not yet have loaded its tokens since this | 42 // ProfileOAuth2TokenService should not yet have loaded its tokens since this |
43 // happens in the background after PKS initialization - so this service | 43 // happens in the background after PKS initialization - so this service |
44 // should always be created before the oauth token is available. | 44 // should always be created before the oauth token is available. |
45 DCHECK(!oauth2_token_service_->RefreshTokenIsAvailable( | 45 DCHECK(!signin_manager->IsAuthenticated() || |
Andrew T Wilson (Slow)
2014/10/07 16:31:23
Why is this required - does RefreshTokenIsAvailabl
Roger Tawa OOO till Jul 10th
2014/10/07 19:37:34
Previously, you could call RefreshTokenIsAvailable
Roger Tawa OOO till Jul 10th
2014/10/08 19:47:29
I've decided to remove the validity check only fro
| |
46 signin_manager->GetAuthenticatedAccountId())); | 46 (!oauth2_token_service_->RefreshTokenIsAvailable( |
47 signin_manager->GetAuthenticatedAccountId()))); | |
47 | 48 |
48 // Listen for an OAuth token to become available so we can register a client | 49 // Listen for an OAuth token to become available so we can register a client |
49 // if for some reason the client is not already registered (for example, if | 50 // if for some reason the client is not already registered (for example, if |
50 // the policy load failed during initial signin). | 51 // the policy load failed during initial signin). |
51 oauth2_token_service_->AddObserver(this); | 52 oauth2_token_service_->AddObserver(this); |
52 } | 53 } |
53 | 54 |
54 UserPolicySigninService::~UserPolicySigninService() { | 55 UserPolicySigninService::~UserPolicySigninService() { |
55 } | 56 } |
56 | 57 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 } | 190 } |
190 | 191 |
191 void UserPolicySigninService::ProhibitSignoutIfNeeded() { | 192 void UserPolicySigninService::ProhibitSignoutIfNeeded() { |
192 if (policy_manager()->IsClientRegistered()) { | 193 if (policy_manager()->IsClientRegistered()) { |
193 DVLOG(1) << "User is registered for policy - prohibiting signout"; | 194 DVLOG(1) << "User is registered for policy - prohibiting signout"; |
194 signin_manager()->ProhibitSignout(true); | 195 signin_manager()->ProhibitSignout(true); |
195 } | 196 } |
196 } | 197 } |
197 | 198 |
198 } // namespace policy | 199 } // namespace policy |
OLD | NEW |