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

Side by Side Diff: chrome/browser/ui/auto_login_prompter.cc

Issue 8698001: sync: change semantics (and name) of SigninManager::GetUsername (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: first Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/auto_login_prompter.h" 5 #include "chrome/browser/ui/auto_login_prompter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // In an incognito window, there may not be a profile sync service and/or 298 // In an incognito window, there may not be a profile sync service and/or
299 // signin manager. 299 // signin manager.
300 if (!profile->HasProfileSyncService()) 300 if (!profile->HasProfileSyncService())
301 return; 301 return;
302 SigninManager* signin_manager = profile->GetProfileSyncService()->signin(); 302 SigninManager* signin_manager = profile->GetProfileSyncService()->signin();
303 if (!signin_manager) 303 if (!signin_manager)
304 return; 304 return;
305 305
306 // Make sure that |account|, if specified, matches the logged in user. 306 // Make sure that |account|, if specified, matches the logged in user.
307 // However, |account| is usually empty. 307 // However, |account| is usually empty.
308 const std::string& username = signin_manager->GetUsername(); 308 const std::string& username = signin_manager->GetAuthenticatedUsername();
309 if (!account.empty() && (username != account)) 309 if (!account.empty() && (username != account))
310 return; 310 return;
311 311
312 // Make sure there are credentials in the token manager, otherwise there is 312 // Make sure there are credentials in the token manager, otherwise there is
313 // no way to craft the TokenAuth URL. 313 // no way to craft the TokenAuth URL.
314 if (!profile->GetTokenService()->AreCredentialsValid()) 314 if (!profile->GetTokenService()->AreCredentialsValid())
315 return; 315 return;
316 316
317 // We can't add the infobar just yet, since we need to wait for the tab to 317 // We can't add the infobar just yet, since we need to wait for the tab to
318 // finish loading. If we don't, the info bar appears and then disappears 318 // finish loading. If we don't, the info bar appears and then disappears
(...skipping 16 matching lines...) Expand all
335 infobar_helper, &tab_contents_->controller(), 335 infobar_helper, &tab_contents_->controller(),
336 profile->GetTokenService(), profile->GetPrefs(), 336 profile->GetTokenService(), profile->GetPrefs(),
337 username_, args_)); 337 username_, args_));
338 } 338 }
339 } 339 }
340 // Either we couldn't add the infobar, we added the infobar, or the tab 340 // Either we couldn't add the infobar, we added the infobar, or the tab
341 // contents was destroyed before the navigation completed. In any case 341 // contents was destroyed before the navigation completed. In any case
342 // there's no reason to live further. 342 // there's no reason to live further.
343 delete this; 343 delete this;
344 } 344 }
OLDNEW
« chrome/browser/sync/signin_manager.cc ('K') | « chrome/browser/sync/test_profile_sync_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698