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 <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/profiler/scoped_tracker.h" | 12 #include "base/profiler/scoped_tracker.h" |
11 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
16 #include "components/policy/core/common/cloud/cloud_policy_client_registration_h
elper.h" | 18 #include "components/policy/core/common/cloud/cloud_policy_client_registration_h
elper.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // ProfileOAuth2TokenService now has a refresh token so initialize the | 130 // ProfileOAuth2TokenService now has a refresh token so initialize the |
129 // UserCloudPolicyManager. | 131 // UserCloudPolicyManager. |
130 InitializeForSignedInUser( | 132 InitializeForSignedInUser( |
131 signin_manager()->GetAuthenticatedAccountInfo().email, | 133 signin_manager()->GetAuthenticatedAccountInfo().email, |
132 profile_->GetRequestContext()); | 134 profile_->GetRequestContext()); |
133 } | 135 } |
134 | 136 |
135 void UserPolicySigninService::InitializeUserCloudPolicyManager( | 137 void UserPolicySigninService::InitializeUserCloudPolicyManager( |
136 const std::string& username, | 138 const std::string& username, |
137 scoped_ptr<CloudPolicyClient> client) { | 139 scoped_ptr<CloudPolicyClient> client) { |
138 UserPolicySigninServiceBase::InitializeUserCloudPolicyManager(username, | 140 UserPolicySigninServiceBase::InitializeUserCloudPolicyManager( |
139 client.Pass()); | 141 username, std::move(client)); |
140 ProhibitSignoutIfNeeded(); | 142 ProhibitSignoutIfNeeded(); |
141 } | 143 } |
142 | 144 |
143 void UserPolicySigninService::ShutdownUserCloudPolicyManager() { | 145 void UserPolicySigninService::ShutdownUserCloudPolicyManager() { |
144 UserCloudPolicyManager* manager = policy_manager(); | 146 UserCloudPolicyManager* manager = policy_manager(); |
145 // Allow the user to signout again. | 147 // Allow the user to signout again. |
146 if (manager) | 148 if (manager) |
147 signin_manager()->ProhibitSignout(false); | 149 signin_manager()->ProhibitSignout(false); |
148 UserPolicySigninServiceBase::ShutdownUserCloudPolicyManager(); | 150 UserPolicySigninServiceBase::ShutdownUserCloudPolicyManager(); |
149 } | 151 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 199 } |
198 | 200 |
199 void UserPolicySigninService::ProhibitSignoutIfNeeded() { | 201 void UserPolicySigninService::ProhibitSignoutIfNeeded() { |
200 if (policy_manager()->IsClientRegistered()) { | 202 if (policy_manager()->IsClientRegistered()) { |
201 DVLOG(1) << "User is registered for policy - prohibiting signout"; | 203 DVLOG(1) << "User is registered for policy - prohibiting signout"; |
202 signin_manager()->ProhibitSignout(true); | 204 signin_manager()->ProhibitSignout(true); |
203 } | 205 } |
204 } | 206 } |
205 | 207 |
206 } // namespace policy | 208 } // namespace policy |
OLD | NEW |