OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_base.h" | 5 #include "chrome/browser/policy/cloud/user_policy_signin_service_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 manager->core()->client()->RemoveObserver(this); | 144 manager->core()->client()->RemoveObserver(this); |
145 if (manager && manager->core()->service()) | 145 if (manager && manager->core()->service()) |
146 manager->core()->service()->RemoveObserver(this); | 146 manager->core()->service()->RemoveObserver(this); |
147 } | 147 } |
148 | 148 |
149 scoped_ptr<CloudPolicyClient> | 149 scoped_ptr<CloudPolicyClient> |
150 UserPolicySigninServiceBase::CreateClientForRegistrationOnly( | 150 UserPolicySigninServiceBase::CreateClientForRegistrationOnly( |
151 const std::string& username) { | 151 const std::string& username) { |
152 DCHECK(!username.empty()); | 152 DCHECK(!username.empty()); |
153 // We should not be called with a client already initialized. | 153 // We should not be called with a client already initialized. |
| 154 #if !defined(OS_IOS) |
| 155 // On iOS we check if an account has policy while the profile is signed in |
| 156 // to another account. |
154 DCHECK(!policy_manager() || !policy_manager()->core()->client()); | 157 DCHECK(!policy_manager() || !policy_manager()->core()->client()); |
| 158 #endif |
155 | 159 |
156 // If the user should not get policy, just bail out. | 160 // If the user should not get policy, just bail out. |
157 if (!policy_manager() || !ShouldLoadPolicyForUser(username)) { | 161 if (!policy_manager() || !ShouldLoadPolicyForUser(username)) { |
158 DVLOG(1) << "Signed in user is not in the whitelist"; | 162 DVLOG(1) << "Signed in user is not in the whitelist"; |
159 return scoped_ptr<CloudPolicyClient>(); | 163 return scoped_ptr<CloudPolicyClient>(); |
160 } | 164 } |
161 | 165 |
162 // If the DeviceManagementService is not yet initialized, start it up now. | 166 // If the DeviceManagementService is not yet initialized, start it up now. |
163 device_management_service_->ScheduleInitialization(0); | 167 device_management_service_->ScheduleInitialization(0); |
164 | 168 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 263 } |
260 | 264 |
261 scoped_refptr<net::URLRequestContextGetter> | 265 scoped_refptr<net::URLRequestContextGetter> |
262 UserPolicySigninServiceBase::CreateUserRequestContext( | 266 UserPolicySigninServiceBase::CreateUserRequestContext( |
263 scoped_refptr<net::URLRequestContextGetter> profile_request_context) { | 267 scoped_refptr<net::URLRequestContextGetter> profile_request_context) { |
264 return new UserPolicyRequestContext( | 268 return new UserPolicyRequestContext( |
265 profile_request_context, system_request_context(), GetUserAgent()); | 269 profile_request_context, system_request_context(), GetUserAgent()); |
266 } | 270 } |
267 | 271 |
268 } // namespace policy | 272 } // namespace policy |
OLD | NEW |