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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 void UserPolicySigninServiceBase::GoogleSignedOut(const std::string& account_id, | 76 void UserPolicySigninServiceBase::GoogleSignedOut(const std::string& account_id, |
77 const std::string& username) { | 77 const std::string& username) { |
78 ShutdownUserCloudPolicyManager(); | 78 ShutdownUserCloudPolicyManager(); |
79 } | 79 } |
80 | 80 |
81 void UserPolicySigninServiceBase::Observe( | 81 void UserPolicySigninServiceBase::Observe( |
82 int type, | 82 int type, |
83 const content::NotificationSource& source, | 83 const content::NotificationSource& source, |
84 const content::NotificationDetails& details) { | 84 const content::NotificationDetails& details) { |
85 switch (type) { | 85 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_ADDED, type); |
86 case chrome::NOTIFICATION_PROFILE_ADDED: | 86 |
87 // A new profile has been loaded - if it's signed in, then initialize the | 87 // A new profile has been loaded - if it's signed in, then initialize the |
88 // UCPM, otherwise shut down the UCPM (which deletes any cached policy | 88 // UCPM, otherwise shut down the UCPM (which deletes any cached policy |
89 // data). This must be done here instead of at constructor time because | 89 // data). This must be done here instead of at constructor time because |
90 // the Profile is not fully initialized when this object is constructed | 90 // the Profile is not fully initialized when this object is constructed |
91 // (DoFinalInit() has not yet been called, so ProfileIOData and | 91 // (DoFinalInit() has not yet been called, so ProfileIOData and |
92 // SSLConfigServiceManager have not been created yet). | 92 // SSLConfigServiceManager have not been created yet). |
93 // TODO(atwilson): Switch to using a timer instead, to avoid contention | 93 // TODO(atwilson): Switch to using a timer instead, to avoid contention |
94 // with other services at startup (http://crbug.com/165468). | 94 // with other services at startup (http://crbug.com/165468). |
95 InitializeOnProfileReady(content::Source<Profile>(source).ptr()); | 95 InitializeOnProfileReady(content::Source<Profile>(source).ptr()); |
96 break; | |
97 default: | |
98 NOTREACHED(); | |
99 } | |
100 } | 96 } |
101 | 97 |
102 void UserPolicySigninServiceBase::OnInitializationCompleted( | 98 void UserPolicySigninServiceBase::OnInitializationCompleted( |
103 CloudPolicyService* service) { | 99 CloudPolicyService* service) { |
104 // This is meant to be overridden by subclasses. Starting and stopping to | 100 // This is meant to be overridden by subclasses. Starting and stopping to |
105 // observe the CloudPolicyService from this base class avoids the need for | 101 // observe the CloudPolicyService from this base class avoids the need for |
106 // more virtuals. | 102 // more virtuals. |
107 } | 103 } |
108 | 104 |
109 void UserPolicySigninServiceBase::OnPolicyFetched(CloudPolicyClient* client) {} | 105 void UserPolicySigninServiceBase::OnPolicyFetched(CloudPolicyClient* client) {} |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 manager->DisconnectAndRemovePolicy(); | 250 manager->DisconnectAndRemovePolicy(); |
255 } | 251 } |
256 | 252 |
257 scoped_refptr<net::URLRequestContextGetter> | 253 scoped_refptr<net::URLRequestContextGetter> |
258 UserPolicySigninServiceBase::CreateSystemRequestContext() { | 254 UserPolicySigninServiceBase::CreateSystemRequestContext() { |
259 return new SystemPolicyRequestContext( | 255 return new SystemPolicyRequestContext( |
260 system_request_context(), GetUserAgent()); | 256 system_request_context(), GetUserAgent()); |
261 } | 257 } |
262 | 258 |
263 } // namespace policy | 259 } // namespace policy |
OLD | NEW |