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/message_loop/message_loop.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 12 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/signin/signin_manager_factory.h" | 14 #include "chrome/browser/signin/signin_manager_factory.h" |
13 #include "chrome/common/chrome_content_client.h" | 15 #include "chrome/common/chrome_content_client.h" |
14 #include "components/policy/core/browser/browser_policy_connector.h" | 16 #include "components/policy/core/browser/browser_policy_connector.h" |
15 #include "components/policy/core/common/cloud/device_management_service.h" | 17 #include "components/policy/core/common/cloud/device_management_service.h" |
16 #include "components/policy/core/common/cloud/system_policy_request_context.h" | 18 #include "components/policy/core/common/cloud/system_policy_request_context.h" |
17 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 19 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
18 #include "components/signin/core/browser/signin_manager.h" | 20 #include "components/signin/core/browser/signin_manager.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // If the client is already registered, it means this error must have | 113 // If the client is already registered, it means this error must have |
112 // come from a policy fetch. | 114 // come from a policy fetch. |
113 if (client->status() == DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED) { | 115 if (client->status() == DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED) { |
114 // OK, policy fetch failed with MANAGEMENT_NOT_SUPPORTED - this is our | 116 // OK, policy fetch failed with MANAGEMENT_NOT_SUPPORTED - this is our |
115 // trigger to revert to "unmanaged" mode (we will check for management | 117 // trigger to revert to "unmanaged" mode (we will check for management |
116 // being re-enabled on the next restart and/or login). | 118 // being re-enabled on the next restart and/or login). |
117 DVLOG(1) << "DMServer returned NOT_SUPPORTED error - removing policy"; | 119 DVLOG(1) << "DMServer returned NOT_SUPPORTED error - removing policy"; |
118 | 120 |
119 // Can't shutdown now because we're in the middle of a callback from | 121 // Can't shutdown now because we're in the middle of a callback from |
120 // the CloudPolicyClient, so queue up a task to do the shutdown. | 122 // the CloudPolicyClient, so queue up a task to do the shutdown. |
121 base::MessageLoop::current()->PostTask( | 123 base::ThreadTaskRunnerHandle::Get()->PostTask( |
122 FROM_HERE, | 124 FROM_HERE, |
123 base::Bind( | 125 base::Bind( |
124 &UserPolicySigninServiceBase::ShutdownUserCloudPolicyManager, | 126 &UserPolicySigninServiceBase::ShutdownUserCloudPolicyManager, |
125 weak_factory_.GetWeakPtr())); | 127 weak_factory_.GetWeakPtr())); |
126 } else { | 128 } else { |
127 DVLOG(1) << "Error fetching policy: " << client->status(); | 129 DVLOG(1) << "Error fetching policy: " << client->status(); |
128 } | 130 } |
129 } | 131 } |
130 } | 132 } |
131 | 133 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 manager->DisconnectAndRemovePolicy(); | 255 manager->DisconnectAndRemovePolicy(); |
254 } | 256 } |
255 | 257 |
256 scoped_refptr<net::URLRequestContextGetter> | 258 scoped_refptr<net::URLRequestContextGetter> |
257 UserPolicySigninServiceBase::CreateSystemRequestContext() { | 259 UserPolicySigninServiceBase::CreateSystemRequestContext() { |
258 return new SystemPolicyRequestContext( | 260 return new SystemPolicyRequestContext( |
259 system_request_context(), GetUserAgent()); | 261 system_request_context(), GetUserAgent()); |
260 } | 262 } |
261 | 263 |
262 } // namespace policy | 264 } // namespace policy |
OLD | NEW |