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

Side by Side Diff: chrome/browser/chromeos/login/signin/merge_session_throttle.cc

Issue 375413002: Replace chromeos::UserManager::Get() with chromeos::GetUserManager(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/login/signin/merge_session_throttle.h" 5 #include "chrome/browser/chromeos/login/signin/merge_session_throttle.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 DVLOG(1) << "All profiles merged " << all_profiles_restored_; 157 DVLOG(1) << "All profiles merged " << all_profiles_restored_;
158 } 158 }
159 } 159 }
160 160
161 // static 161 // static
162 bool MergeSessionThrottle::ShouldDelayRequest( 162 bool MergeSessionThrottle::ShouldDelayRequest(
163 int render_process_id, 163 int render_process_id,
164 int render_view_id) { 164 int render_view_id) {
165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
166 166
167 if (!chromeos::UserManager::Get()->IsUserLoggedIn()) { 167 if (!chromeos::GetUserManager()->IsUserLoggedIn()) {
168 return false; 168 return false;
169 } else if (!chromeos::UserManager::Get()->IsLoggedInAsRegularUser()) { 169 } else if (!chromeos::GetUserManager()->IsLoggedInAsRegularUser()) {
170 // This is not a regular user session, let's remove the throttle 170 // This is not a regular user session, let's remove the throttle
171 // permanently. 171 // permanently.
172 if (!AreAllSessionMergedAlready()) 172 if (!AreAllSessionMergedAlready())
173 base::AtomicRefCountInc(&all_profiles_restored_); 173 base::AtomicRefCountInc(&all_profiles_restored_);
174 174
175 return false; 175 return false;
176 } 176 }
177 177
178 RenderViewHost* render_view_host = 178 RenderViewHost* render_view_host =
179 RenderViewHost::FromID(render_process_id, render_view_id); 179 RenderViewHost::FromID(render_process_id, render_view_id);
(...skipping 20 matching lines...) Expand all
200 if (!login_manager) 200 if (!login_manager)
201 return false; 201 return false;
202 202
203 switch (login_manager->state()) { 203 switch (login_manager->state()) {
204 case chromeos::OAuth2LoginManager::SESSION_RESTORE_NOT_STARTED: 204 case chromeos::OAuth2LoginManager::SESSION_RESTORE_NOT_STARTED:
205 // The session restore for this profile hasn't even started yet. Don't 205 // The session restore for this profile hasn't even started yet. Don't
206 // block for now. 206 // block for now.
207 // In theory this should not happen since we should 207 // In theory this should not happen since we should
208 // kick off the session restore process for the newly added profile 208 // kick off the session restore process for the newly added profile
209 // before we attempt loading any page. 209 // before we attempt loading any page.
210 if (chromeos::UserManager::Get()->IsLoggedInAsRegularUser() && 210 if (chromeos::GetUserManager()->IsLoggedInAsRegularUser() &&
211 !chromeos::UserManager::Get()->IsLoggedInAsStub()) { 211 !chromeos::GetUserManager()->IsLoggedInAsStub()) {
212 LOG(WARNING) << "Loading content for a profile without " 212 LOG(WARNING) << "Loading content for a profile without "
213 << "session restore?"; 213 << "session restore?";
214 } 214 }
215 return false; 215 return false;
216 case chromeos::OAuth2LoginManager::SESSION_RESTORE_PREPARING: 216 case chromeos::OAuth2LoginManager::SESSION_RESTORE_PREPARING:
217 case chromeos::OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS: { 217 case chromeos::OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS: {
218 // Check if the session restore has been going on for a while already. 218 // Check if the session restore has been going on for a while already.
219 // If so, don't attempt to block page loading. 219 // If so, don't attempt to block page loading.
220 if ((base::Time::Now() - 220 if ((base::Time::Now() -
221 login_manager->session_restore_start()).InSeconds() > 221 login_manager->session_restore_start()).InSeconds() >
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 Profile* profile = Profile::FromBrowserContext( 267 Profile* profile = Profile::FromBrowserContext(
268 web_contents->GetBrowserContext()); 268 web_contents->GetBrowserContext());
269 (new chromeos::MergeSessionXHRRequestWaiter(profile, 269 (new chromeos::MergeSessionXHRRequestWaiter(profile,
270 callback))->StartWaiting(); 270 callback))->StartWaiting();
271 } 271 }
272 } else { 272 } else {
273 BrowserThread::PostTask( 273 BrowserThread::PostTask(
274 BrowserThread::IO, FROM_HERE, callback); 274 BrowserThread::IO, FROM_HERE, callback);
275 } 275 }
276 } 276 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/signin/auth_sync_observer.cc ('k') | chrome/browser/chromeos/login/signin/oauth2_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698