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

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

Issue 2063863002: Use DCHECKs when observing only a single notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc ('k') | chrome/browser/prerender/prerender_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698