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

Side by Side Diff: chrome/browser/signin/signin_manager.cc

Issue 10213013: Now CHECKs to make sure we log out before clearing the token db (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback. Created 8 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/signin/token_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/signin/signin_manager.h" 5 #include "chrome/browser/signin/signin_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 had_two_factor_error_(false) { 49 had_two_factor_error_(false) {
50 } 50 }
51 51
52 SigninManager::~SigninManager() {} 52 SigninManager::~SigninManager() {}
53 53
54 void SigninManager::Initialize(Profile* profile) { 54 void SigninManager::Initialize(Profile* profile) {
55 // Should never call Initialize() twice. 55 // Should never call Initialize() twice.
56 DCHECK(!IsInitialized()); 56 DCHECK(!IsInitialized());
57 profile_ = profile; 57 profile_ = profile;
58 58
59 // If the user is clearing the token service from the command line, then
60 // clear their login info also (not valid to be logged in without any
61 // tokens).
62 CommandLine* cmd_line = CommandLine::ForCurrentProcess();
63 if (cmd_line->HasSwitch(switches::kClearTokenService))
64 profile->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername);
65
59 std::string user = profile_->GetPrefs()->GetString( 66 std::string user = profile_->GetPrefs()->GetString(
60 prefs::kGoogleServicesUsername); 67 prefs::kGoogleServicesUsername);
61 if (!user.empty()) 68 if (!user.empty())
62 SetAuthenticatedUsername(user); 69 SetAuthenticatedUsername(user);
63 // TokenService can be null for unit tests. 70 // TokenService can be null for unit tests.
64 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); 71 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
65 if (token_service) { 72 if (token_service) {
66 token_service->Initialize(GaiaConstants::kChromeSource, profile_); 73 token_service->Initialize(GaiaConstants::kChromeSource, profile_);
67 if (!authenticated_username_.empty()) { 74 if (!authenticated_username_.empty()) {
68 token_service->LoadTokensFromDB(); 75 token_service->LoadTokensFromDB();
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 profile_->GetRequestContext())); 405 profile_->GetRequestContext()));
399 } 406 }
400 407
401 client_login_->StartMergeSession(tok_details->token()); 408 client_login_->StartMergeSession(tok_details->token());
402 409
403 // We only want to do this once per sign-in. 410 // We only want to do this once per sign-in.
404 CleanupNotificationRegistration(); 411 CleanupNotificationRegistration();
405 } 412 }
406 #endif 413 #endif
407 } 414 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/token_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698