Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: chrome/browser/policy/cloud/user_policy_signin_service.cc

Issue 26512003: Removed --disable-cloud-policy-on-signin flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/prefs/pref_service.h"
11 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/policy/cloud/cloud_policy_client_registration_helper.h" 12 #include "chrome/browser/policy/cloud/cloud_policy_client_registration_helper.h"
14 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" 13 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h"
15 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
17 #include "chrome/browser/signin/profile_oauth2_token_service.h" 16 #include "chrome/browser/signin/profile_oauth2_token_service.h"
18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
19 #include "chrome/browser/signin/signin_manager.h" 18 #include "chrome/browser/signin/signin_manager.h"
20 #include "chrome/common/pref_names.h"
21 #include "content/public/browser/notification_details.h" 19 #include "content/public/browser/notification_details.h"
22 #include "content/public/browser/notification_source.h" 20 #include "content/public/browser/notification_source.h"
23 #include "google_apis/gaia/gaia_constants.h" 21 #include "google_apis/gaia/gaia_constants.h"
24 #include "net/url_request/url_request_context_getter.h" 22 #include "net/url_request/url_request_context_getter.h"
25 23
26 namespace policy { 24 namespace policy {
27 25
28 UserPolicySigninService::UserPolicySigninService( 26 UserPolicySigninService::UserPolicySigninService(
29 Profile* profile, 27 Profile* profile,
30 PrefService* local_state, 28 PrefService* local_state,
31 scoped_refptr<net::URLRequestContextGetter> request_context, 29 scoped_refptr<net::URLRequestContextGetter> request_context,
32 DeviceManagementService* device_management_service, 30 DeviceManagementService* device_management_service,
33 ProfileOAuth2TokenService* token_service) 31 ProfileOAuth2TokenService* token_service)
34 : UserPolicySigninServiceBase(profile, 32 : UserPolicySigninServiceBase(profile,
35 local_state, 33 local_state,
36 request_context, 34 request_context,
37 device_management_service), 35 device_management_service),
38 oauth2_token_service_(token_service) { 36 oauth2_token_service_(token_service) {
39 if (profile->GetPrefs()->GetBoolean(prefs::kDisableCloudPolicyOnSignin))
40 return;
41
42 // ProfileOAuth2TokenService should not yet have loaded its tokens since this 37 // ProfileOAuth2TokenService should not yet have loaded its tokens since this
43 // happens in the background after PKS initialization - so this service 38 // happens in the background after PKS initialization - so this service
44 // should always be created before the oauth token is available. 39 // should always be created before the oauth token is available.
45 DCHECK(!oauth2_token_service_->RefreshTokenIsAvailable( 40 DCHECK(!oauth2_token_service_->RefreshTokenIsAvailable(
46 oauth2_token_service_->GetPrimaryAccountId())); 41 oauth2_token_service_->GetPrimaryAccountId()));
47 42
48 // Listen for an OAuth token to become available so we can register a client 43 // Listen for an OAuth token to become available so we can register a client
49 // if for some reason the client is not already registered (for example, if 44 // if for some reason the client is not already registered (for example, if
50 // the policy load failed during initial signin). 45 // the policy load failed during initial signin).
51 oauth2_token_service_->AddObserver(this); 46 oauth2_token_service_->AddObserver(this);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 184 }
190 185
191 void UserPolicySigninService::ProhibitSignoutIfNeeded() { 186 void UserPolicySigninService::ProhibitSignoutIfNeeded() {
192 if (GetManager()->IsClientRegistered()) { 187 if (GetManager()->IsClientRegistered()) {
193 DVLOG(1) << "User is registered for policy - prohibiting signout"; 188 DVLOG(1) << "User is registered for policy - prohibiting signout";
194 GetSigninManager()->ProhibitSignout(true); 189 GetSigninManager()->ProhibitSignout(true);
195 } 190 }
196 } 191 }
197 192
198 } // namespace policy 193 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698