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 "base/profiler/scoped_profile.h" | 10 #include "base/profiler/scoped_tracker.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
16 #include "components/policy/core/common/cloud/cloud_policy_client_registration_h
elper.h" | 16 #include "components/policy/core/common/cloud/cloud_policy_client_registration_h
elper.h" |
17 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 17 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
18 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 18 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
19 #include "components/signin/core/browser/signin_manager.h" | 19 #include "components/signin/core/browser/signin_manager.h" |
20 #include "content/public/browser/notification_details.h" | 20 #include "content/public/browser/notification_details.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 void UserPolicySigninService::CallPolicyRegistrationCallback( | 102 void UserPolicySigninService::CallPolicyRegistrationCallback( |
103 scoped_ptr<CloudPolicyClient> client, | 103 scoped_ptr<CloudPolicyClient> client, |
104 PolicyRegistrationCallback callback) { | 104 PolicyRegistrationCallback callback) { |
105 registration_helper_.reset(); | 105 registration_helper_.reset(); |
106 callback.Run(client->dm_token(), client->client_id()); | 106 callback.Run(client->dm_token(), client->client_id()); |
107 } | 107 } |
108 | 108 |
109 void UserPolicySigninService::OnRefreshTokenAvailable( | 109 void UserPolicySigninService::OnRefreshTokenAvailable( |
110 const std::string& account_id) { | 110 const std::string& account_id) { |
111 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. | 111 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. |
112 tracked_objects::ScopedProfile tracking_profile( | 112 tracked_objects::ScopedTracker tracking_profile( |
113 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 113 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
114 "422460 UserPolicySigninService::OnRefreshTokenAvailable")); | 114 "422460 UserPolicySigninService::OnRefreshTokenAvailable")); |
115 | 115 |
116 // If using a TestingProfile with no UserCloudPolicyManager, skip | 116 // If using a TestingProfile with no UserCloudPolicyManager, skip |
117 // initialization. | 117 // initialization. |
118 if (!policy_manager()) { | 118 if (!policy_manager()) { |
119 DVLOG(1) << "Skipping initialization for tests due to missing components."; | 119 DVLOG(1) << "Skipping initialization for tests due to missing components."; |
120 return; | 120 return; |
121 } | 121 } |
122 | 122 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 | 196 |
197 void UserPolicySigninService::ProhibitSignoutIfNeeded() { | 197 void UserPolicySigninService::ProhibitSignoutIfNeeded() { |
198 if (policy_manager()->IsClientRegistered()) { | 198 if (policy_manager()->IsClientRegistered()) { |
199 DVLOG(1) << "User is registered for policy - prohibiting signout"; | 199 DVLOG(1) << "User is registered for policy - prohibiting signout"; |
200 signin_manager()->ProhibitSignout(true); | 200 signin_manager()->ProhibitSignout(true); |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 } // namespace policy | 204 } // namespace policy |
OLD | NEW |